监控网络设备(11169,1124,11368)
https://github.com/dkruyt/OceanStor_Grafana
https://github.com/prometheus/snmp_exporter/releases/download/v0.18.0/snmp_exporter-0.18.0.linux-amd64.tar.gz
# 按照上面网址下载
# 解压
cd /opt
tar xf snmp_exporter-0.18.0.linux-amd64.tar.gz
# 配置文件编写
cat /etc/systemd/system/snmp-export.service
[Unit]
Description=Prometheus Node
After=network.target prometheus.service
[Service]
Type=simple
ExecStart=/opt/snmp_exporter-0.18.0.linux-amd64/snmp_exporter --web.listen-address=0.0.0.0:9116 --config.file=/opt/snmp_exporter-0.18.0.linux-amd64/snmp.yml
[Install]
WantedBy=multi-user.target
# 启动服务
systemctl start snmp-export.service
systemctl enable snmp-export.service
# promethes 配置
scrape_configs:
- job_name: 'snmp'
static_configs:
- targets:
- x.x.x.x # SNMP device.
- switch.local # SNMP device.
metrics_path: /snmp
params:
module: [if_mib]
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: x.x.x.x:9116 # The SNMP exporter's real hostname:port.
https://www.itq168.com/article/700
https://raw.githubusercontent.com/zhijiansd/gityun/master/snmp_exporter/snmp.yaml
yum install gcc make net-snmp net-snmp-utils net-snmp-libs net-snmp-devel测试能否获取交换机snmp信息:
snmpwalk -v 2c -c Tbkswitch x.x.x.x.1