Page 2 of 2

Re: Nagios returns service did not exit properly

Posted: Thu Apr 24, 2014 7:34 am
by VisRyanWilliams
Hi

I have just started using the pearl script check_snmp_stoarge which seems to be a much better script and will offer more options on things I can check suck as memory if I would like

For now would someone be able to point me in the direction of what my command definition and service definition would be if I wanted to check the disk space only of all drives on any given host.

Thanks in advance

Re: Nagios returns service did not exit properly

Posted: Thu Apr 24, 2014 1:22 pm
by lmiltchev
You could have a command like:

Code: Select all

define command {
       command_name                  		check_snmp
       command_line                  		$USER1$/check_snmp_storage.pl -H $HOSTADDRESS$ $ARG1$
}
In the service definition you could have the following line:

For Windows check:

Code: Select all

check_command			check_snmp! -C community --v2c -m "^[CD]:" -w 80 -c 95 -f
if you are monitoring "C:" and "D:" drives only.

For Linux check:

Code: Select all

check_command			check_snmp! -C community --v2c -m "^/" -w 80 -c 95 -f
Here's an example of the plugin's usage:
example :
Browse storage list : <script> -C <community> -H <host> -m <anything> -w 1 -c 2 -v
the -m option allows regexp in perl format :
Test drive C,F,G,H,I on Windows : -m ^[CFGHI]:
Test all mounts containing /var : -m /var
Test all mounts under /var : -m ^/var
Test only /var : -m /var -r
Test all swap spaces : -m ^Swap
Test all but swap spaces : -m ^Swap -e
You can view the usage by going to:

Code: Select all

/usr/local/nagios/libexec/check_snmp_storage.pl -h
Hope this helps.

Re: Nagios returns service did not exit properly

Posted: Mon Apr 28, 2014 3:38 am
by VisRyanWilliams
Hi

So I have created the following command

Code: Select all

define command{
        command_name    check_snmp_storage
        command_line    /usr/lib/nagios/plugins/check_snmp_storage.pl -H $HOSTADDRESS$ $ARG1$
        }
With the following service

Code: Select all

define service {
        hostgroup_name                  netbios-ssn
        service_description             Check-SNMP-Storagey
        check_command                   check_snmp_storage.pl -C public -m ^[C]: -w 90 -c 95 -v
        use                             generic-service
        notification_interval           0 ; set > 0 if you want to be renotified
}
How ever my nagios verification fails with the following error
Error: Service check command 'check_snmp_storage.pl -C public -m ^[C]: -w 90 -c 95 -v' specified in service 'Check-SNMP-Storagey' for host 'VSHMANHOST' not defined anywhere!

This errors for every host so currently have 9 errors the same

Any thoughts on where I may be going wrong

Apologies again for being quite the nagios noob

Thanks in advance

Re: Nagios returns service did not exit properly

Posted: Mon Apr 28, 2014 6:27 am
by VisRyanWilliams
Hi

I managed to solve this. The command and service code I used are the following:

Code: Select all

define command{
        command_name    check_snmp_storage
        command_line    $USER1$/check_snmp_storage.pl -H $HOSTADDRESS$ -C $ARG1$ -m $ARG2$ -w $ARG3$ -c $ARG4$
        }

Code: Select all

define service {
        hostgroup_name                  netbios-ssn
        service_description             Check-SNMP-Storagey
        check_command                   check_snmp_storage!public!^[C]:!90!95
        use                             generic-service
        notification_interval           0 ; set > 0 if you want to be renotified
}
This is now working for me now. Much better script then the one I originally started with.

Thanks

Re: Nagios returns service did not exit properly

Posted: Mon Apr 28, 2014 9:23 am
by tmcdonald
Good to hear. Gonna lock this one up now.