check_snmp_storage.pl error: Service check did not exit properly
Max
perldork at webwizarddesign.com
Tue Feb 3 02:27:34 CET 2009
Hi,
On Mon, Feb 2, 2009 at 7:39 PM, Chris <atstake at gmail.com> wrote:
> On Mon, Feb 2, 2009 at 3:54 PM, Chris <atstake at gmail.com> wrote:
>> I can type the following
>>
>> ./check_snmp_storage.pl -H foo -C foo -m / -r -w 80% -c 90%
>>
>> and get the correct information. But I'm having trouble adding it to
>> nagios configuration file.
>>
>> My partitions are not same for every host (eg. some hosts have a /tmp
>> partition and some don't)
>>
>> In my commands.cfg I defined:
>>
>> define command{
>> command_name check_snmp_storage
>> command_line $USER1$/check_snmp_storage.pl -H $HOSTADDRESS$
>> -C $ARG1$ -m $ARG2$ -w 80% -c 90% -r
>> }
>>
>>
>> And I define the service in my unix.cfg file as:
>>
>> define service{
>> use generic-service
>> host_name server_name
>> service_description Disk /
>> check_command check_snmp_storage!foo!/
>> }
>>
>> When I restart Nagios, I get status critical in Nagios web interface
>> for this service check. Status Information says: (Service check did
>> not exit properly)
Two separate issues here:
1) For the utils.pm problem, you can add this line to the script
after the shebang line to have the perl interpreter find utils.pm.
#!/usr/bin/perl
use lib 'usr/lib/nagios/plugins/';
2) For your custom service check command I recommend using custom
attributes if you are using Nagios 3. Two benefits:
a) You can associate your service with a hostgroup and then just add
hosts to that host group to have them pull in the service (don't have
to redefine new copies of the service over and over
b) More readabl configurations.
E.g. (made up example, does not match your code)
define command{
command_name check_snmp_storage
command_line $USER1$/my_disk_check_command.pl -w
$_HOST_DISK_WARN$ -c $_HOST_DISK_CRIT$ --partitions
$_HOST_DISK_PARTITION$
}
Then create your service one time and add it to the disk-check-hosts group
define service {
service_description Disk Check Service
hostgroup_name disk-check-hosts
.... more attributes ...
}
Then create a host group disk-check-hosts
define hostgroup {
hostgroup_name disk-check-hosts
alias Disk check hosts
}
Then in your host you can use:
define host {
use generic-host
hostgroups +disk-check-hosts
__disk_partitions /var,/home
__disk_warn 85
__disk_crit 95
}
Little more work, but now you can add the service to additional hosts
by just adding them to the disk-check-hosts hostgroup and defining the
custom attributes in the host .. which means someone maintaining the
code sees the attributes in one place .. with the host definition.
Much more readable than having to browse through many services :).
- Max
------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
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