Nagios returns service did not exit properly

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.
VisRyanWilliams
Posts: 8
Joined: Mon Apr 14, 2014 8:57 am

Re: Nagios returns service did not exit properly

Post 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
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: Nagios returns service did not exit properly

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
VisRyanWilliams
Posts: 8
Joined: Mon Apr 14, 2014 8:57 am

Re: Nagios returns service did not exit properly

Post 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
VisRyanWilliams
Posts: 8
Joined: Mon Apr 14, 2014 8:57 am

Re: Nagios returns service did not exit properly

Post 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
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Nagios returns service did not exit properly

Post by tmcdonald »

Good to hear. Gonna lock this one up now.
Former Nagios employee
Locked