grafana监控linux,linux Prometheus+Grafana监控服务器性能

1、安装prometheus

安装go

[root@tiger ~]# yum -y install go

安装prometheus 服务器端

[root@tiger ~]# wget https://github.com/prometheus/prometheus/releases/download/v2.9.2/prometheus-2.9.2.linux-amd64.tar.gz

[root@tiger ~]# tar xvf prometheus-2.9.2.linux-amd64.tar.gz -C /usr/local/

[root@tiger ~]# vim /usr/local/prometheus-2.9.2.linux-amd64/prometheus.yml

在里面写清楚监控节点的信息。注意此文件是yml文件,对格式要求很严格。

主机的9090端口是必须配置的,这是prometheus自带的web界面

9100是node_exporter的默认端口

9104是mysqld_exporter默认端口,此服务器上为了测试我也装了mysql。

7ac048c13ad2616ca8532e1e947ca696.png

配置完成后,运行服务:[root@tiger ~]# cd /usr/local/prometheus-2.9.2.linux-amd64/

[root@tiger ~]# prometheus //热加载配置

prometheus启动命令添加参数 --web.enable-lifecycle

然后热重启:curl -XPOST http://localhost:9090/-/reload

nohup ./prometheus --web.enable-lifecycle &

这样更改配置文件后就不用关闭再启动prometheus了

然后ip+端口就可以访问了

192.168.3.121:9090

cb2d6cc2717e2d24f373f408a745e81b.png

在被监控的mysql机器上安装对应的exporter官网地址

6ed2a60c16799293f26644712f66a936.png

下载完成在服务器上解压

[root@localhost ~]# tar xvf mysqld_exporter-0.11.0.linux-amd64.tar.gz -C /usr/local/

[root@localhost ~]# nohup /usr/local/mysqld_exporter-0.11.0.linux-amd64/mysqld_exporter &

然后访问192.168.3.121:9090。可以看到up,此时就实现了用普罗米修斯监控系统参数。

c65119ff9952b4e1a28e6993c7bd8f6f.png

2、安装grafana

[root@tiger ~]# wget https://dl.grafana.com/oss/release/grafana-5.4.0-1.x86_64.rpm

[root@tiger ~]# yum localinstall grafana-5.4.0-1.x86_64.rpm -y

[root@tiger ~]# systemctl start grafana-server

访问192.168.3.121:3000,默认账户密码 admin/admin

4dc721066d2c7ffd10e86eb82752aaee.png

85f3712d67a334d609bf3dd8e4e6ff07.png

7a55f30edaeac878d0f23dc7bed16912.png

ddbdcfd5b522457b04451fbcb1d0b3e0.png

c2a50a639b6a9375982597ed4689ced2.png

8a5ec628677cada47313cb65b7ee9af5.png

f70c9870f0c04413bb1703becd4a0d6a.png

回到刚开始的界面,导入下载好的文件包

7e20aae30b8c6268964618a2e6628d41.png

8cfc95e9d0146c67d7ea3a801e451643.png

6eb73218787bac6ebb93c77b9ef5f887.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值