Plugin not worknig

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Ameur003
Posts: 3
Joined: Tue Aug 17, 2021 4:55 pm

Plugin not worknig

Post 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.
gormank
Posts: 1114
Joined: Tue Dec 02, 2014 12:00 pm

Re: Plugin not worknig

Post 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.
Ameur003
Posts: 3
Joined: Tue Aug 17, 2021 4:55 pm

Re: Plugin not worknig

Post 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.
DennisSSebasiStephen
Posts: 14
Joined: Sun Feb 13, 2022 1:29 am

Re: Plugin not worknig

Post 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.
EdwardSMaTeresa
Posts: 12
Joined: Mon Feb 14, 2022 6:10 am

Re: Plugin not worknig

Post 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
Ameur003
Posts: 3
Joined: Tue Aug 17, 2021 4:55 pm

Re: Plugin not worknig

Post 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.
Locked