Page 1 of 2

check_procs problem

Posted: Tue Mar 26, 2019 6:47 am
by AnotherNagiosUser
I'm having some trouble with check_procs. I am trying to use it to monitor postfix, so if the service is stopped it will report it.

When postfix is stopped thugh, it doesn't go to critical it reports this back
PROCS OK: 0 processes with args 'postfix', STATE = 10
I've uncommented the check_nrpe command in the nrpe.cfg config on the remote server

Code: Select all

command[check_procs]=/usr/local/nagios/libexec/check_procs -w $ARG1$ -c $ARG2$ $
And I've added this into the server's cfg file

Code: Select all

define service {
       use                           generic-service
       host_name                     SERVER2
       service_description           Check Postfix Service
       check_command                 check_nrpe!check_procs -a '-w 10 -c 20 -a postfix'
I think I'm using the right command, or do I need to be using something else?

Re: check_procs problem

Posted: Tue Mar 26, 2019 7:27 am
by 00_kl250
I believe that it's because of your check command:

check_command check_nrpe!check_procs -a '-w 10 -c 20 -a postfix'

if you change -w 10 to -w 0 and then run your test, what happens?

If i'm reading what you have correctly, you won't get a warning notification unless 10 "postfix" processes are running and then you won't get a critical notification until 20 "postfix" processes are running.

Edit:

Actually now that I think of it:

1). I think you have to use the -C flag for the process name
2). -c 1: -w 3: -C [process name], in this example you will get a critical alert if it can't find one process that matches and warn if it can't find atleast three.

Re: check_procs problem

Posted: Tue Mar 26, 2019 8:11 am
by AnotherNagiosUser
00_kl250 wrote:I believe that it's because of your check command:

check_command check_nrpe!check_procs -a '-w 10 -c 20 -a postfix'

if you change -w 10 to -w 0 and then run your test, what happens?

If i'm reading what you have correctly, you won't get a warning notification unless 10 "postfix" processes are running and then you won't get a critical notification until 20 "postfix" processes are running.

Edit:

Actually now that I think of it:

1). I think you have to use the -C flag for the process name
2). -c 1: -w 3: -C [process name], in this example you will get a critical alert if it can't find one process that matches and warn if it can't find atleast three.
Thanks

I've changed it to

Code: Select all

 check_command                 check_nrpe!check_procs -a '-c 1: -w 3: -C  
I get a warning now, but it's not at critical
PROCS WARNING: 0 processes with command name 'postfix', STATE = 1:

Re: check_procs problem

Posted: Tue Mar 26, 2019 8:18 am
by scottwilkerson
postfix isn't a process, it's a service

Re: check_procs problem

Posted: Tue Mar 26, 2019 8:30 am
by AnotherNagiosUser
scottwilkerson wrote:postfix isn't a process, it's a service
I think when I was trying to figure out how to do this, I thought i could use check_procs, so it could look at the processes and see if postfix was running. :oops:

Re: check_procs problem

Posted: Tue Mar 26, 2019 8:35 am
by scottwilkerson
You may be able to do that by looking for a process that postfix starts, on my system I believe it is called "master"

Code: Select all

ps -ef|grep postfix |grep -v grep

Re: check_procs problem

Posted: Tue Mar 26, 2019 9:30 am
by AnotherNagiosUser
scottwilkerson wrote:You may be able to do that by looking for a process that postfix starts, on my system I believe it is called "master"

Code: Select all

ps -ef|grep postfix |grep -v grep
Yes, it is master.

It's still showing this
PROCS WARNING: 0 processes with command name 'postfix', STATE = 1:
Shows that even when it's on now.

Re: check_procs problem

Posted: Tue Mar 26, 2019 9:38 am
by scottwilkerson
try this

Code: Select all

check_command                 check_nrpe!check_procs -a '-c 1: -w 1: -C master'
then restart nagios

Re: check_procs problem

Posted: Tue Mar 26, 2019 10:03 am
by AnotherNagiosUser
scottwilkerson wrote:try this

Code: Select all

check_command                 check_nrpe!check_procs -a '-c 1: -w 1: -C master'
then restart nagios
Changed it, and it's still showing the same message.

Re: check_procs problem

Posted: Tue Mar 26, 2019 10:08 am
by scottwilkerson
I just re-looked at your command on NRPE and it would need to be the following and then restart NRPE

Code: Select all

command[check_procs]=/usr/local/nagios/libexec/check_procs $ARG1$