上篇中介绍了Prometheus, Grafana,并实现了实时监控Windows,回顾:Prometheus + Grafana 实时监控Windows
本篇来介绍一下Linux。
node exporter安装配置
下载 node exporter
1
wget https://github.com/prometheus/node_exporter/releases/download/v0.18.1/node_exporter-0.18.1.linux-amd64.tar.gz
解压
1
tar -zxvf node_exporter-0.18.1.linux-amd64.tar.gz
添加系统服务 (vi /usr/lib/systemd/system/node_exporter.service)
1
2
3
4
5
6
7
8
9[Unit]
Description=https://prometheus.io
[Service]
Restart=on-failure
ExecStart=/opt/node_exporter-0.18.1.linux-amd64/node_exporter
[Install]
WantedBy=multi-user.target启动服务
1
2systemctl start node_exporter
systemctl status node_exporter验证
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16[root@izheyi node_exporter-0.18.1.linux-amd64]# curl http://localhost:9100/metrics
# HELP go_gc_duration_seconds A summary of the GC invocation durations.
# TYPE go_gc_duration_seconds summary
go_gc_duration_seconds{quantile="0"} 0
go_gc_duration_seconds{quantile="0.25"} 0
go_gc_duration_seconds{quantile="0.5"} 0
go_gc_duration_seconds{quantile="0.75"} 0
go_gc_duration_seconds{quantile="1"} 0
go_gc_duration_seconds_sum 0
go_gc_duration_seconds_count 0
# HELP go_goroutines Number of goroutines that currently exist.
# TYPE go_goroutines gauge
go_goroutines 6
# HELP go_info Information about the Go environment.
# TYPE go_info gauge
go_info{version="go1.12.5"} 1
Prometheus配置
添加prometheus相关配置, prometheus.yml
1
2
3- job_name: 'linux'
static_configs:
- targets: ['192.168.174.128:9100']重启prometheus
验证
Grafana配置
配置Prometheus数据源
搭建Prometheus仪表盘
Import Dashboard: 8919验证