2009年9月14日 星期一

Find out snmp OID for Nagios check_snmp plugins

Finally, I found a way to get snmp info from a host
  1. Run snmpwalk to view OID name
    Code:
    snmpwalk -v 1 -c public 192.168.56.1
    Note that public is the community string and 1 is the SNMP version
  2. Pick one, ie: SNMPv2-MIB::sysContact.0 (sysadmin mail address)
  3. Use snmptranslate to get OID number
    Code:
    snmptranslate -On SNMPv2-MIB::sysContact.0
  4. Check the OID number with check_snmp manually
    Code:
    ./check_snmp -H 192.168.56.1 -C public -o .1.3.6.1.2.1.1.4.0
  5. Take note of check_snmp options and arguments, then define/edit a command
    Code:
    define command{<br />        command_name    check_snmp<br />        command_line    $USER1$/check_snmp -H $HOSTADDRESS$ -C public -o $ARG1$<br />        }
    Note that $HOSTADDRESS$ is a macro so no need to fill that out since it will refer to current host config
  6. Define a service for that
    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 />        }
    Since 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.




reference: http://www.linuxquestions.org/questions/linux-networking-3/using-nagios-checksnmp-plugin-to-get-snmp-info-from-computer-751057/

沒有留言:

張貼留言