librenms是个非常强悍的工具,对网络不清楚的可以透过这个工具,对网络环境有清晰的了解。
如何通过prometheus对librenms进行集成呢?
一、装pushgateway
1wget https://github.com/prometheus/pushgateway/releases/download/v1.2.0/pushgateway-1.2.0.linux-amd64.tar.gz
2
3把pushgateway放到/usr/local/bin
4
5cat << EOF >>/etc/systemd/system/pushgateway.service
6[Unit]
7Description=Codis Exporter
8Wants=network-online.target
9After=network-online.target
10
11[Service]
12Type=simple
13ExecStart=/usr/local/bin/pushgateway --web.listen-address=:50004
14
15[Install]
16WantedBy=multi-user.target
17EOF
18
19systemctl daemon-relaod
20systemctl enable --now pushgateway.service
二、配置librenms
1cd /opt/librenms
2vi config.php
3$config['prometheus']['enable'] = true;
4$config['prometheus']['url'] = 'http://127.0.0.1:50004';
5$config['prometheus']['job'] = 'librenms'; # Optional
三、配置prometheus
1- job_name: 'librenms'
2 scrape_interval: 300s
3 honor_labels: true
4 static_configs:
5 - targets: ['172.18.31.10:50004']
6 labels:
7 sms_to: '18618197196'
首先访问prometheus,http://172.18.31.8:9090/targets
这样弄好后,再访问 http://172.18.31.10:50004/metrics
里面的东西是十分癫狂的,从交换机端口到F5,应有尽有
东西收进prometheus后,可以通过grafana对各种指标进行画图和报警