Prometheus-监控主机基础指标配置及告警

1、监控主机指标

这是一篇介绍主机使用Prometheus监控CPU、磁盘、内存、负载等基础数据的文章,目前生产可用,使用的是node_exporter-0.18.1版本,操作系统是centos7.X版本,使用之前请修改job=”gt-dwz-node-exporter”的值对应自己在Prometheus配置的job名称。

2、Prometheus配置项

在prometheus.yml配置文件中添加如下配置:

############gt-dwz#################

– job_name: “gt-dwz-node-exporter”

static_configs:

– targets: [‘10.1.5.123:9100′,’10.1.5.124:9100′,’10.1.5.125:9100′,’10.1.5.126:9100’]

labels:

service: gt-dwz-monitor

1

2

3

4

5

6

3、PromQL判断rules文件

[root@gtcq-gt-monitor-prometheus-01 rules]# more gt-dwz-monitor.rules

groups:

– name: dwz-gt-monitor

rules:

– alert: “node-Agent告警”

expr: up{job=”gt-dwz-node-exporter”} == 0

for: 120s

labels:

severity: “重要”

team: dwz-gt-monitor

alert_type: “Agent告警”

alert_host: “{{ reReplaceAll “🙁.*)”” “””” $labels.instance }}””

annotations:

summary: “”{{ $labels.instance }} 已停止采集监控数据 30s!””

description: “”{{ $labels.instance }} job {{ $labels.job }} 暴露监控数据已停止.””

– alert: “”CPU使用率监控””

expr: ceil(100 – sum(increase(node_cpu_seconds_total{job=””gt-dwz-node-exporter””

声明:本站部分文章内容及图片转载于互联 、内容不代表本站观点,如有内容涉及侵权,请您立即联系本站处理,非常感谢!

(0)
上一篇 2022年1月3日
下一篇 2022年1月3日

相关推荐