check_snmp_disk_monitor help

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
nagiosgk
Posts: 3
Joined: Sun Dec 30, 2012 9:07 am

check_snmp_disk_monitor help

Post by nagiosgk »

I am trying to get the contrib file to work via Nagios. I have tried various iterations of command definition and service definition and cannot seem to make this work (I get an unknown status return and a timeout). Where I am at now is below.

It works fine via the command line:
./check_snmp_disk_monitor.pl -H sys1 -C sys1read -m / -w 75 -c 90

I copied the perl script to libexec, chowned it nagios:nagios, chmod'd 755

In the commands config:
define command{
command_name check_snmp_disk
command_line $USER1$/check_snmp_disk_monitor.pl -H $HOSTADDRESS$ $ARG1$
}

define service{
use lab-generic-service
host_name sys1
service_description Root Partition
check_command check_snmp_disk! -c sys1read -m / -w 75 -c 95
}

Also is there a log file or method that logs what gets passed to the program? It would make it easier to debug this and the event logs do not have enough information.

thanks
User avatar
jsmurphy
Posts: 989
Joined: Wed Aug 18, 2010 9:46 pm

Re: check_snmp_disk_monitor help

Post by jsmurphy »

./check_snmp_disk_monitor.pl -H sys1 -C sys1read -m / -w 75 -c 90
check_command check_snmp_disk! -c sys1read -m / -w 75 -c 95
One of these C's is not like the other. I'll give you a hint, it follows the exclamation mark ;)
nagiosgk
Posts: 3
Joined: Sun Dec 30, 2012 9:07 am

Re: check_snmp_disk_monitor help

Post by nagiosgk »

jsmurphy wrote:
./check_snmp_disk_monitor.pl -H sys1 -C sys1read -m / -w 75 -c 90
check_command check_snmp_disk! -c sys1read -m / -w 75 -c 95
One of these C's is not like the other. I'll give you a hint, it follows the exclamation mark ;)
Thanks for the reply. that wasn't the cause in my case (i just typoed the other C when i was making the post) but i figured it out. I would have posted sooner but I needed to wait on my post to be approved.

What I found out after looking at more snmp examples at the exchange is in order to make this work i needed to call it differently. The big break was learning to define the snmp community string as a USER variable, no more timeouts. Since then I also moved to using a different script but the correction to using a variable worked in my previous testing.

1. define a user in the resource.cfg file like this : $USER7$=-C snmpreadcomm
2. define the command
# 'check snmp_storage
define command{
command_name check_snmp_storage
command_line $USER1$/check_snmp_storage.pl -H $HOSTADDRESS$ $USER7$ -m $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$
}

3. define the service
define service{
use generic-service
host_name device1
service_description Root Partition
check_command check_snmp_storage!/!75!95!-r
notes /Root Disk Usage.
notes_url device1-troubleshooting.htm
}
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: check_snmp_disk_monitor help

Post by slansing »

Ah is point #3 a reference to the new script you are using? Thank you for letting the community know the solution to your issue.
nagiosgk
Posts: 3
Joined: Sun Dec 30, 2012 9:07 am

Re: check_snmp_disk_monitor help

Post by nagiosgk »

slansing wrote:Ah is point #3 the new script you are using? Thank you for letting the community know the solution to your issue.
glad to share. Point 3 references the command definition check_snmp_storage which calls check_snmp_storage.pl, which is the new script I am using now.

Prior to moving to this new script I was able to fix the issue I was having using check_snmp_disk_monitor.pl by creating the USER7 variable and updating the command definition to take that and the other varbinds correctly. More of a learning issue on my part on figuring out the "what and how" and not an issue with the old script.
Locked