simple chech using snmp
Tom Brown
tom at ng23.net
Mon Oct 2 20:37:32 CEST 2006
Thomas Sluyter wrote:
> Right then... Clean slate for this e-mail...
>
> I've set up my snmpd.conf to include the following.
>
> exec .1.3.6.1.4.1.6886.4.1.4 check_d_root /usr/local/nagios/libexec/
> check_disk -w 15 -c 5 -p /
>
> SNMPWalking through that gives me:
>
> $ snmpwalk -v 2c -c management localhost .1.3.6.1.4.1.6886
> SNMPv2-SMI::enterprises.6886.4.1.4.1.1 = INTEGER: 1
> SNMPv2-SMI::enterprises.6886.4.1.4.2.1 = STRING: "check_d_root"
> SNMPv2-SMI::enterprises.6886.4.1.4.3.1 = STRING: "/usr/local/nagios/
> libexec/check_disk -w 15 -c 5 -p /"
> SNMPv2-SMI::enterprises.6886.4.1.4.100.1 = INTEGER: 0
> SNMPv2-SMI::enterprises.6886.4.1.4.101.1 = STRING: "DISK OK - free
> space: / 29707 MB (90%);| /=3409MB;33100;33110;0;33115"
> SNMPv2-SMI::enterprises.6886.4.1.4.102.1 = INTEGER: 0
>
> Now, trying it with the -Ovq flag:
>
> $ snmpwalk -Ovq -v 2c -c management localhost .1.3.6.1.4.1.6886
> 1
> "check_d_root"
> "/usr/local/nagios/libexec/check_disk -w 15 -c 5 -p /"
> 0
> "DISK OK - free space: / 29707 MB (90%);| /=3409MB;33100;33110;0;33115"
> 0
>
> Which is quite a lot closer to what we want. So I modify the two
> snmpwalk commands in retrieve_custom_snmp. And I've made a boatload
> of other fixes. I cannot believe how many mistakes I left in there :
> ( Should be a lot better now... Anywho, running the script now
> results in:
>
> $ ./retrieve_custom_snmp -H localhost -o .1.3.6.1.4.1.6886.4.1.4
> DISK OK - free space: / 29705 MB (90%);| /=3410MB;33100;33110;0;33115
> $ echo $?
> 0
>
> Stuff that I had gotten wrong? I've already forgotten some things,
> but here's the more notable stuff.
> * No sed to strip quote from the output string.
> * Had the wrong OID for the exit code. Used 100.0 (as indicated by
> the man-pages), as opposed to 100.1.
> * Used snmpwalk instead of snmpget.
>
> Things should be a lot better now. Care to retry? The latest version
> is up on my site right now. I'll also upload it to the Exchange in a
> few minutes.
no joy for me running with snmp v 1 though
# snmpwalk xxxx -c xxxx -v 1 -t 30 1.3.6.1.4.1.2021.57
UCD-SNMP-MIB::ucdavis.57.1.1 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.57.2.1 = STRING: "/usr/local/bin/perl"
UCD-SNMP-MIB::ucdavis.57.3.1 = STRING:
"/opt/nagios/libexec/check_om_chassis.pl"
UCD-SNMP-MIB::ucdavis.57.100.1 = INTEGER: 2
UCD-SNMP-MIB::ucdavis.57.101.1 = STRING: "CHASSIS: CRITICAL [ SCSI A
external termination is Critical (3.346 V) ]"
UCD-SNMP-MIB::ucdavis.57.102.1 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.57.103.1 = ""
# ./retrieve_custom_snmp -H xxxx -o 1.3.6.1.4.1.2021.57
Error in packet
Reason: (noSuchName) There is no such variable name in this MIB.
Failed object: UCD-SNMP-MIB::ucdavis.57.100.1
Error in packet
Reason: (noSuchName) There is no such variable name in this MIB.
Failed object: UCD-SNMP-MIB::ucdavis.57.101.1
any ideas or am i being dumb?
thanks
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
::: Messages without supporting info will risk being sent to /dev/null
More information about the Users
mailing list