check_procs problem

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.
AnotherNagiosUser
Posts: 19
Joined: Tue Feb 26, 2019 4:51 am

check_procs problem

Post 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?
00_kl250
Posts: 63
Joined: Tue Apr 16, 2013 7:26 am

Re: check_procs problem

Post 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.
AnotherNagiosUser
Posts: 19
Joined: Tue Feb 26, 2019 4:51 am

Re: check_procs problem

Post 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:
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: check_procs problem

Post by scottwilkerson »

postfix isn't a process, it's a service
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
AnotherNagiosUser
Posts: 19
Joined: Tue Feb 26, 2019 4:51 am

Re: check_procs problem

Post 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:
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: check_procs problem

Post 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
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
AnotherNagiosUser
Posts: 19
Joined: Tue Feb 26, 2019 4:51 am

Re: check_procs problem

Post 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.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: check_procs problem

Post by scottwilkerson »

try this

Code: Select all

check_command                 check_nrpe!check_procs -a '-c 1: -w 1: -C master'
then restart nagios
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
AnotherNagiosUser
Posts: 19
Joined: Tue Feb 26, 2019 4:51 am

Re: check_procs problem

Post 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.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: check_procs problem

Post 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$
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked