prometheus + grafana监控部署

最近发现了一个神器:prometheus普米修斯监控。之前写过一篇 宝塔面板搭建Zabbix

Prometheus是什么

Prometheus(普罗米修斯)是一个很酷的开源监控系统。它支持多维度的指标数据模型,服务端通过HTTP协议定时拉取数据后,通过灵活的查询语言,实现监控的目的。

客户端记录相关指标数据,对外提供查询接口。Prometheus服务端通过服务器发现机制找到客户端,并定时抓取存储为时间序列数据。最后通过Grafana等图表工具集成展示。

prometheus + grafana监控部署

开始安装 prometheus

1 下载

https://prometheus.io/download/

 

2 解压安装

tar xf prometheus-linux-amd64.tar.gz
mv prometheus-.linux-amd64 /usr/local/prometheus
cd /usr/local/prometheus
./prometheus --version

 

3 启动使用这个命令,后面就可以直接使用热重启;

./prometheus --config.file=prometheus.yml --web.enable-lifecycle

然后我们在要监控的机器上安装agent,这次我们下载node_exporter

解压使用命令即可启用:nohup ./node_exporter

 

编辑prometheus.yml;

主要注意格式是分大小写,而且是缩进;

服务端监听 9090端口  prometheus web页面 http://ServerIP:9090

客户端监听 9100端口;

编辑保存好,使用热启动命令:curl -X POST http://localhost:9090/-/reload

 

安装grafana;

wget https://dl.grafana.com/oss/release/grafana-6.5.1-1.x86_64.rpm
yum localinstall grafana-6.5.1-1.x86_64.rpm
systemctl start grafana-server
systemctl enable grafana-server
grafana-server -v
grafana-server 监听端口为 3000

ip+3000即可访问grafana 网页,默认账号密码是admin

 

登陆后添加数据源选择 Prometheus

prometheus + grafana监控部署

 

正文完
 
评论(没有评论)