simple chech using snmp

Thomas Sluyter nagios at kilala.nl
Mon Oct 2 18:34:31 CEST 2006


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.

Cheers!


Thomas

-------------------------------------------------------------------------
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