Finally, I found a way to get snmp info from a host
- Run snmpwalk to view OID nameNote that public is the community string and 1 is the SNMP versionCode:
snmpwalk -v 1 -c public 192.168.56.1
- Pick one, ie: SNMPv2-MIB::sysContact.0 (sysadmin mail address)
- Use snmptranslate to get OID numberCode:
snmptranslate -On SNMPv2-MIB::sysContact.0
- Check the OID number with check_snmp manuallyCode:
./check_snmp -H 192.168.56.1 -C public -o .1.3.6.1.2.1.1.4.0
- Take note of check_snmp options and arguments, then define/edit a commandNote that $HOSTADDRESS$ is a macro so no need to fill that out since it will refer to current host configCode:
define command{<br /> command_name check_snmp<br /> command_line $USER1$/check_snmp -H $HOSTADDRESS$ -C public -o $ARG1$<br /> } - Define a service for thatSince the first and second argument already filled out in command definition, we just need to add the last argument which is the OID number with exclamation mark (!) before it. Of course, other-service template is already defined.Code:
define service{<br /> use other-service<br /> host_name laptop<br /> service_description Admin email<br /> check_command check_snmp!.1.3.6.1.2.1.1.4.0<br /> }
reference: http://www.linuxquestions.org/questions/linux-networking-3/using-nagios-checksnmp-plugin-to-get-snmp-info-from-computer-751057/
沒有留言:
張貼留言