待手绾青丝

待手绾青丝

待手绾青丝

庭中三千梨花树,再无一朵入我心。 心中只你一朵,似在心中,不在心中,可望可念可想不可及。

109 文章数
2 评论数
来首音乐
光阴似箭
今日已经过去小时
这周已经过去
本月已经过去
今年已经过去个月

第三篇_prometheus监控远程linux主机

2021-04-22 / 0 评论 / 869 阅读 / 0 点赞

一、prometheus基础使用

1、访问

http://192.168.15.120:9090/

2、查看监控的主机

默认只监控了本机一台,点Status -->Targets -->可以看到只监控了本机。

3、查看监控数据

通过http://服务器IP:9090/metrics可以查看到监控的数据,在web主界面可以通过关键字查询监控项

查看数据

查看图形

监控远程linux主机

一、被监控点部署node_exporter

1、下载

[root@web02 /opt]# wget https://github.com/prometheus/node_exporter/releases/download/v1.1.1/node_exporter-1.1.1.linux-amd64.tar.gz

2、解压

[root@web02 /opt]# mkdir /prometheus_node/
[root@web02 /opt]# tar xf node_exporter-1.1.1.linux-amd64.tar.gz -C /prometheus_node/
[root@web02 /prometheus_node]# mv node_exporter-1.1.1.linux-amd64/* ./

3、加入systemd管理

[root@web02 /prometheus_node]# vim /usr/lib/systemd/system/node_exporter.service

[Unit]
Description=prometheus server daemon

[Service]
ExecStart=/prometheus_node/node_exporter
Restart=on-failure

[Install]
WantedBy=multi-user.target

# 重载
systemctl daemon-reload

4、启动且加入开机自启

[root@web02 ~]# systemctl enable node_exporter.service --now

5、检查

[root@web02 ~]# netstat -lntup|grep 9100
tcp6       0      0 :::9100                 :::*                    LISTEN      3224/node_exporter  
[root@web02 ~]# curl 127.0.0.1:9100/metrics
...
好多监控数据啊
...

二、配置prometheus连接node

1、修改配置文件

[root@promethus /prometheus]# vim prometheus.yml 
...
  - job_name: 'node-web'
    static_configs:
    - targets: ['192.168.15.8:9100']

2、重启服务

[root@promethus /prometheus]# systemctl restart prometheus.service

3、检查

三、获取远程linux监控指标

http://IP:9100/metrics
文章不错,扫码支持一下吧~
上一篇 下一篇
评论
最新回复
文章目录
每日一句