Problem using check_procs with multiple commands

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
humanbieng2020
Posts: 3
Joined: Sat Jun 29, 2019 9:48 am

Problem using check_procs with multiple commands

Post by humanbieng2020 »

Hello there
I am using "check_procs" command to check for "crond" service
The check command was working very good for one service but once i added two additional services to be checked "mongod" & "node" i found problems
The problem is that in nagios web panel i found that "crond" service check have "mongod" check instead of "crond" & also "node" check shows checking another service
There are confilicting in check commands using "check_procs" command
Also if i stopped "crond" service i didnt found any notification about that "crond" service is down
Here are my configurations

Code: Select all

# nrpe.cfg 
command[check_procs]=/usr/local/nagios/libexec/check_procs -C mongod -c 1:100
command[check_procs]=/usr/local/nagios/libexec/check_procs -C crond -c 1:100
command[check_procs]=/usr/local/nagios/libexec/check_procs -C node -s '/path/to/server.js'


# services check 
define service{
host_name                 host1,host2,host3
service_description       Crond Monitoring
check_command             check_nrpe!check_procs
check_interval            3
check_period              24x7
retry_interval            3
max_check_attempts        3
notification_interval     30
notification_period       24x7
notification_options      w,c,u,r
contact_groups            admins
}

define service{
host_name                 host1,host2,host3
service_description       MongoDB Monitoring
check_command             check_nrpe!check_procs
check_interval            3
check_period              24x7
retry_interval            3
max_check_attempts        3
notification_interval     30
notification_period       24x7
notification_options      w,c,u,r
contact_groups            admins
}

define service{
host_name                 host1,host2,host3
service_description       NodeJS Monitoring
check_command             check_nrpe!check_procs
check_interval            3
check_period              24x7
retry_interval            3
max_check_attempts        3
notification_interval     30
notification_period       24x7
notification_options      w,c,u,r
contact_groups            admins
}


# commands
define command{
command_name    check_local_procs
command_line    $USER1$/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$
}

define command{
command_name    check_multiple_procs
command_line    $USER1$/check_multiprocs -w $ARG1$ -c $ARG2$ -s $ARG3$
}

BTW : i have also tried "check_multiprocs" command but it gave me the same issue, if one service is down nothing will happened !
What is the problem ? is it with my configuration ?? i spend more than 3 days in this issue !!
Any help will be appreciated
Thanks in advance
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Problem using check_procs with multiple commands

Post by scottwilkerson »

Having this in the nrpe.cfg is the problem

Code: Select all

# nrpe.cfg
command[check_procs]=/usr/local/nagios/libexec/check_procs -C mongod -c 1:100
command[check_procs]=/usr/local/nagios/libexec/check_procs -C crond -c 1:100
command[check_procs]=/usr/local/nagios/libexec/check_procs -C node -s '/path/to/server.js'
All 3 of these have a NRPE command name of check_procs

I would suggest changing these to something like

Code: Select all

# nrpe.cfg
command[check_mongod_procs]=/usr/local/nagios/libexec/check_procs -C mongod -c 1:100
command[check_crond_procs]=/usr/local/nagios/libexec/check_procs -C crond -c 1:100
command[check_node_procs]=/usr/local/nagios/libexec/check_procs -C node -s '/path/to/server.js'
Restart nrpe.

Then adjust your services like so

Code: Select all

# services check
define service{
host_name                 host1,host2,host3
service_description       Crond Monitoring
check_command             check_nrpe!check_crond_procs
check_interval            3
check_period              24x7
retry_interval            3
max_check_attempts        3
notification_interval     30
notification_period       24x7
notification_options      w,c,u,r
contact_groups            admins
}

define service{
host_name                 host1,host2,host3
service_description       MongoDB Monitoring
check_command             check_nrpe!check_mongod_procs
check_interval            3
check_period              24x7
retry_interval            3
max_check_attempts        3
notification_interval     30
notification_period       24x7
notification_options      w,c,u,r
contact_groups            admins
}

define service{
host_name                 host1,host2,host3
service_description       NodeJS Monitoring
check_command             check_nrpe!check_node_procs
check_interval            3
check_period              24x7
retry_interval            3
max_check_attempts        3
notification_interval     30
notification_period       24x7
notification_options      w,c,u,r
contact_groups            admins
}
These are all nrpe checks and use check_nrpe command, so the following are not used for these checks

Code: Select all

# commands
define command{
command_name    check_local_procs
command_line    $USER1$/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$
}

define command{
command_name    check_multiple_procs
command_line    $USER1$/check_multiprocs -w $ARG1$ -c $ARG2$ -s $ARG3$
}
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
humanbieng2020
Posts: 3
Joined: Sat Jun 29, 2019 9:48 am

Re: Problem using check_procs with multiple commands

Post by humanbieng2020 »

Thank you so much
It is working now
Please & kindly accept my best regards,,
humanbieng2020
Posts: 3
Joined: Sat Jun 29, 2019 9:48 am

Re: Problem using check_procs with multiple commands

Post by humanbieng2020 »

scottwilkerson wrote:Having this in the nrpe.cfg is the problem

Code: Select all

# nrpe.cfg
command[check_procs]=/usr/local/nagios/libexec/check_procs -C mongod -c 1:100
command[check_procs]=/usr/local/nagios/libexec/check_procs -C crond -c 1:100
command[check_procs]=/usr/local/nagios/libexec/check_procs -C node -s '/path/to/server.js'
All 3 of these have a NRPE command name of check_procs

I would suggest changing these to something like

Code: Select all

# nrpe.cfg
command[check_mongod_procs]=/usr/local/nagios/libexec/check_procs -C mongod -c 1:100
command[check_crond_procs]=/usr/local/nagios/libexec/check_procs -C crond -c 1:100
command[check_node_procs]=/usr/local/nagios/libexec/check_procs -C node -s '/path/to/server.js'
Restart nrpe.

Then adjust your services like so

Code: Select all

# services check
define service{
host_name                 host1,host2,host3
service_description       Crond Monitoring
check_command             check_nrpe!check_crond_procs
check_interval            3
check_period              24x7
retry_interval            3
max_check_attempts        3
notification_interval     30
notification_period       24x7
notification_options      w,c,u,r
contact_groups            admins
}

define service{
host_name                 host1,host2,host3
service_description       MongoDB Monitoring
check_command             check_nrpe!check_mongod_procs
check_interval            3
check_period              24x7
retry_interval            3
max_check_attempts        3
notification_interval     30
notification_period       24x7
notification_options      w,c,u,r
contact_groups            admins
}

define service{
host_name                 host1,host2,host3
service_description       NodeJS Monitoring
check_command             check_nrpe!check_node_procs
check_interval            3
check_period              24x7
retry_interval            3
max_check_attempts        3
notification_interval     30
notification_period       24x7
notification_options      w,c,u,r
contact_groups            admins
}
These are all nrpe checks and use check_nrpe command, so the following are not used for these checks

Code: Select all

# commands
define command{
command_name    check_local_procs
command_line    $USER1$/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$
}

define command{
command_name    check_multiple_procs
command_line    $USER1$/check_multiprocs -w $ARG1$ -c $ARG2$ -s $ARG3$
}
Thank you so much
It is working now
Please & kindly accept my best regards,,
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Problem using check_procs with multiple commands

Post by scottwilkerson »

humanbieng2020 wrote:Thank you so much
It is working now
Please & kindly accept my best regards,,
Great!

Locking
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked