https://sourceforge.net/projects/net-snmp/files/
下载的版本tar zxvf net-snmp-5.8.1.pre1.tar.gz
[root@iz2ze9n3z2fl9zj9hrv58vz soft]# tar zxvf net-snmp-5.8.1.pre1.tar.gz
./configure --prefix=/usr/local/net-snmp --with-mib-modules=ucd-snmp/diskio
遇到要选择的一路回车
make && make install
snmp命令行测试汇总20190928
snmpwalk -v 2c -c public localhost 1.3.6.1.2.1.4.20
IP-MIB::ipAdEntAddr.127.0.0.1 = IpAddress: 127.0.0.1
IP-MIB::ipAdEntAddr.172.17.121.16 = IpAddress: 172.17.121.16
IP-MIB::ipAdEntIfIndex.127.0.0.1 = INTEGER: 1
IP-MIB::ipAdEntIfIndex.172.17.121.16 = INTEGER: 2
IP-MIB::ipAdEntNetMask.127.0.0.1 = IpAddress: 255.0.0.0
IP-MIB::ipAdEntNetMask.172.17.121.16 = IpAddress: 255.255.240.0
IP-MIB::ipAdEntBcastAddr.127.0.0.1 = INTEGER: 0
IP-MIB::ipAdEntBcastAddr.172.17.121.16 = INTEGER: 1
备注:snmpwalk -v 2c -c public 127.0.0.1 1.3.6.1.2.1.4.20
用localhost 和 127.0.0.1 没区别
命令解释:
-v 1|2c|3 指定SNMP协议版本
-c COMMUNITY 指定共同体字符串
localhost 被管理设备IP
1.3.6.1.2.1.4.20 机器Ip信息的OID
OID大全 https://blog.csdn.net/a9254778/article/details/51200502
snmpwalk -v 2c -c public localhost .1.3.6.1.2.1.25.2.3.1.2
snmpwalk -v2c -c public localhost .1.3.6.1.2.1.25.2.3
snmpwalk -v 2c -c public localhost UCD | more
返回数据类似如下表示支持磁盘监控
UCD-DISKIO-MIB::diskIOIndex.1 = INTEGER: 1
UCD-DISKIO-MIB::diskIOIndex.2 = INTEGER: 2
UCD-DISKIO-MIB::diskIOIndex.3 = INTEGER: 3
snmpwalk -v 2c -c public 127.0.0.1 .1.3.6.1.4.1.2021.58