Hello, I am having an issue with setting up a new command with a custom plugin. I have loaded the plugin then created a new command that uses it. I then create a new custom service on an existing host. I choose the new command and enter my options. When I click the "Run Check Command" option I receive no output back. I then take the command that was ran and copy and paste it into a command line. I receive output back from the plugin when doing this.
I'm wondering if there is an issue with the custom command that is built. When I substitute other commands in the service drop down I get some sort of an answer back.
When viewing this new service the only thing that is presented is "(No output on stdout) stderr:". When searching on this error I see that a host or option is incorrect. Somewhat confused by that as the same command works within my CLI. I also saw a mention of checking the 'resource.cfg' file to make sure your path is correct. I believe it is but can provide that if needed. I do have other plugins running custom commands without issue.
I have attached my custom command as well as the service that is built. I have also attached screenshots showing my 'run check command' as well as the CLI output from the same command.
Any help in getting this working would be greatly appreciated.
Thanks!
Custom Command Issue
Custom Command Issue
You do not have the required permissions to view the files attached to this post.
-
benjaminsmith
- Posts: 5324
- Joined: Wed Aug 22, 2018 4:39 pm
- Location: saint paul
Re: Custom Command Issue
HI,
--Benjamin
If that's not the issue, please send us the system profile as well.
To send us your system profile.
Login to the Nagios XI GUI using a web browser.
Click the "Admin" > "System Profile" Menu
Click the "Download Profile" button
The fact that it works from the CLI is usually the result of incorrect permission on the plugin. Try logging in on the CLI as the nagios user account, su - nagios , and run the plugin, do you get the same results?I then take the command that was ran and copy and paste it into a command line. I receive output back from the plugin when doing this.
--Benjamin
If that's not the issue, please send us the system profile as well.
To send us your system profile.
Login to the Nagios XI GUI using a web browser.
Click the "Admin" > "System Profile" Menu
Click the "Download Profile" button
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: Custom Command Issue
Hi Benjamin
Thank you for the reply. Attempting to run the plugin as user 'nagios' results in the same zero output like the run check command does. I have changed permissions on this plugin but still am unable to run the plugin. I have PM'd you a system profile. Still wondering if this is a permissions issue but am not seeing the issue at this time.
Thanks!
Thank you for the reply. Attempting to run the plugin as user 'nagios' results in the same zero output like the run check command does. I have changed permissions on this plugin but still am unable to run the plugin. I have PM'd you a system profile. Still wondering if this is a permissions issue but am not seeing the issue at this time.
Thanks!
-
benjaminsmith
- Posts: 5324
- Joined: Wed Aug 22, 2018 4:39 pm
- Location: saint paul
Re: Custom Command Issue
HI,
Thank you for the profile, that looks correct. Let's double-check the permissions, please login to the CLI and run the following command.
If it was working from the CLI but then does not as the nagios user, that would indicate a permissions issue. Were you logged in as root when running it before from the CLI?
Benjamin
Thank you for the profile, that looks correct. Let's double-check the permissions, please login to the CLI and run the following command.
Code: Select all
ls -l /usr/local/nagios/libexec/check_iftraffic_e7.pl
Benjamin
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: Custom Command Issue
Correct, from CLI the plugin will run as the root user but not the nagios user. I was thinking permissions as well but am not seeing anything obvious. here is the output from the command:
[root@nagios ~]# ls -l /usr/local/nagios/libexec/check_iftraffic_e7.pl
-rwxrwxrwx 1 nagios nagios 39142 Sep 15 14:00 /usr/local/nagios/libexec/check_iftraffic_e7.pl
Thanks!
[root@nagios ~]# ls -l /usr/local/nagios/libexec/check_iftraffic_e7.pl
-rwxrwxrwx 1 nagios nagios 39142 Sep 15 14:00 /usr/local/nagios/libexec/check_iftraffic_e7.pl
Thanks!
-
benjaminsmith
- Posts: 5324
- Joined: Wed Aug 22, 2018 4:39 pm
- Location: saint paul
Re: Custom Command Issue
Hi,
Those permissions should work, the reccomend settings are as follows.
Can you upload the custom script to the thread or send it over in a private message. I would like to take a look, it might not be returning the correct output ( see: https://nagios-plugins.org/doc/guidelines.html). Thanks, Benjamin
Those permissions should work, the reccomend settings are as follows.
Code: Select all
chown apache:nagios /usr/local/nagios/libexec/mynagiosplugin.pl
chmod 775 /usr/local/nagios/libexec/mynagiosplugin.pl
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: Custom Command Issue
Thank you for posting recommended settings. I have corrected mine to match the recommended ones. I will PM you the plugin.
Thanks!
Thanks!
-
benjaminsmith
- Posts: 5324
- Joined: Wed Aug 22, 2018 4:39 pm
- Location: saint paul
Re: Custom Command Issue
Hi,
So I've been able to repeat the same error. It works from the CLI and returns a correct exit code. However, neither Core nor XI can read string output, but it does read the exit status. In this case, the service is returning OK. You'll notice it outputs perf data in the CLI, but that's not getting processed either.
It will work for monitoring since it's returning correct exit codes, but you won't get the system output or perf data. It looks like the output is not to plugin specs.
https://nagios-plugins.org/doc/guidelines.html
--Benjamin
So I've been able to repeat the same error. It works from the CLI and returns a correct exit code. However, neither Core nor XI can read string output, but it does read the exit status. In this case, the service is returning OK. You'll notice it outputs perf data in the CLI, but that's not getting processed either.
It will work for monitoring since it's returning correct exit codes, but you won't get the system output or perf data. It looks like the output is not to plugin specs.
https://nagios-plugins.org/doc/guidelines.html
--Benjamin
You do not have the required permissions to view the files attached to this post.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Be sure to check out our Knowledgebase for helpful articles and solutions!