Monitor Remote Server Memory Usage
-
ep7network
- Posts: 51
- Joined: Sun Dec 27, 2015 5:04 pm
Monitor Remote Server Memory Usage
On my remote server, I'm running CentOS and I've installed "yum install nrpe nagios-plugins -all openssl".
My Nagios server is able to monitor CPU, SSH,Total Processes, and Logged in users on my remote server.
I would like to monitor memory on my remote server and visually see it on my Nagios web interface. Currently on my Nagios server, the memory service is displaying "status critical with NRPE: command 'check_mem' not defined."
On my remote server (client), I have configured NRPE to monitor memory usage. I used " wget https://raw.githubusercontent.com/justi ... eck_mem.pl" and was able to download and install it successfully. I say successfully because I can run ./check_mem -f -w 20 -c 10 and the output displays this "OK - 78.5% (3076688 kB) free.|TOTAL=3921616KB;;;; USED=844928KB;3137292;3529454;; FREE=3076688KB;;;; CACHES=713696KB;;;;"
As a result, the command is working on the remote client side. In addition, on the remote server side in /etc/nagios/nrpe.cfg I added this
"command[check_mem]=/usr/lib64/nagios/plugins/check_mem -f -w 20 -c 10"
What do I need to do on the Nagios server side recognize check_mem?
Also on the nagios server side in the /usr/local/nagios/etc/servers/client.cfg I have entered this
define service {
use generic-service
host_name NS1
service_description Memory
check_command check_nrpe!check_mem
}
When I run the command "/usr/local/nagios/libexec/check_nrpe -H 172.x.x.x -c check_mem
" from my Nagios server I get this error message "NRPE: Command 'check_mem' not defined"
My Nagios server is able to monitor CPU, SSH,Total Processes, and Logged in users on my remote server.
I would like to monitor memory on my remote server and visually see it on my Nagios web interface. Currently on my Nagios server, the memory service is displaying "status critical with NRPE: command 'check_mem' not defined."
On my remote server (client), I have configured NRPE to monitor memory usage. I used " wget https://raw.githubusercontent.com/justi ... eck_mem.pl" and was able to download and install it successfully. I say successfully because I can run ./check_mem -f -w 20 -c 10 and the output displays this "OK - 78.5% (3076688 kB) free.|TOTAL=3921616KB;;;; USED=844928KB;3137292;3529454;; FREE=3076688KB;;;; CACHES=713696KB;;;;"
As a result, the command is working on the remote client side. In addition, on the remote server side in /etc/nagios/nrpe.cfg I added this
"command[check_mem]=/usr/lib64/nagios/plugins/check_mem -f -w 20 -c 10"
What do I need to do on the Nagios server side recognize check_mem?
Also on the nagios server side in the /usr/local/nagios/etc/servers/client.cfg I have entered this
define service {
use generic-service
host_name NS1
service_description Memory
check_command check_nrpe!check_mem
}
When I run the command "/usr/local/nagios/libexec/check_nrpe -H 172.x.x.x -c check_mem
" from my Nagios server I get this error message "NRPE: Command 'check_mem' not defined"
Re: Monitor Remote Server Memory Usage
On your Nagios server you need to define check_mem in your commands.cfg.
Here's mine defined.
Here's mine defined.
Code: Select all
# 'check_mem' command definition
define command{
command_name check_mem
command_line perl /usr/local/nagios/libexec/check_mem.pl -w $ARG1$ -c $ARG2$ -f
}
Nagios Core 4.1.1 running on Ubuntu 14.04
Re: Monitor Remote Server Memory Usage
I have to ask the obvious question: Did you restart npre/xinetd after you added the configuration changes to the nrpe.cfg file?
Former Nagios Employee.
me.
me.
Re: Monitor Remote Server Memory Usage
tgrtjake wrote:On your Nagios server you need to define check_mem in your commands.cfg.
Here's mine defined.Code: Select all
# 'check_mem' command definition define command{ command_name check_mem command_line perl /usr/local/nagios/libexec/check_mem.pl -w $ARG1$ -c $ARG2$ -f }
Re: Monitor Remote Server Memory Usage
tgrtjake wrote:On your Nagios server you need to define check_mem in your commands.cfg.
Here's mine defined.Code: Select all
# 'check_mem' command definition define command{ command_name check_mem command_line perl /usr/local/nagios/libexec/check_mem.pl -w $ARG1$ -c $ARG2$ -f }
-
ep7network
- Posts: 51
- Joined: Sun Dec 27, 2015 5:04 pm
Re: Monitor Remote Server Memory Usage
On my nagios web interface I can finally see memory status OK. My question is how is it working if i didn't add the command you mention in my commands.cfg?tgrtjake wrote:On your Nagios server you need to define check_mem in your commands.cfg.
Here's mine defined.Code: Select all
# 'check_mem' command definition define command{ command_name check_mem command_line perl /usr/local/nagios/libexec/check_mem.pl -w $ARG1$ -c $ARG2$ -f }
-
ep7network
- Posts: 51
- Joined: Sun Dec 27, 2015 5:04 pm
Re: Monitor Remote Server Memory Usage
The only changes I did wererkennedy wrote:What changes did you make?
1)Install this "wget https://raw.githubusercontent.com/justi ... eck_mem.pl" on remote server.
2) Then I was able to successfully run this command from remote server "./check_mem -f -w 20 -c 10 ".
3) On remote server side I then entered this file "/etc/nagios/nrpe.cfg " and then typed this "command[check_mem]=/usr/lib64/nagios/plugins/check_mem -f -w 20 -c 10" (I think this solved the issue)
4) On the nagios server side, I entered the config file to the client that is being monitored and entered this
define service {
use generic-service
host_name NS1
service_description Memory
check_command check_nrpe!check_mem
}
And rebooted both servers and it started working!
My issue is I never typed anything in the commands.cfg from the server side! I
Re: Monitor Remote Server Memory Usage
The script they were telling you to set up has nothing to do with NRPE. You wouldn't need that command definition to make it work via NRPE. To run a NRPE check, all of the configuration will need to be done on the server that is running NRPE. Adding the definition to nrpe.cfg in your case.ep7network wrote:My question is how is it working if i didn't add the command you mention in my commands.cfg?
Rebooting the server would have restart the nrpe daemon, which in this case was all you needed to do to get it to know how to do the check_mem command.
Former Nagios Employee.
me.
me.
-
ep7network
- Posts: 51
- Joined: Sun Dec 27, 2015 5:04 pm
Re: Monitor Remote Server Memory Usage
Thank you guys very much. You guys provide outstanding nagios IT support.hsmith wrote:The script they were telling you to set up has nothing to do with NRPE. You wouldn't need that command definition to make it work via NRPE. To run a NRPE check, all of the configuration will need to be done on the server that is running NRPE. Adding the definition to nrpe.cfg in your case.ep7network wrote:My question is how is it working if i didn't add the command you mention in my commands.cfg?
Rebooting the server would have restart the nrpe daemon, which in this case was all you needed to do to get it to know how to do the check_mem command.