We've moved to a new support system!

The Nagios Answer Hub is a place where you can get help with technical questions from our experts. There, you can quickly open tickets and join discussion boards.

Request Nagios Answer Hub access here: https://info.nagios.com/answer-hub-access-new-users

After completing the access form, you will be given access to a portal where new tickets can be created. We will keep the old customer forum sections and ticket system available for current cases to be resolved.

Go to the Answer Hub

Plugin not worknig

Engage with the community of users including those using the open source solutions.
Includes Nagios Core, Plugins, and NCPA

Plugin not worknig

Postby Ameur003 » Tue Feb 22, 2022 10:56 am

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

Re: Plugin not worknig

Postby gormank » Tue Feb 22, 2022 12:25 pm

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

Re: Plugin not worknig

Postby Ameur003 » Tue Feb 22, 2022 2:05 pm

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

Re: Plugin not worknig

Postby DennisSSebasiStephen » Tue Feb 22, 2022 11:51 pm

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

Re: Plugin not worknig

Postby EdwardSMaTeresa » Wed Feb 23, 2022 6:24 am

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

Re: Plugin not worknig

Postby Ameur003 » Wed Feb 23, 2022 2:37 pm

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


Return to Community Support

Who is online

Users browsing this forum: No registered users and 21 guests