bash自定义逻辑获取数据
#!/bin/bash
inventory() {
cat /etc/inventory.conf|awk -F\= '{print $2}'
}
$1
编辑snmpd.conf配置文件添加行
extend test /etc/snmp/snmpd.sh inventory
重启snmpd
systemctl restart snmpd
测试OID
snmpget -v 2c -c ****** 10.210.131.102 'NET-SNMP-EXTEND-MIB::nsExtendOutLine."test".1'`
获取真实OID
snmptranslate -On 'NET-SNMP-EXTEND-MIB::nsExtendOutLine."test".1'