内容目录
生成器配置文件编写
生成器配置文件放在 hh3cdot1qVlanStatisticInTotalBytes
目录
命名为 generator_h3c_vlan.yml
auths:
h3c_vlanauth: # 认证模块名称
version: 2 # snmp v2c版本
community: xxx # snmp 团体名
modules:
h3c_vlaninterface:
walk:
# 表量,索引为vlanid
- 1.3.6.1.4.1.25506.8.35.2.1.1.1.23 # 入方向流量的字节总数
- 1.3.6.1.4.1.25506.8.35.2.1.1.1.27 # 出方向流量的字节总数
lookups:
- source_indexes: [hh3cdot1qVlanIndex]
lookup: hh3cdot1qVlanName
overrides:
hh3cdot1qVlanName:
ignore: true
filters:
dynamic:
- oid: 1.3.6.1.4.1.25506.8.35.2.1.1.1.20 # vlan流量统计开关
targets:
- 1.3.6.1.4.1.25506.8.35.2.1.1.1.23
- 1.3.6.1.4.1.25506.8.35.2.1.1.1.27
# 只获取流量统计开头打开的vlan流量
values: ["1"]
生成采集配置文件
# 进入生成器文件目录
cd /root/snmp_exporter/generator/
# 执行命令采集配置,执行该命令后会最终生成采集配置文件`snmp_h3c_vlan.yml,该文件保存到-o参数指定的目录中
./generator --no-fail-on-parse-errors generate -m h3c/mibs/switch/ -g h3c/switch/generator_h3c_vlan.yml -o h3c/switch/snmp_h3c_vlan.yml
# 复制采集配置文件到snmp_exporter读取配置文件的目录中
cp /root/snmp_exporter/generator/h3c/switch/snmp_h3c_vlan.yml /etc/snmp_exporter/
# 重启snmp_exporter以及查看状态
systemctl restart snmp_exporter.service
systemctl status snmp_exporter.service
华三交换机配置
vlan 1107
description xxx
statistics enable
dis vlan 1107 statistics
Total:
Direction Total packets Total bytes
Rate (pps) Rate (bps)
Inbound 478707069 247478097469
6126 2914557
Outbound 488123794 447273154338
3218 1087766
grafana效果
- 指标:
irate(hh3cdot1qVlanStatisticOutTotalBytes[5m])*8
,irate(hh3cdot1qVlanStatisticInTotalBytes[5m])*8
留言