背景
监控服务器状态是运维必不可少的一部分,这里给大家介绍的是一种监控系统grafana,grafana仅仅只是提供界面显示, 所以他需要从influxdb或prometheus中获取数据, 而influxdb或prometheus中的数据又需要从其他地方收集过来, 常用的收集工具是collectd和telegraf, 其中collectd这里不做介绍, 有些数据不是太适合, 而 influxdb 自身集成 telegraf插件, 不需要进行专门的配置
流程
collectd/telegraf或prometheus插件(收集数据) ——-> influxdb/prometheus(保存数据) ——-> grafana(显示数据)
下载node_exporter插件
1 | wget https://github.com/prometheus/node_exporter/releases/download/v0.18.1/node_exporter-0.18.1.linux-arm64.tar.gz |
解压
1 | tar xf node_exporter-*.tar.gz |
在对应机器上启动node_exporter
1 | setsid ./node_exporter |
查看node_exporter是否开启
1 | netstat -lntp |
修改prometheus配置文件
1 | - job_name: 'node_exporter' |
重启prometheus
1 | nohup ./prometheus --config.file=./prometheus.yml & |
grafana配置
配置prometheus数据源
添加prometheus插件,然后配置