I am trying to configure nagios to perform memory check on a ubuntu server. I already have the basic configuration but when a try to start nagios, the following error message is displayed:
Service check command 'check_mem' specified in service 'Current Memory Usage' for host 'xxxx' not defined anywhere!
Besides commands.cfg, is there any possible place to define the command to be executed?
Thanks in advance, Best regards!
most probably you want to use nagios nrpe server on monitored machine and define what plugin should execute this check.
btw maybe you should rather check swap usage?
Rui:
ok, that's much clearer. The answer is that NAGIOS can take any valid configuration statement in any of its configuration files, and there can be an unlimited number of these. I have a NAGIOS server with 136 config files; any of those could contain a command definition.
So if you have a running configuration that has it defined somewhere, but not in commands.cfg, then the bad news is it could be in any of its config files, and these can be anywhere.
If I wanted to find it, I'd look in nagios.cfg to see what directories the config files live in, then automate the process of finding it, perhaps with
and see what matches that finds.
I couldn't find a decent script for checking memory so I wrote the following. I use it with nrpe as suggested above.
Service definition on the server in the host config:
This needs to be defined in /etc/nagios/nrpe.cfg on the client, amended for the values you want to check for:
Example output:
The script:
The problem is nagios server can't find
check_nrpe_1arg
's define. There are somewhere else you can define commands, e.g nagios-pluginsHere, I solve the problem by define command in plugins
To use
check_nrpe
orcheck_nrpe_1arg
, you must make sure/usr/lib/nagios/plugins/check_nrpe
exist. In debian system, you can install packagenagios-nrpe-plugins
on the nagios server.