node_exporter + grafana
监控服务器CPU、内存、磁盘、I/O等信息,首先需要安装node_exporter。node_exporter的作用是用于机器系统数据收集。
下载安装:
tar -zxvf node_exporter-0.16.0.linux-amd64.tar.gz
创建Systemd服务
cat > /etc/systemd/system/node_exporter.service << EOF
[Unit]
Description=node_exporter
Documentation=https://prometheus.io/
After=network.target
[Service]
Type=simple
User=prometheus
ExecStart=/usr/local/node_exporter/node_exporter
Restart=on-failure
[Install]
WantedBy=multi-user.target
EOF
启动
systemctl start node_exporter
Node Exporter默认的抓取地址为http://IP:9100/metrics
配置prometheus
vim /usr/local/prometheus/prometheus.yml
- job_name: 'linux' //都需要自己添加
static_configs:
- targets: ['localhost:9100']
labels:
instance: node1
Grafana:
https://grafana.com/dashboards 页面搜索node exporter 根据id导入模板 id 为8919
报错:
Panel plugin with id grafana-piechart-panel could not be found
###安装grafana插件需联网安装
[root@zabbix grafana]# grafana-cli plugins list-remote #查询可用的插件
1、在线安装
[root@zabbix grafana]# grafana-cli plugins install percona-percona-app
✔ Installed percona-percona-app successfully
[root@zabbix grafana]# grafana-cli plugins install grafana-piechart-panel
✔ Installed grafana-piechart-panel successfully
需要重启
[root@zabbix grafana]# systemctl restart grafana-server
2、离线安装组件
模块添加,只需要将模块文件放在/var/lib/grafana/plugins(在配置文件grafana.ini:;plugins = /var/lib/grafana/plugins)
[root@zabbix plugins]# ls
alexanderzobnin-grafana-zabbix-a8b2e3c grafana-piechart-panel
[root@zabbix plugins]# pwd
/var/lib/grafana/plugins
重启grafana服务