Check_mem on localhost

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
Phrosgone
Posts: 1
Joined: Sat Dec 12, 2015 5:00 pm

Check_mem on localhost

Post 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?
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Check_mem on localhost

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked