NRPE issue

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: NRPE issue

Post by tgriep »

You need to remove the .sh from the end of the command.
Edit the $ARG1$ and change

Code: Select all

check_cpu_stats.sh
to

Code: Select all

check_cpu_stats
Save it out and apply the config and it should work for you.
Be sure to check out our Knowledgebase for helpful articles and solutions!
raamardhani7
Posts: 459
Joined: Tue Jun 02, 2015 12:36 am

Re: NRPE issue

Post by raamardhani7 »

tgriep wrote:You need to remove the .sh from the end of the command.
Edit the $ARG1$ and change

Code: Select all

check_cpu_stats.sh
to

Code: Select all

check_cpu_stats
Save it out and apply the config and it should work for you.
Hi..
I have made the changes advised, but still facing the same issue.

here is the output from the remote server.
Updated the config file in remote server, restarted the services.
command[check_cpu_stats]=/usr/local/nagios/libexec/check_cpu_stats $ARG1$ $ARG2$

service xinetd restart
Stopping xinetd: [ OK ]
Starting xinetd: [ OK ]

output on running the script:
CPU STATISTICS OK: user=0.20% system=0.30% iowait=0.00% idle=99.50% | user=0.20% system=0.30% iowait=0.00%;80;90 idle=99.50%

Output from Nagios XI portal:

COMMAND: /usr/local/nagios/libexec/check_nrpe -H uusrcpmwik00 -t 30 -c check_cpu_stats -a '-w 85 -c 95'
OUTPUT: NRPE: Command 'check_cpu_stats' not defined

Could you please upload the check_cpu_stats for me, so that will add this and will give a try.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: NRPE issue

Post by tgriep »

You shouldn't have edited the command on the remote server.
Edit the common.cfg file and change it back from

Code: Select all

command[check_cpu_stats]=/usr/local/nagios/libexec/check_cpu_stats $ARG1$ $ARG2$
to

Code: Select all

command[check_cpu_stats]=/usr/local/nagios/libexec/check_cpu_stats.sh $ARG1$ $ARG2$
Save it and restart xinetd
Be sure to check out our Knowledgebase for helpful articles and solutions!
raamardhani7
Posts: 459
Joined: Tue Jun 02, 2015 12:36 am

Re: NRPE issue

Post by raamardhani7 »

tgriep wrote:You shouldn't have edited the command on the remote server.
Edit the common.cfg file and change it back from

Code: Select all

command[check_cpu_stats]=/usr/local/nagios/libexec/check_cpu_stats $ARG1$ $ARG2$
to

Code: Select all

command[check_cpu_stats]=/usr/local/nagios/libexec/check_cpu_stats.sh $ARG1$ $ARG2$
Save it and restart xinetd
I have both the files in the path,so it should have picked any of the files.

[root@uusrcpmwik00 libexec]# ls -ltr | grep -i check_cpu_stats
-rwxr-xr-x. 1 nagios nagios 5355 Jul 30 22:59 check_cpu_stats.sh
-rwxr-xr-x. 1 root root 5355 Aug 5 11:33 check_cpu_stats

Output from remote server, seems like issue with the script, I have downloaded the script from Nagios site.
./check_cpu_stats -w 80 -c 90
./check_cpu_stats: line 139: [: 0.00: integer expression expected
./check_cpu_stats: line 142: [: 0.00: integer expression expected
./check_cpu_stats: line 152: [: 0.30: integer expression expected
./check_cpu_stats: line 156: [: 0.60: integer expression expected
./check_cpu_stats: line 160: [: 0.00: integer expression expected
./check_cpu_stats: line 164: [: 99.10: integer expression expected
CPU STATISTICS OK: user=0.30% system=0.60% iowait=0.00% idle=99.10% | user=0.30% system=0.60% iowait=0.00%;80;90 idle=99.10%
You do not have the required permissions to view the files attached to this post.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: NRPE issue

Post by lmiltchev »

It seems like this issue has been fixed in a newer version of the plugin. You can download the revision 2.1.1 from here:

https://exchange.nagios.org/directory/P ... ed/details

Example:

Code: Select all

[root@speedking libexec]# ./check_cpu_stats.sh
CPU STATISTICS OK : user=0.50% system=0.50% iowait=0.00% idle=98.99% nice=0.00% steal=0.00% | CpuUser=0.50;CpuSystem=0.50;CpuIoWait=0.00;CpuIdle=98.99;CpuNice=0.00;CpuSteal=0.00;30;100
Let me know if this helped.
Be sure to check out our Knowledgebase for helpful articles and solutions!
raamardhani7
Posts: 459
Joined: Tue Jun 02, 2015 12:36 am

Re: NRPE issue

Post by raamardhani7 »

lmiltchev wrote:It seems like this issue has been fixed in a newer version of the plugin. You can download the revision 2.1.1 from here:

https://exchange.nagios.org/directory/P ... ed/details

Example:

Code: Select all

[root@speedking libexec]# ./check_cpu_stats.sh
CPU STATISTICS OK : user=0.50% system=0.50% iowait=0.00% idle=98.99% nice=0.00% steal=0.00% | CpuUser=0.50;CpuSystem=0.50;CpuIoWait=0.00;CpuIdle=98.99;CpuNice=0.00;CpuSteal=0.00;30;100
Let me know if this helped.
Hi...

I have replaced the file with the updated one and I tried from remote server, it is executing perfectly.
./check_cpu_stats
CPU STATISTICS OK : user=0.00% system=0.50% iowait=0.00% idle=99.50% nice=0.00% steal=0.00% | CpuUser=0.00;CpuSystem=0.50;CpuIoWait=0.00;CpuIdle=99.50;CpuNice=0.00;CpuSteal=0.00;30;100

Have defined it in nrpe.cfg:
command[check_cpu_stats]=/usr/local/nagios/libexec/check_cpu_stats $ARG1$

Have defined it in common.cfg
grep check_cpu_stats common.cfg
command[check_cpu_stats]=/usr/local/nagios/libexec/check_cpu_stats $ARG1$

Recycled xinetd services.

Defined the same in Nagios XI server npre.cfg file:
grep check_cpu_stats nrpe.cfg
command[check_cpu_stats]=/usr/lib/nagios/plugins/check_cpu_stats $ARG1$

Have defined the same in Nagios XI commands.cfg
grep check_cpu_stats commands.cfg
command_name check_cpu_stats
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_cpu_stats $ARG1$

And recycled the xinetd service.

When I am executing the below command from the portal or from the server XI I am getting the below error.
COMMAND: /usr/local/nagios/libexec/check_nrpe -H uusrcpmwik00 -t 30 -c check_cpu_stats
OUTPUT: NRPE: Command 'check_cpu_stats' not defined

Attaching the check_npre screenshot, check_cpu_stats, cpu commands screenshot from the portal.
Could you please let me know what am I missing here. Thanks...
You do not have the required permissions to view the files attached to this post.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: NRPE issue

Post by Box293 »

This is not necessary on the Nagios XI server.
raamardhani7 wrote:Defined the same in Nagios XI server npre.cfg file:
grep check_cpu_stats nrpe.cfg
command[check_cpu_stats]=/usr/lib/nagios/plugins/check_cpu_stats $ARG1$
This needs to be done through CCM, not directly against the flat config files (this is why is it not appearing in CCM)
raamardhani7 wrote:Have defined the same in Nagios XI commands.cfg
grep check_cpu_stats commands.cfg
command_name check_cpu_stats
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_cpu_stats $ARG1$
This should only be defined in one of the two files, not both.
raamardhani7 wrote:Have defined it in nrpe.cfg:
command[check_cpu_stats]=/usr/local/nagios/libexec/check_cpu_stats $ARG1$

Have defined it in common.cfg
grep check_cpu_stats common.cfg
command[check_cpu_stats]=/usr/local/nagios/libexec/check_cpu_stats $ARG1$
Please execute this command at the command line of your Nagios XI server:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H uusrcpmwik00 -t 30 -c check_cpu_stats 
If you get the error OUTPUT: NRPE: Command 'check_cpu_stats' not defined can you please confirm that uusrcpmwik00 is the SAME server as the one that you defined the command in nrpe.cfg/common.cfg.

Try the test again but this time use the IP address of the server:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H the_ip_address_of_uusrcpmwik00 -t 30 -c check_cpu_stats 
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
raamardhani7
Posts: 459
Joined: Tue Jun 02, 2015 12:36 am

Re: NRPE issue

Post by raamardhani7 »

Box293 wrote:This is not necessary on the Nagios XI server.
raamardhani7 wrote:Defined the same in Nagios XI server npre.cfg file:
grep check_cpu_stats nrpe.cfg
command[check_cpu_stats]=/usr/lib/nagios/plugins/check_cpu_stats $ARG1$
This needs to be done through CCM, not directly against the flat config files (this is why is it not appearing in CCM)
raamardhani7 wrote:Have defined the same in Nagios XI commands.cfg
grep check_cpu_stats commands.cfg
command_name check_cpu_stats
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_cpu_stats $ARG1$
This should only be defined in one of the two files, not both.
raamardhani7 wrote:Have defined it in nrpe.cfg:
command[check_cpu_stats]=/usr/local/nagios/libexec/check_cpu_stats $ARG1$

Have defined it in common.cfg
grep check_cpu_stats common.cfg
command[check_cpu_stats]=/usr/local/nagios/libexec/check_cpu_stats $ARG1$
Please execute this command at the command line of your Nagios XI server:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H uusrcpmwik00 -t 30 -c check_cpu_stats 
If you get the error OUTPUT: NRPE: Command 'check_cpu_stats' not defined can you please confirm that uusrcpmwik00 is the SAME server as the one that you defined the command in nrpe.cfg/common.cfg.

Try the test again but this time use the IP address of the server:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H the_ip_address_of_uusrcpmwik00 -t 30 -c check_cpu_stats 

I have removed it:
Box293 wrote:This is not necessary on the Nagios XI server.
raamardhani7 wrote:Defined the same in Nagios XI server npre.cfg file:
grep check_cpu_stats nrpe.cfg

Have defined it in CCM now, uploaded the screenshot for the same:

This needs to be done through CCM, not directly against the flat config files (this is why is it not appearing in CCM)
raamardhani7 wrote:Have defined the same in Nagios XI commands.cfg
grep check_cpu_stats commands.cfg
command_name check_cpu_stats
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_cpu_stats $ARG1$
Have deleted the contents from common.cfg
This should only be defined in one of the two files, not both.
raamardhani7 wrote:Have defined it in nrpe.cfg:
command[check_cpu_stats]=/usr/local/nagios/libexec/check_cpu_stats $ARG1$


Recycled xinetd service on both the servers, here is the output.. which is similar to the old :(

[root@lussvpnagiosxi00 etc]# /usr/local/nagios/libexec/check_nrpe -H uusrcpmwik00 -t 30 -c check_cpu_stats
NRPE: Command 'check_cpu_stats' not defined


[root@lussvpnagiosxi00 etc]# /usr/local/nagios/libexec/check_nrpe -H 10.10.82.38 -t 30 -c check_cpu_stats
NRPE: Command 'check_cpu_stats' not defined
You do not have the required permissions to view the files attached to this post.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: NRPE issue

Post by Box293 »

raamardhani7 wrote:Recycled xinetd service on both the servers, here is the output.. which is similar to the old :(

[root@lussvpnagiosxi00 etc]# /usr/local/nagios/libexec/check_nrpe -H uusrcpmwik00 -t 30 -c check_cpu_stats
NRPE: Command 'check_cpu_stats' not defined


[root@lussvpnagiosxi00 etc]# /usr/local/nagios/libexec/check_nrpe -H 10.10.82.38 -t 30 -c check_cpu_stats
NRPE: Command 'check_cpu_stats' not defined
Basically the remote server is saying that it can't find the command defintion.

Can you please upload the following files from the remote server uusrcpmwik00 here:
/usr/local/nagios/etc/nrpe/nrpe.cfg
/usr/local/nagios/etc/nrpe/common.cfg
/etc/xinetd.d/nrpe
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
raamardhani7
Posts: 459
Joined: Tue Jun 02, 2015 12:36 am

Re: NRPE issue

Post by raamardhani7 »

Box293 wrote:
raamardhani7 wrote:Recycled xinetd service on both the servers, here is the output.. which is similar to the old :(

[root@lussvpnagiosxi00 etc]# /usr/local/nagios/libexec/check_nrpe -H uusrcpmwik00 -t 30 -c check_cpu_stats
NRPE: Command 'check_cpu_stats' not defined


[root@lussvpnagiosxi00 etc]# /usr/local/nagios/libexec/check_nrpe -H 10.10.82.38 -t 30 -c check_cpu_stats
NRPE: Command 'check_cpu_stats' not defined
Basically the remote server is saying that it can't find the command defintion.

Can you please upload the following files from the remote server uusrcpmwik00 here:
/usr/local/nagios/etc/nrpe/nrpe.cfg
/usr/local/nagios/etc/nrpe/common.cfg
/etc/xinetd.d/nrpe
=======================

Hi..

I have uploaded nrpe.cfg and please find the outputs of rest two:

[root@uusrcpmwik00 libexec]# cat /etc/xinetd.d/nrpe
# default: on
# description: NRPE (Nagios Remote Plugin Executor)
service nrpe
{
flags = REUSE
socket_type = stream
port = 5666
wait = no
user = nagios
group = nagios
server = /usr/local/nagios/bin/nrpe
server_args = -c /usr/local/nagios/etc/nrpe.cfg --inetd
log_on_failure += USERID
disable = no
only_from = 127.0.0.1 10.10.83.90
nrpe 5666/tcp
}

[root@uusrcpmwik00 libexec]# cat /usr/local/nagios/etc/nrpe/nrpe.cfg
cat: /usr/local/nagios/etc/nrpe/nrpe.cfg: No such file or directory

[root@uusrcpmwik00 libexec]# cat /usr/local/nagios/etc/nrpe/common.cfg

### GENERIC SERVICES ###
command[check_init_service]=sudo /usr/local/nagios/libexec/check_init_service $ARG1$
command[check_services]=/usr/local/nagios/libexec/check_services -p $ARG1$

### MISC SYSTEM METRICS ###
#command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
command[check_users]=/usr/local/nagios/libexec/check_users $ARG1$
command[check_load]=/usr/local/nagios/libexec/check_load $ARG1$
command[check_swap]=/usr/local/nagios/libexec/check_swap $ARG1$
command[check_mem]=/usr/local/nagios/libexec/custom_check_mem $ARG1$

### SYSTEM UPDATES ###
command[check_yum]=/usr/local/nagios/libexec/check_yum
command[check_apt]=/usr/local/nagios/libexec/check_apt

### DISK ###
command[check_disk]=/usr/local/nagios/libexec/check_disk $ARG1$
command[check_ide_smart]=/usr/local/nagios/libexec/check_ide_smart $ARG1$

### PROCESSES ###
command[check_all_procs]=/usr/local/nagios/libexec/custom_check_procs
command[check_procs]=/usr/local/nagios/libexec/check_procs $ARG1$

### OPEN FILES ###
command[check_open_files]=/usr/local/nagios/libexec/check_open_files.pl $ARG1$

### NETWORK CONNECTIONS ###
command[check_netstat]=/usr/local/nagios/libexec/check_netstat.pl -p $ARG1$ $ARG2$
You do not have the required permissions to view the files attached to this post.
Locked