Page 1 of 1

Check_mem on localhost

Posted: Sat Dec 12, 2015 5:12 pm
by Phrosgone
Hi
I am quite new to Linux and especially on Nagios. However, I wanted to install the check_mem plugin to monitor memory usage on the localhost only. Therefore I did the following:

I copied the check_mem.sh into the libexec folder and have set the appropriate rights on the file (using CentOS 7 btw)

Afterwards I added the following to the command.cfg:

Code: Select all

define command{
command_name check_mem
command_line $USER1$/check_mem.sh -w 80 -c 90
}
In the file localhost.cfg I added the following:

Code: Select all

define service{
use local-service
host_name localhost
service_description check_mem
check_command check_mem.sh
}
If I run the pre-flight check, I get the following error: "Error: Service check command 'check_mem.sh' specified in service 'check_mem' for host 'localhost' not defined anywhere!"

What have I missed? In which file I have to define the service?

Re: Check_mem on localhost

Posted: Mon Dec 14, 2015 1:46 pm
by lmiltchev
In the service definition, you have:

Code: Select all

check_command check_mem.sh
but in the command definition, you have:

Code: Select all

command_name check_mem
Rename the command to "check_mem.sh", so that they match, restart nagios and try your check again.