監控服務器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服務