默认已安装Prometheus服务
Prometheus服务地址:192.168.0.254:9090
交换机ip地址:192.168.0.67
一、准备
1.1 下载相应交换机厂家提供的交换机mib文件
如我的交换机是华为S5700交换机,我需要到华为官网上找到S5700型号的mib文件并下载。
1.2 环境安装
由于Prometheus使用go语言开发的,所以自己编译生成snmp_exporter的配置文件需要go环境。
yum install go -y
安装依赖模块
yum install -y epel-release
yum install git -y
yum group install -y "Development Tools"
yum install -y wget net-snmp net-snmp-utils net-snmp-libs net-snmp-devel golang p7zip*
二、配置snmp_exporter
2.1 测试SNMP
(pubilc0001是团体名,.1表示查看所有信息)
snmpwalk -v 2c -c public0001 192.168.0.67 .1
2.2 git snmp_exporter
cd /
git clone https://github.com/prometheus/snmp_exporter.git
2.3 go国内代理
export GO111MODULE=on
export GOPROXY=https://goproxy.cn,direct