重庆思庄Oracle、Redhat认证学习论坛

标题: prometheus如何监控LINUX主机 [打印本页]

作者: 郑全    时间: 4 天前
标题: prometheus如何监控LINUX主机
prometheus监控LINUX主机
前提:
      prometheus 主机已经安装好。


1.下载软件
wget https://github.com/prometheus/no ... .linux-amd64.tar.gz


2. 解压
tar xvf node_exporter-1.8.2.linux-amd64.tar.gz

3.重命名
mv node_exporter-1.8.2.linux-amd64 /usr/local/prometheus

4.创建自动启动服务
vim  /etc/systemd/system/node_exporter.service

[Unit]
Description=node_exporter
Documentation=https://prometheus.io/
After=network.target

[Service]
Type=simple
User=root
Group=root
ExecStart=/usr/local/prometheus/node_exporter
Restart=on-failure

[Install]
WantedBy=multi-user.target


生效
systemctl daemon-reload
systemctl status node_exporter.service
systemctl enable node_exporter.service
systemctl start node_exporter.service
systemctl status node_exporter.service

5.监控端增加目标

找到前面的prometheus.yml配置文件,添加agent节点的信息,包括主机ip和端口号。

vim /opt/prometheus/prometheus.yml

- job_name: 'host2_prometheus'
    static_configs:
    - targets: ['192.168.133.200:9100']

6.grana 检查
  如果以前加了 node_exporter ,在grana就可以看到,如果没有,应进行仪表盘的导入即可。







欢迎光临 重庆思庄Oracle、Redhat认证学习论坛 (http://bbs.cqsztech.com/) Powered by Discuz! X3.2