Prometheusbu部署使用-1
Prometheus+grafana部署使用
主机列表:
192.168.161.130 : Prometheus
192.168.161.128 : node-1
192.168.161.129 : node-2
二进制手动部署
解压 prometheus-2.14.0.linux-amd64.tar.gz包
解压放至 /usr/local下
- 编辑服务启动脚本
vim /usr/lib/systemd/system/prometheus.service
[Unit]
Description=Prometheus server daemon
[Service]
ExecStart=/usr/local/prome/prometheus --config.file=/usr/local/prome/prometheus.yml
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure
RestartSec=42s
[Install]
WantedBy=multi-user.target
systemctl daemon-reload # 加载后台服务
systemctl start | stop | restart | status prometheus
服务端监控配置文件内容
global: # 全局配置段
scrape_interval: 15s
evaluation_interval: 15s
external_labels:
monitor: 'codelab-monitor'
rule_files: # 告警规则配置
scrape_configs: # 监控配置
- job_name: 'prometheus' #监控任务名称
static_configs: # 静态监控配置
- targets: ['192.168.235.130:9090']
labels:
node: prome_server
使用动态发现添加主机
global: # 全局配置段
scrape_interval: 15s
evaluation_interval: 15s
external_labels:
monitor: 'codelab-monitor'
rule_files: # 告警规则配置
scrape_configs: # 监控配置
- job_name: 'prometheus' #监控任务名称
# static_configs: # 静态监控配置
# - targets: ['192.168.235.130:9090']
# labels:
# node: prome_server
file_sd_configs: # 基于配置文件动态发现添加主机
- files: ['/usr/local/prome/sd_config/*.yml'] # 定义服务发现配置路径
refresh_interval: 5s # 5秒发现刷洗发现一次
- 创建服务发现配置文件
mkdir /usr/local/prome/sd_config
- 编辑prometheus监控程序的配置文件
- targets: # 直接指定动态发现下的 targets 目标主机
- 192.168.235.130:9090
labels: # 给目标主机添加标签标识
node: prome_server
- 重载服务
systemctl reload prometheus
被监控节点安装数据采集工具 node-exporter
- 解压
[root@localhost ~]# tar zxf node_exporter-0.18.1.linux-amd64.tar.gz
[root@localhost ~]# mv node_exporter-0.18.1.linux-amd64 /usr/local/
- 将服务做成系统服务管理运行
[Unit]
Description=Node_exporter server daemon
[Service]
ExecStart=/usr/local/node_exporter/node_exporter
Restart=on-failure
[Install]
WantedBy=multi-user.target
prometheus添加远程主机监控
在原来的prometheus.yml中添加任务,监控远程主机
# my global config
global:
evaluation_interval: 15s
scrape_interval: 15s
rule_files:
# - "first_rules.yml"
# - "second_rules.yml"
scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['192.168.235.130:9090']
labels:
node: prome_server
# file_sd_configs:
# - files: ['/usr/local/prome/sd_config/*.yml']
# refresh_interval: 5s
- job_name: 'node-1' # 添加主机node-1
static_configs:
- targets: ['192.168.235.128:9100']
labels:
node: node-1
- job_name: 'node-2' # 添加主机node-2
static_configs:
- targets: ['192.168.235.129:9100']
labels:
node: node-2
将node_exporter添加服务监控
node_exporter 还可以监控系统的服务状态,在启动是指定参数启用服务监控--collector.systemd --collector.systemd.unit-whitelist=服务名称
[Unit]
Description=Node_exporter server daemon
[Service]
ExecStart=/usr/local/node_exporter/node_exporter --collector.systemd --collector.systemd.unit-whitelist=(sshd|docker|nginx).service
Restart=on-failure
[Install]
WantedBy=multi-user.target
- --collector.systemd : 表示启用服务监控
- --collector.systemd.unit-whitelist=(sshd|docker|nginx).service : 表示监控多个服务
grafan中快速使用监控模板快速监控
grafana 提供了大量的监控模板,针对各种exporter和数据源制作了不同的监控模板,在grafana中导入即可直接使用
https://grafana.com/grafana/dashboards
- 通过监控模板的ID值直接导入
选择某个监控模板,找到Get this dashboard:的值,这里针对node-exporter的模板有一个比较好的模板ID:8919 ,可以快速实现主机资源的监控。
同样,容器监控也一样。找到合适的模板即可
Prometheusbu部署使用-1的更多相关文章
- [原]CentOS7.2部署node-mapnik
转载请注明表作者think8848及出处(http://think8848.cnblogs.com) node-mapnik依赖项中要求g++ >= 5, toolchain (>= GL ...
- 使用Visual Studio 2015 开发ASP.NET MVC 5 项目部署到Mono/Jexus
最新的Mono 4.4已经支持运行asp.net mvc5项目,有的同学听了这句话就兴高采烈的拿起Visual Studio 2015创建了一个mvc 5的项目,然后部署到Mono上,浏览下发现一堆错 ...
- 通过Jexus 部署 dotnetcore版本MusicStore 示例程序
ASPNET Music Store application 是一个展示最新的.NET 平台(包括.NET Core/Mono等)上使用MVC 和Entity Framework的示例程序,本文将展示 ...
- 结合Jexus + Kestrel 部署 asp.net core 生产环境
ASP.NET Core 是微软的全新的框架.这一框架的目标 ︰ 跨平台 针对云应用优化 解除 System.Web 的依赖. 获得下面三个方面的优势,你可以把它认为是一个C# 版本的NodeJS: ...
- 4.Windows Server2012 R2里面部署 MVC 的网站
网站部署之~Windows Server | 本地部署:http://www.cnblogs.com/dunitian/p/4822808.html#iis 后期会在博客首发更新:http://dnt ...
- Win10 IIS本地部署MVC网站时不能运行?
异常处理汇总-服 务 器 http://www.cnblogs.com/dunitian/p/4522983.html 部署后出现这个错误: 打开文件目录后发现是可以看见目录的,静态页面也是可以打开的 ...
- 再部署一个 instance 和 Local Network - 每天5分钟玩转 OpenStack(131)
上一节部署了 cirros-vm1 到 first_local_net,今天我们将再部署 cirros-vm2 到同一网络,并创建 second_local_net. 连接第二个 instance 到 ...
- 将 instance 部署到 OVS Local Network - 每天5分钟玩转 OpenStack(130)
上一节创建了 OVS 本地网络 first_local_net,今天我们会部署一个 instance 到该网络并分析网络结构.launch 一个 instance,选择 first_local_net ...
- 从零开始编写自己的C#框架(25)——网站部署
导航 1.关掉访问保护 2.发布网站 3.复制网站到服务器 4.添加新网站 5.设置网站访问权限 6.设置文件夹访问权限 7.控制可更新文件夹执行权限 8.设置“应用程序池”.net版本与模式 9.附 ...
随机推荐
- mysql,数据类型与表操作
一.mysql基本认知 创建用户 create host aa identified with mysql_native_password by ''; 修改用户权限 alter user root@ ...
- MXNet源码分析 | KVStore进程内通信
本文主要基于MXNet1.6.0版本进行分析. MXNet的KVStore模块下有几个比较重要的类.KVStore是一个抽象类,提供了一些通用的API,例如Init.Push和Pull等.因为KVSo ...
- Cesium 加载地形数据
1.注册Cesium Ion账号,注册地址:Sign In | Cesium ion 否则,加载数据会报错{code: "InvalidCredentials", message: ...
- demo_2_27
#define _CRT_SECURE_NO_WARNINGS 1#include <stdio.h>#include <string.h> int count_bit_one ...
- IC应届生40万白菜价!从业多年的资深专家手把手指导你如何选择offer!
这是IC男奋斗史的第1篇原创 关注公众号[IC男奋斗史],让我们一起撸起袖子加油干! 芯片行业2021年的秋招市场又是风起云涌.高手过招,继OPPO给应届生开出40万白菜价offer之后,平头哥又被爆 ...
- NSSCTF-easyupload3.0
打开环境,是一个上传的界面,点击下面的会回显出上传成功之后的路径,选择上传文件可以直接上传文件 尝试各种文件的上传(菜狗不知道怎么一下做出来,只好一个一个试),最后试出来的文件是.htaccess文件 ...
- kali linux开启ssh
虚拟机中安装好Kali linux 2.0,如何从windows中通过SecureCRT.putty或XShell等工具远程到Kali中. [GeeK]出诊过程如下: 1.首先在window10中te ...
- 解除Ubuntu禁止root远程登录
编辑SSH服务配置文件 编辑SSH服务的配置文件sshd_config,修改SSH的端口和root用户权限. 使用到的命令:(按字母 i 进入编辑模式,按ESC退出编辑模式, :wq 保存退出). r ...
- 【C#基础概念】枚举 (enum详解)
我们重点来讲解 简单枚举和标志枚举的用法和区别 继承 Object-> ValueType ->Enum Object-> ValueType ->struct 包括int f ...
- 【C#版本】微信公众号模板消息对接(一)(图文详解)
特此说明:本篇文章为个人原创文章,创作不易,未经作者本人同意.许可等条件,不得以任何形式搬运.转载.抄袭(等包括但不限于此手段)本文章,否则保留追究有关侵权人责任的权利 一.认识微信公众号模板消息 什 ...