[Nagiosplug-devel] Help needed with simple BASH plugin - Nagiosgetting (null)
Alan Johnson
aj at okesit.net
Tue May 25 08:40:46 CEST 2010
I've even tried hard-coding the host's IP address in the script so that no arguments are needed, but same problem.
Here is the setup of the command in my custom commands file:
define command {
command_name check_s3
command_line $USER1$/check_s3 $HOSTADDRESS$
}
I am assuming that $HOSTADDRESS$ is being parsed to the script and being used as $1 in the "nc" line
And the service in the host's config file:
define service{
use generic-service ; Name of service template to use
host_name host02
service_description S3SYNC
check_command check_s3
notification_options c,r
notification_interval 240
notification_period 24x7
max_check_attempts 3
check_interval 5
retry_interval 1
contact_groups admins,lautus
}
On 24 May 2010, at 9:05 PM, Bret Cason wrote:
> Maybe the command definition isn't passing an $ARG1$ value.
> The associated service command should say something like ".... -a
> $ARG1$"
>
> -----Original Message-----
> From: Alan Johnson [mailto:aj at okesit.net]
> Sent: Monday, May 24, 2010 11:27 AM
> To: nagiosplug-devel at lists.sourceforge.net
> Subject: [Nagiosplug-devel] Help needed with simple BASH plugin -
> Nagiosgetting (null)
>
> Hi everyone,
>
> I am writing a plugin to be used internally to monitor the status of my
> Amazon S3 backups.
>
> Its very simple in that it telnets to a port on my backup server thats
> backs up to S3, then either gets a 0,1 or 2 depending on exit code of
> the S3 synchronisation. That part work perfectly.
>
> The problem is the plugin on the Nagios box. If I run it from the
> command line, I get everything as expected, plus the correct exit code.
> When I run it in Nagios, I get (null) and thats it.
>
> My Nagios plugin is:
>
> #!/bin/bash
> STATUS=`/bin/nc $1 65530`
> if [ "$STATUS" = "0" ] ;
> then
> /bin/echo "OK: S3 synchronisation okay"
> exit 0
> fi
> if [ "$STATUS" = "1" ] ;
> then
> /bin/echo "OK: S3 synchronisation currently running"
> exit 1
> fi
> if [ "$STATUS" = "2" ] ;
> then
> /bin/echo "CRITICAL: S3 synchronisation failed"
> exit 2
> fi
>
> Any ideas on what may be wrong? Haven't seen any solution on other
> lists that help.
>
>
> ------------------------------------------------------------------------
> ------
>
> _______________________________________________________
> Nagios Plugin Development Mailing List
> Nagiosplug-devel at lists.sourceforge.net
> Unsubscribe at
> https://lists.sourceforge.net/lists/listinfo/nagiosplug-devel
> ::: Please include plugins version (-v) and OS when reporting any issue.
>
> ::: Messages without supporting info will risk being sent to /dev/null
>
> ------------------------------------------------------------------------------
>
> _______________________________________________________
> Nagios Plugin Development Mailing List Nagiosplug-devel at lists.sourceforge.net
> Unsubscribe at https://lists.sourceforge.net/lists/listinfo/nagiosplug-devel
> ::: Please include plugins version (-v) and OS when reporting any issue.
> ::: Messages without supporting info will risk being sent to /dev/null
More information about the Devel
mailing list