Custom plugin running fine in command line not in Nagios

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
xtremax
Posts: 28
Joined: Wed Jul 17, 2013 11:30 pm

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

Post by xtremax »

Hi lmiltchev,

I have tried your solution, but it's still not working.

Thanks,

Rudy
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

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

Post by lmiltchev »

Can you show us the actual command that works from the CLI, and the output of it?
Be sure to check out our Knowledgebase for helpful articles and solutions!
xtremax
Posts: 28
Joined: Wed Jul 17, 2013 11:30 pm

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

Post by xtremax »

Hi,

I have tried that as well and still not working out.

Thanks,

Rudy
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

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

Post by scottwilkerson »

Am I understanding you correctly, the plugin you created doesn't work from the CLI either?

You will need the plugin to work properly from the CLI before you can get it to work in Nagios.

If it is working from the command line, can you show the command as lmiltchev asked.

Thanks.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
xtremax
Posts: 28
Joined: Wed Jul 17, 2013 11:30 pm

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

Post by xtremax »

Hi,

Sorry for my late response, I am confused and just realised that I need to go to page 2 to see your reply.

I have attached a screenshot for running my script from CLI.

Thanks,

Rudy
You do not have the required permissions to view the files attached to this post.
yancy
Posts: 523
Joined: Thu Oct 06, 2011 10:12 am

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

Post by yancy »

xtremax,

Can you run the following _After_ you run your plugin to verify the return code is what you expect.

Code: Select all

echo $?
Thanks,

-Yancy
xtremax
Posts: 28
Joined: Wed Jul 17, 2013 11:30 pm

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

Post by xtremax »

Hi,

I have attached the screenshot as requested.

Thanks,

Rudy
You do not have the required permissions to view the files attached to this post.
xtremax
Posts: 28
Joined: Wed Jul 17, 2013 11:30 pm

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

Post by xtremax »

Hi,

I have been looking through this issue and found this capture_plugin.pl script online (http://www.waggy.at/nagios/capture_plugin.htm).

This plugin used on top of another plugin to capture the real error message that can't be seen. And I have applied it to my plugin to check the error message.

Here is the actual error message:

ERROR: /root/s3cfg: Permission denied
ERROR: Configuration file not available.
ERROR: Consider using --configure parameter to create one.

The error shown that Nagios does not have permission to the config file that needed by s3cmd. To fix this, I've tried to set the owner of this config file to nagios:nagios and also root:root.

However it's still not working with the same error message, may I know what permission that I need to provide for this config file?

Thanks,

Rudy
You do not have the required permissions to view the files attached to this post.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

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

Post by abrist »

Remove the config from /root. Try placing the config in the nagios home directory /home/nagios or in another folder that nagios has rights to. /root is usually locked down.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
xtremax
Posts: 28
Joined: Wed Jul 17, 2013 11:30 pm

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

Post by xtremax »

Hi abrist,

Thanks for you suggestion, finally it's working. I copied over the config file to /usr/local/nagios/libexec/ and now it's okay.
Locked