监控平台prometheus+grafana+snmp_explorer+blackbox_exporter+alertmanager

一、背景介绍

公司需要监控交换机和IP设备,能够放在展示屏幕,及时发出告警信息。网上有很多监控软件,prometheus系列已经能够满足我们需求。prometheus功能强大,本次只用到一部功能。咱们先把基本的部署安装好,后续各种参数,还需要继续去研究。唯一不好的是,需要配置很多命令,对初学者和非技术人员,存在一定门槛,但这也形成比较高的自由度。

二、部署环境

服务器:

12核32G

操作系统

CentOS Linux release 7.6

注意点

建议部署前,关闭系统防火墙,后期调试完毕,再添加放行端口。

三、结构图

Grafana作为展示界面,Prometheus作为核心,调用snmp_explorter和blackbox_explorter监控模块,使用Alertmanager作为报警模块,形成一个完整的结构。
image

四、部署步骤

1、prometheus

下载安装包
wget https://github.com/prometheus/prometheus/releases/download/v2.37.0/prometheus-2.37.0.linux-amd64.tar.gz
解压安装文件
tar -xf prometheus-2.37.0.linux-amd64.tar.gz
新建用户组
groupadd -r prometheus
新建用户加入组
useradd -r -g prometheus -d / -s /sbin/nologin -c "prometheus user" prometheus
创建目录
mkdir /etc/prometheus
mkdir /home/prometheus
迁移文件夹
cp prometheus-2.37.0.linux-amd64/prometheus /usr/local/bin/
迁移配置文件夹
cp prometheus-2.37.0.linux-amd64/prometheus.yml /etc/prometheus/
赋予权限
chown -R prometheus:prometheus /etc/prometheus
chown -R prometheus:prometheus /home/prometheus/
创建启动脚本
vi /usr/lib/systemd/system/prometheus.service

点击查看代码
[Unit]
Description=prometheus
After=network.target
[Service]
Type=simple
User=prometheus
ExecStart=/usr/local/bin/prometheus \
--config.file=/etc/prometheus/prometheus.yml \
--storage.tsdb.path=/home/prometheus \
--storage.tsdb.retention=15d \
--web.read-timeout=5m \
--web.max-connections=10 \
--query.max-concurrency=20 \
--query.timeout=2m \
--web.enable-lifecycle
Restart=on-failure
[Install]
WantedBy=multi-user.target

调试命令
systemctl enable prometheus
systemctl start prometheus
systemctl restart prometheus
systemctl status prometheus
检查服务是否启动
netstat -anlptu|grep :9090

点击查看代码
tcp6       0      0 ::1:49954               ::1:9090                ESTABLISHED 16429/prometheus

验证
打开设备ip端口
http://192.168.0.212:9090

2、grafana

Grafana作为展示平台
下载安装
wget https://dl.grafana.com/enterprise/release/grafana-enterprise-9.0.6-1.x86_64.rpm
sudo yum install grafana-enterprise-9.0.6-1

  • 0
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值