Page 1 of 1

Plugin not worknig

Posted: Tue Feb 22, 2022 10:56 am
by Ameur003
Hi guys,

I created a plugin using bash script that get the expiration date of a website certificate, the script is working fine on server command line, il is working when I create the service and Run Check Command.

My problem is, once the service is created and the configuration applyed, I'm getting a Critical error on service check: CRITICAL: Return code of 127 is out of bounds. Make sure the plugin you're trying to run actually exists.

I followed many posts with the same error message but no one corrected my issue.
I already created plugins based on bash and they are working.

If some one of you guys have a solution.

Thank you.

Re: Plugin not worknig

Posted: Tue Feb 22, 2022 12:25 pm
by gormank
Note that a script is not a command. A command defines the plugin that will be executed and it's arguments. Has the command been defined in the NRPE or NCPA configuration?
Also, Nagios runs the checks as the nagios user. If you test as root, the result may not be the same. Since the message suggests the command isn't defined, this isn't the most likely issue.

Re: Plugin not worknig

Posted: Tue Feb 22, 2022 2:05 pm
by Ameur003
gormank wrote:Note that a script is not a command. A command defines the plugin that will be executed and it's arguments. Has the command been defined in the NRPE or NCPA configuration?
Also, Nagios runs the checks as the nagios user. If you test as root, the result may not be the same. Since the message suggests the command isn't defined, this isn't the most likely issue.
Yes, I defined the command in the configuration and when I click on Run Check Command it works, but when I assign it to a service, it doesn't work.
For the user, I tried with root and nagios and both are able to run the script.

Re: Plugin not worknig

Posted: Tue Feb 22, 2022 11:51 pm
by DennisSSebasiStephen
Another thing to be aware of is that Nagios Version 3 and above run the perl script check commands in a single perl process. You can turn this off by using a special comment code in the file. However, this should be avoided if at all possible as it creates a lot of extra work for the nagios server.

Re: Plugin not worknig

Posted: Wed Feb 23, 2022 6:24 am
by EdwardSMaTeresa
It looks like a permission error. You are running the script locally as root user while you are running the script remotely via nrpe as nagios user (you did not show us the relevant nrpe.cfg config line that calls the script).

To fix this, you can modify nrpe.cfg file to looks like:

command[docker_container]=sudo /usr/lib64/nagios/plugins/extra/docker_container
Also, don't forget to add nagios user to sudoers file to execute this script without asking for a password using

Re: Plugin not worknig

Posted: Wed Feb 23, 2022 2:37 pm
by Ameur003
Hi Guys,

Thank you for your help.
I found what was causing my issue, it is related to the host that I was affecting the service to. I changend to another host and it worked as expected. I then removed and re-created the host that the service doesn't work with and it worked fine.

Thank you again for your tips, that may help me in the future fwith other issues.

You can close this thread.