Script is running file locally but not remotely

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
raamardhani7
Posts: 459
Joined: Tue Jun 02, 2015 12:36 am

Script is running file locally but not remotely

Post 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?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Script is running file locally but not remotely

Post 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?
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
raamardhani7
Posts: 459
Joined: Tue Jun 02, 2015 12:36 am

Re: Script is running file locally but not remotely

Post by raamardhani7 »

We have attached nrpe.cfg file in /usr/local/nagios/etc location.
Attachments
nrpe.cfg.txt
(10.24 KiB) Downloaded 122 times
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: Script is running file locally but not remotely

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
raamardhani7
Posts: 459
Joined: Tue Jun 02, 2015 12:36 am

Re: Script is running file locally but not remotely

Post by raamardhani7 »

Hi Team,
It didn't work I am attaching check_mem plugin, please have a look.
Attachments
check_mem.txt
(1.91 KiB) Downloaded 102 times
raamardhani7
Posts: 459
Joined: Tue Jun 02, 2015 12:36 am

Re: Script is running file locally but not remotely

Post by raamardhani7 »

Hi Team,

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