nrpe reporting issues

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
jeffh
Posts: 7
Joined: Mon May 02, 2016 9:18 am

nrpe reporting issues

Post by jeffh »

We are experiencing the case where nrpe installs (using either Ubuntu based or Amazon Linux) fail to report correctly. The installs themselves on the clients are successful, the nrpe has the allowed host set correctly, and the plugin directory is present.

The errors we see in the NagiosXi server for these broken services are: NRPE: Command 'xxx_service' not defined.

What is very confusing is that some of these nrpe installs work out of the box, without defining the commands in the nrpe.cfg file, while others are failing.

Any clues or help would be greatly appreciated here.
bwallace
Posts: 1145
Joined: Tue Nov 17, 2015 1:57 pm

Re: nrpe reporting issues

Post by bwallace »

Usually this error means there is a difference with the command name between the Nagios server and the command name on the client.
https://assets.nagios.com/downloads/nag ... utions.pdf

If the above doc does not enable you to resolve, then to start with, could you show us how these commands are defined on the client?
Also, show us the actual command that you are running from the command line on the Nagios XI server along with the output of it - thanks -
Be sure to check out the Knowledgebase for helpful articles and solutions!
jeffh
Posts: 7
Joined: Mon May 02, 2016 9:18 am

Re: nrpe reporting issues

Post by jeffh »

Thanks, I was able to resolve it for most services but am getting warning + NRPE: Unable to read output errors for the 'check_init_service' check we use for crod (crond) and ssh (sshd). This error only happens when the command is run from the nagiosxi server. The command is successful when run locally.

From what I can tell by drilling into the service and selecting 'advanced' in the nagiosxi gui, the command being passed is:

Code: Select all

check_nrpe!check_init_service!-a 'crond'!!!!!!
check_init_service line in nrpe.cfg:

Code: Select all

command[check_init_service]=sudo /usr/lib64/nagios/plugins/check_init_service $ARG1$
The path is correct and consistent with the other commands that are working properly. Plugin permissions also match.

The client is running Amazon Linux (RHEL based).
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: nrpe reporting issues

Post by ssax »

In your remote nrpe.cfg file do you have dont_blame_nrpe=1?
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: nrpe reporting issues

Post by rkennedy »

In addition to what @ssax mentioned, what are the permissions of /usr/lib64/nagios/plugins/check_init_service? When you successfully ran the command locally, were you doing so as the Nagios user?
Former Nagios Employee
jeffh
Posts: 7
Joined: Mon May 02, 2016 9:18 am

Re: nrpe reporting issues

Post by jeffh »

Yes, blame is set to '1' in nrpe.cfg, and the permissions plugin permission is root:root 755, which matches the other plugins that are running successfully. The command is prefaced with 'sudo' in nrpe.cfg, and I'm logged in as ec2-user when run locally but use 'sudo'- ex. 'sudo ./check_init_service crond'
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: nrpe reporting issues

Post by lmiltchev »

This error could indicate a wrong path or insufficient sudo privileges.

The path may be correct in the nrpe.cfg file:
command[check_init_service]=sudo /usr/lib64/nagios/plugins/check_init_service $ARG1$
but is it possible that you have the same command defined twice? Do you have a file called "common.cfg". If you used our "official" Linux agent installer, you should have it.

Do you have the check_init_service command added to sudoers on the client?

Example:

Code: Select all

Defaults:nagios !requiretty
nagios ALL=NOPASSWD: /usr/lib64/nagios/plugins/check_init_service
Be sure to check out our Knowledgebase for helpful articles and solutions!
jeffh
Posts: 7
Joined: Mon May 02, 2016 9:18 am

Re: nrpe reporting issues

Post by jeffh »

lmiltchev wrote: but is it possible that you have the same command defined twice? Do you have a file called "common.cfg". If you used our "official" Linux agent installer, you should have it.
Thanks, the install was performed using the package manager (Yum) as the linux-agent installer does not support Amazon Linux. Head slapping 'I should have mentioned this' plot twist, I did copy the check_init_service plugin into this client from another nrpe client that used the linux agent installer (http://assets.nagios.com/downloads/nagi ... ent.tar.gz).

If there is a native plugin that handles the init service checks that is part of the rhel nrpe plugin package, please let me know what the plugin name is and I'll try it,

lmiltchev wrote:Do you have the check_init_service command added to sudoers on the client?

Example:

Code: Select all

Defaults:nagios !requiretty
nagios ALL=NOPASSWD: /usr/lib64/nagios/plugins/check_init_service
I did try that, restarted nrpe, and encounter the same error.
jeffh
Posts: 7
Joined: Mon May 02, 2016 9:18 am

Re: nrpe reporting issues

Post by jeffh »

Update: I tried substituting the exact syntax for the parameter $ARG1$ in the check_init_service command in nrpe.cfg....

Code: Select all

command[check_init_service]=sudo /usr/lib64/nagios/plugins/check_init_service crond
Then forcing a check in the Nagiosxi gui. Unfortunately, I get the same error. I also recreated the check_init_service file and ensured the proper permissions, 755, and owner, 'root' without success.

And again, running the command locally is not an issue. When I run the command with the parameter 'crond' locally

Code: Select all

sudo ./check_init_service crond
, I receive:

Code: Select all

crond (pid  1451) is running...
jeffh
Posts: 7
Joined: Mon May 02, 2016 9:18 am

Re: nrpe reporting issues

Post by jeffh »

Success!!! Not sure why, but removing 'sudo' from the command in nrpe.cfg resolved the issue.

Locally I need to use sudo from a non-root user to get a correct response.
Locked