Page 1 of 1

Problem using check_procs with multiple commands

Posted: Sat Jun 29, 2019 10:07 am
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

Re: Problem using check_procs with multiple commands

Posted: Mon Jul 01, 2019 2:35 pm
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$
}

Re: Problem using check_procs with multiple commands

Posted: Mon Jul 01, 2019 9:47 pm
by humanbieng2020
Thank you so much
It is working now
Please & kindly accept my best regards,,

Re: Problem using check_procs with multiple commands

Posted: Mon Jul 01, 2019 9:48 pm
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,,

Re: Problem using check_procs with multiple commands

Posted: Tue Jul 02, 2019 7:08 am
by scottwilkerson
humanbieng2020 wrote:Thank you so much
It is working now
Please & kindly accept my best regards,,
Great!

Locking