Skip to content

Latest commit

 

History

History
38 lines (26 loc) · 1.47 KB

File metadata and controls

38 lines (26 loc) · 1.47 KB

#《55_基于Prometheus实现系统的指标监控以及告警》

具体部署不用演示了,因为比较简单,给一下步骤就行

上prometheus官网下载

#prometheus-2.4.0.linux-amd64.tar.gz

tar -zxvf prometheus-2.4.0.linux-amd64.tar.gz -C /data
cd /data
chown -R root:root prometheus-2.4.0.linux-amd64
ln -sv prometheus-2.4.0.linux-amd64 prometheus

cd /data/prometheus
./prometheus

直接访问本机的9090端口号,就能看到prometheus的web ui

接着就是对要监控的机器去部署node exporter,是基于go语言写的,可以拿到cpu、内存、磁盘空间、磁盘io、网络带宽、系统负载、主板温度等一系列的机器资源监控指标,这个是最基本要做的监控

https://prometheus.io/download/里面找到node exporter的下载地址,下载一个最新的版本,接着进行解压缩,直接./node_exporter运行起来,就O了,默认的监听端口是9100,然后再把这个node exporter跟prometheus集成起来

编辑prometheus的配置文件,有一个prometheus.yml,里面需要加入job去跟node_exporter进行集成

scrape_configs:
-	job_name: ‘prometheus’
     static_configs:
     -targets: [‘192.168.xx.xx:9090’]
-  job_name: ‘xx_node_exporter’
   static_configs:
   -targets: [‘192.168.xx.xx:9100’]

重启prometheus server就可以了,直接进入web ui就可以在targets里找到你要监控的机器,然后里面各项资源监控报表都可以看到了