Page 1 of 1

Script is running file locally but not remotely

Posted: Fri Sep 28, 2018 5:39 am
by raamardhani7
Hi Team,

On our Linux server we are using check_mem script to monitor the memory usage of it. Th script out is correct when we execute the script with commands locally on that server but when we execute it remotely it always shows critical status irrespective of the thresholds mentioned.

Script executed locally on remote server:
$ ./check_mem -w 80 -c 90
Memory: OK Total: 3832 MB - Used: 973 MB - 25% used|TOTAL=4018626560;;;; USED=1018564608;;;; CACHE=1315745792;;;; BUFFER=304615424;;;;

Same script executed remotely from Nagios server:
[nagios@nagios libexec]$ ./check_nrpe -H remoteserverhostname -c check_mem -a '-w 80 -c 90'
Memory: CRITICAL Total: 3832 MB - Used: 964 MB - 25% used!|TOTAL=4018626560;;;; USED=1009909760;;;; CACHE=1342291968;;;; BUFFER=304766976;;;;
[nagios@nagios libexec]$ ./check_nrpe -H remoteserverhostname -c check_mem -a '-w 20 -c 90'
Memory: CRITICAL Total: 3832 MB - Used: 964 MB - 25% used!|TOTAL=4018626560;;;; USED=1009917952;;;; CACHE=1342410752;;;; BUFFER=304766976;;;;

Command entries in Nrpe.cfg file:

command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20
command[check_hda1]=/usr/local/nagios/libexec/check_disk -w 80 -c 90
command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$
command[check_procs]=/usr/local/nagios/libexec/check_procs -w $ARG1$ -c $ARG2$
command[check_cpu_custom]=/usr/local/nagios/libexec/cpu_ent $ARG1$
command[check_swap]=/usr/local/nagios/libexec/check_swap $ARG1$
command[check_disk]=/usr/local/nagios/libexec/check_disk $ARG1$
command[check_init_service]=/usr/local/nagios/libexec/check_init_service $ARG1$
command[check_cpu_stats]=/usr/local/nagios/libexec/check_cpu_stats $ARG1$
command[check_mem]=/usr/local/nagios/libexec/check_mem $ARG1$
command[check_open_files]=/usr/local/nagios/libexec/check_open_files $ARG1$
command[check_yum]=/usr/local/nagios/libexec/check_yum
command[check_services]=/usr/local/nagios/libexec/check_services -p $ARG1$
command[check_test1]=/usr/local/nagios/libexec/check_test1 $ARG1$
command[check_services]=/usr/local/nagios/libexec/check_services -p $ARG1$
command[check_disk]=/usr/local/nagios/libexec/check_disk $ARG1$


Kindly let us know what could be the issue and how to resolve it?

Re: Script is running file locally but not remotely

Posted: Fri Sep 28, 2018 8:06 am
by scottwilkerson
Can you share your whole nrpe.cfg , as well as any included files from the config.

Also, can you verify that you do not have multiple nrpe.cfg files on the server where the service could be using a different one?

Re: Script is running file locally but not remotely

Posted: Wed Oct 03, 2018 12:17 am
by raamardhani7
We have attached nrpe.cfg file in /usr/local/nagios/etc location.

Re: Script is running file locally but not remotely

Posted: Wed Oct 03, 2018 9:36 am
by lmiltchev
Can you add this new command to the nrpe.cfg file on the remote machine for troubleshooting purposes:

Code: Select all

command[check_mem_new]=/usr/local/nagios/libexec/check_mem -w 80 -c 90
and restart nrpe, so that changes can take effect?

Next, test the new command with the "hard-coded" thresholds by running:

Code: Select all

./check_nrpe -H remoteserverhostname -c check_mem_new
on the nagios server. Did you get CRITICAL again or it worked as expected?

Can you also upload the check_mem plugin from the remote box to the forum? We would like to test the plugin in-house to see if we can replicate the issue.

Re: Script is running file locally but not remotely

Posted: Fri Oct 05, 2018 2:09 am
by raamardhani7
Hi Team,
It didn't work I am attaching check_mem plugin, please have a look.

Re: Script is running file locally but not remotely

Posted: Fri Oct 05, 2018 6:19 am
by raamardhani7
Hi Team,

Its working fine now.
Thank you so much for your help.