部署服务器监测工具

1、node_exporterprometheus、grafana的关系

node_exporter(在操作系统层,负责收集cpu、网络等所有信息)-》prometheus(主动拉取node_exporter)-》grafana(展示数据)

如果在线安装下载很慢甚至下载不了的话,建议现在本地使用迅雷下载后上传服务器直接解压安装。

2、配置node_exporter

1)下载node_exporter

网址:Releases · prometheus/node_exporter · GitHub

[root@xxxx ~]# wget -c https://github.com/prometheus/node_exporter/releases/download/v1.5.0/node_exporter-1.5.0.linux-amd64.tar.gz

2)解压

[root@xxxx packages]# tar -zxvf node_exporter-1.5.0.linux-amd64.tar.gz

3)启动

[root@pxxxx ~]# cd node_exporter-1.5.0.linux-amd64/

[root@xxxx ~]#./node_exporter &

4)开启9100端口(不修改任何配置文件的情况下服务启动默认开启9100端口)

[root@performance ~]# netstat -naop|grep 9100

3、安装prometheus

1)下载

网址:https://prometheus.io/download/

[root@xxxx ~]# wget -c https://github.com/prometheus/prometheus/releases/download/v2.42.0/prometheus-2.42.0.linux-amd64.tar.gz

2)解压

[root@xxxx packages]# tar -zxvf prometheus-2.42.0.linux-amd64.tar.gz

3)配置如果要监控多个端口就配置多个job

[root@xxxx ~]# cd prometheus-2.42.0.linux-amd64

[root@xxxx ~]# vi prometheus.yml

# 在prometheus.yml文件中加入如下配置:

  - job_name: '自己命名'

    static_configs:

- targets: ['你的ip:9100']

4)启动prometheus:

[root@performance ~]#./prometheus --config.file=prometheus.yml &

5)启动9090端口

[root@performance ~]# netstat -naop|grep 9090

4、安装grafana(可视化工具配合prometheus用于数据展示

1) 下载

[root@performance6 packages]#wget https://dl.grafana.com/oss/release/grafana-9.3.6-1.x86_64.rpm

[root@performance ~]# yum install grafana-9.3.6-1.x86_64.rpm

2) 配置开机启动:

/sbin/chkconfig –add grafana-server

3) 重载所有修改过的配置文件:

[root@performance ~]# systemctl daemon-reload

4) 启动grafana-serve:

[root@performance ~]# systemctl start grafana-server.service

5) 查看状态:

[root@performance ~]# systemctl status grafana-server.service

6) 设置开机启动:

[root@performance ~]# Systemctl enable grafana-server.service

9) 登录grafana:

http://ip:3000/

username: admin

password: admin

10) 配置一个数据源:

 

11)导入dashboard:

官网中查询模板ID:Dashboards | Grafana Labs

使用下载量最多的

ID:11074/8919/1860

 点import ---> 1860,点load- ---> 数据源一定要选你刚才创建的数据源(prometheus),然后点import

扩展:

grafana上展示多台服务器数据

在多台服务器上都安装node_exporter,后再prometheus上配置。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值