Reputation: 53
I'm begginer with Nagios and i'm trying to monitor if a specific process on my unix machine is up or not. Server and client are on the same machine : Trying to monitor that machine from a Nagios runing on it. I've installed Nagios Core 4, nrpe and it's plugins. After looking on the web, I found an answer of how to monitor process using check_procs plugin (up or down) and that's what I actually have in my files :
1- in /etc/nagios/nrpe.cfg
server_address=127.0.0.1
command[check_service]=/usr/lib/nagios/plugins/check_procs -c 1: -C $ARG1$
2- I created a file called "ubunutu_host.cfg" in /usr/local/nagios/etc/servers/ :
# Ubuntu Host configuration file
define host {
use linux-server
host_name ubuntu_host
alias Ubuntu Host
address 127.0.0.1
register 1
}
define service {
host_name ubuntu_host
service_description check_apache2
check_command check_service!apache2
max_check_attempts 2
check_interval 2
retry_interval 2
check_period 24x7
check_freshness 1
contact_groups admins
notification_interval 2
notification_period 24x7
notifications_enabled 1
register 1
}
3- In /etc/nagios-plugins/configp/rocs.cfg :
define command{
command_name check_service
command_line /usr/lib/nagios/plugins/check_procs -c 1: -C ‘$ARG1$’
}
My probelm is : when runing this command :
/usr/lib/nagios/plugins/check_procs -c 1: -C apache2
that's what I'm having as a result
PROCS OK: 7 processes with command name 'apache2' | procs=7;;1:;0;
BUT In Nagios, below what I'm having (apache2 is always critical) : Problem proc apache2 is always shown critical
Upvotes: 0
Views: 746
Reputation: 605
First of all, NRPE is used to make and receive remote plugin calls. You don't specify which server you are modifying /etc/nagios/nrpe.cfg
on, but your check command is /usr/lib/nagios/plugins/check_procs
which means that Nagios is running this plugin locally, and perhaps that is what you want, I don't know, but in that case there is no point in involving NRPE at all.
Since you mention that you get the output you want when "running" the command (you don't specify as what user):
/usr/lib/nagios/plugins/check_procs -c 1: -C apache2
I'm guessing that the user that you are running this as actually can see your apache2
processes, while the user running the actual Nagios check cannot. Try using su
to change into your Nagios user and see if there's a difference in output.
Upvotes: 0