在被监控端上的操作:
1.在被监控机器上root目录下建立文件 test.sh
chmod 777 test.sh
cat test
#!/bin/bash
echo $RANDOM
2.在snmpd.conf里添加如下内容
extend .1.3.6.1.4.1.2021.2 test /root/test.sh
server端上操作
1.取oid
[root@bogon]# snmpwalk -c public -v2c 172.16.21.154 .1.3.6.1.4.1.2021.2
UCD-SNMP-MIB::ucdavis.1.1.0 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.1.2.1.2.4.116.101.115.116 = STRING: "/root/test.sh"
UCD-SNMP-MIB::ucdavis.1.2.1.3.4.116.101.115.116 = ""
UCD-SNMP-MIB::ucdavis.1.2.1.4.4.116.101.115.116 = ""
UCD-SNMP-MIB::ucdavis.1.2.1.5.4.116.101.115.116 = INTEGER: 5
UCD-SNMP-MIB::ucdavis.1.2.1.6.4.116.101.115.116 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.1.2.1.7.4.116.101.115.116 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.1.2.1.20.4.116.101.115.116 = INTEGER: 4
UCD-SNMP-MIB::ucdavis.1.2.1.21.4.116.101.115.116 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.1.3.1.1.4.116.101.115.116 = STRING: "13135"
UCD-SNMP-MIB::ucdavis.1.3.1.2.4.116.101.115.116 = STRING: "13135"
UCD-SNMP-MIB::ucdavis.1.3.1.3.4.116.101.115.116 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.1.3.1.4.4.116.101.115.116 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.1.4.1.2.4.116.101.115.116.1 = STRING: "13135"
[root@bogon ]# snmpwalk -c public -v2c 172.16.21.154.1.3.6.1.4.1.2021.1.4.1.2.4.116.101.115.116.1
UCD-SNMP-MIB::ucdavis.1.4.1.2.4.116.101.115.116.1 = STRING: "13446"
最终为取得oid为
.1.3.6.1.4.1.2021.2.4.1.2.4.116.101.115.116.1
2.在server端添加被监控主机的步骤
console————〉devices—————〉add
添加数据模版
create之后在oid里面填入上面获取的oid
添加数据源:
添加图像模版
添加图像管理
添加图像管理树