Page 1 of 3

Custom plugin running fine in command line not in Nagios

Posted: Fri Oct 04, 2013 5:38 am
by xtremax
Hi,

I have uploaded my own plugin for doing file checking on Amazon S3. Here are the codes:

Code: Select all

#!/bin/sh

DESTINATION=`date +"$1"`
count=`s3cmd ls $DESTINATION | wc -l`

if [ $count -gt 0 ]
then
        echo "OK - File exist."
        exit 0
else
        echo "CRITICAL - File not found."
        exit 2
fi
When I tried it out on linux command line, I am able to get the correct result with state OK. However after registering the command and service. It's giving me critical state.

Is there anything that I miss out when doing my plugin?

Please advise.

Thanks,

Rudy

Re: Custom plugin running fine in command line not in Nagios

Posted: Fri Oct 04, 2013 10:31 am
by lmiltchev
What do you see when you try to schedule an immediate check under "Service Status Detail"? Can you show a screenshot of this page? Are you testing your check under the CCM (by clicking on the "Test Check Command" button)? Can you show us the service and command definitions?

Re: Custom plugin running fine in command line not in Nagios

Posted: Sun Oct 06, 2013 9:54 pm
by xtremax
Hi lmiltchev,

When I try to schedule immediate check, I am getting command processed successfully message (refer to nagios-service1.png).

Yes I am testing under CCM using the "Test Check Command" button. Please see the attached screenshot for the requested definition.

Thanks,

Rudy

Re: Custom plugin running fine in command line not in Nagios

Posted: Mon Oct 07, 2013 9:42 am
by abrist
What is the output from the "test check command"? We want to see if further escaping is necessary for the check in XI.

Re: Custom plugin running fine in command line not in Nagios

Posted: Tue Oct 08, 2013 10:41 am
by xtremax
Hi,

I have attached the outcome here.

Thanks,

Rudy

Re: Custom plugin running fine in command line not in Nagios

Posted: Tue Oct 08, 2013 1:52 pm
by abrist
It looks like year (%Y) and month (%m) are not getting populated with the actual date.

Re: Custom plugin running fine in command line not in Nagios

Posted: Tue Oct 08, 2013 10:42 pm
by xtremax
Hi abrist,

I think year and month value is populated just fine. Refer to my attached screenshot. I print the value out to debug.

Thanks,

Rudy

Re: Custom plugin running fine in command line not in Nagios

Posted: Wed Oct 09, 2013 9:21 am
by slansing
Have you tried doubling the "/'s" and where there are two making four? So for instance:

Code: Select all

s3:////extramax.data.datacenter//
This may also not work from the test check command since we are escaping inside of the command. You may have to use the service itself once you apply configuration, and schedule immediate checks to get updates.

Re: Custom plugin running fine in command line not in Nagios

Posted: Wed Oct 09, 2013 9:23 pm
by xtremax
Hi,

I have tried your suggestion and test using service immediate check, however it's still not working.

Refer to my attached screenshot.

Thanks,

Rudy

Re: Custom plugin running fine in command line not in Nagios

Posted: Thu Oct 10, 2013 1:13 pm
by lmiltchev
I am not sure if this is going to help, but can try removing the extra "/"s, and wrapping everything is single or double quotes.