SNMP exec and extend

# cat /etc/snmp/snmpd.conf
rocommunity  public
exec .1.3.6.1.4.1.2021.51 ps /bin/ps
exec .1.3.6.1.4.1.2021.50 shelltest /bin/sh /tmp/shtest
exec .1.3.6.1.4.1.2021.52 echotest /bin/echo hello world
exec echotest11 /bin/echo hello world
extend .1.3.6.1.4.1.2021.56 shelltest1 /bin/sh /tmp/test

# snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.8
UCD-SNMP-MIB::extIndex.1 = INTEGER: 1
UCD-SNMP-MIB::extNames.1 = STRING: echotest11
UCD-SNMP-MIB::extCommand.1 = STRING: /bin/echo hello world
UCD-SNMP-MIB::extResult.1 = INTEGER: 0
UCD-SNMP-MIB::extOutput.1 = STRING: hello world
UCD-SNMP-MIB::extErrFix.1 = INTEGER: 0
UCD-SNMP-MIB::extErrFixCmd.1 = STRING: 


# snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.52
UCD-SNMP-MIB::ucdavis.52.1.1 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.52.2.1 = STRING: "echotest"
UCD-SNMP-MIB::ucdavis.52.3.1 = STRING: "/bin/echo hello world"
UCD-SNMP-MIB::ucdavis.52.100.1 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.52.101.1 = STRING: "hello world"
UCD-SNMP-MIB::ucdavis.52.102.1 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.52.103.1 = ""


# snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.50
UCD-SNMP-MIB::ucdavis.50.1.1 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.50.2.1 = STRING: "shelltest"
UCD-SNMP-MIB::ucdavis.50.3.1 = STRING: "/bin/sh /tmp/shtest"
UCD-SNMP-MIB::ucdavis.50.100.1 = INTEGER: 127
UCD-SNMP-MIB::ucdavis.50.101.1 = STRING: "/bin/sh: /tmp/shtest: No such file or directory"
UCD-SNMP-MIB::ucdavis.50.102.1 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.50.103.1 = ""
[root@vsp-devel ~]# snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.50
UCD-SNMP-MIB::ucdavis.50.1.1 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.50.2.1 = STRING: "shelltest"
UCD-SNMP-MIB::ucdavis.50.3.1 = STRING: "/bin/sh /tmp/shtest"
UCD-SNMP-MIB::ucdavis.50.100.1 = INTEGER: 127
UCD-SNMP-MIB::ucdavis.50.101.1 = STRING: "/bin/sh: /tmp/shtest: No such file or directory"
UCD-SNMP-MIB::ucdavis.50.102.1 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.50.103.1 = ""

# snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.51
UCD-SNMP-MIB::ucdavis.51.1.1 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.51.2.1 = STRING: "ps"
UCD-SNMP-MIB::ucdavis.51.3.1 = STRING: "/bin/ps"
UCD-SNMP-MIB::ucdavis.51.100.1 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.51.101.1 = STRING: "  PID TTY          TIME CMD"
UCD-SNMP-MIB::ucdavis.51.101.2 = STRING: "    1 ?        00:00:01 init"
UCD-SNMP-MIB::ucdavis.51.101.3 = STRING: "    2 ?        00:00:00 migration/0"
UCD-SNMP-MIB::ucdavis.51.101.4 = STRING: "    3 ?        00:00:00 ksoftirqd/0"
UCD-SNMP-MIB::ucdavis.51.101.5 = STRING: "    4 ?        00:00:00 watchdog/0"
UCD-SNMP-MIB::ucdavis.51.101.6 = STRING: "    5 ?        00:00:00 migration/1"
UCD-SNMP-MIB::ucdavis.51.101.7 = STRING: "    6 ?        00:02:33 ksoftirqd/1"
UCD-SNMP-MIB::ucdavis.51.101.8 = STRING: "    7 ?        00:00:00 watchdog/1"
UCD-SNMP-MIB::ucdavis.51.101.9 = STRING: "    8 ?        00:00:00 events/0"
UCD-SNMP-MIB::ucdavis.51.101.10 = STRING: "    9 ?        00:00:00 events/1"
UCD-SNMP-MIB::ucdavis.51.101.11 = STRING: "   10 ?        00:00:00 khelper"
UCD-SNMP-MIB::ucdavis.51.101.12 = STRING: "   11 ?        00:00:00 kthread"
UCD-SNMP-MIB::ucdavis.51.101.13 = STRING: "   15 ?        00:00:04 kblockd/0"
UCD-SNMP-MIB::ucdavis.51.101.14 = STRING: "   16 ?        00:00:00 kblockd/1"
UCD-SNMP-MIB::ucdavis.51.101.15 = STRING: "   17 ?        00:00:00 kacpid"
UCD-SNMP-MIB::ucdavis.51.101.16 = STRING: "  131 ?        00:00:00 cqueue/0"
UCD-SNMP-MIB::ucdavis.51.101.17 = STRING: "  132 ?        00:00:00 cqueue/1"
UCD-SNMP-MIB::ucdavis.51.101.18 = STRING: "  135 ?        00:00:00 khubd"
UCD-SNMP-MIB::ucdavis.51.101.19 = STRING: "  137 ?        00:00:00 kseriod"
UCD-SNMP-MIB::ucdavis.51.101.20 = STRING: "  205 ?        00:00:00 khungtaskd"
UCD-SNMP-MIB::ucdavis.51.101.21 = STRING: "  208 ?        00:00:07 kswapd0"
UCD-SNMP-MIB::ucdavis.51.101.22 = STRING: "  209 ?        00:00:00 aio/0"
UCD-SNMP-MIB::ucdavis.51.101.23 = STRING: "  210 ?        00:00:00 aio/1"
UCD-SNMP-MIB::ucdavis.51.101.24 = STRING: "  370 ?        00:00:00 kpsmoused"
UCD-SNMP-MIB::ucdavis.51.101.25 = STRING: "  402 ?        00:00:00 scsi_eh_0"
UCD-SNMP-MIB::ucdavis.51.101.26 = STRING: "  403 ?        00:01:17 usb-storage"
UCD-SNMP-MIB::ucdavis.51.101.27 = STRING: "  408 ?        00:00:00 ata/0"
UCD-SNMP-MIB::ucdavis.51.101.28 = STRING: "  409 ?        00:00:00 ata/1"
UCD-SNMP-MIB::ucdavis.51.101.29 = STRING: "  410 ?        00:00:00 ata_aux"
UCD-SNMP-MIB::ucdavis.51.101.30 = STRING: "  417 ?        00:00:00 kstriped"
UCD-SNMP-MIB::ucdavis.51.101.31 = STRING: "  430 ?        00:00:00 ksnapd"
UCD-SNMP-MIB::ucdavis.51.101.32 = STRING: "  447 ? "
UCD-SNMP-MIB::ucdavis.51.102.1 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.51.103.1 = ""

No comments: