Page 1 of 1

Passive checks with NRDP

Posted: Mon Jun 27, 2016 8:01 am
by peter19x
Hello,

I am trying to use passive check from my server and send it to the nagios core server.

My Passive check command that I send from the server is the below:

Code: Select all

Select all/home/nagiosscripts/send_nrdp.sh -u http://172.25.28.119/nrdp/ -t nb65fgtadI39 -H "sbc-siplab02" -s "dbstatus" -S 2 -o "DB status is DOWN"
And to make sure it is arriving on the nagios core I am getting the error below in the /usr/local/nagios/var/nagios.log

Code: Select all

Select all[1467022444] Error: Got check result for service 'dbstatus' on host 'sbc-siplab02'. Unable to find service
So I have added my host that is sending the passive checks along with the service dbstatus In a .cfg file as below:

Code: Select all

Select alldefine host{
        host_name               sbc-siplab02
        address                 172.25.25.11
        check_command           check-host-alive
        check_period            24x7
        check_interval          5
        retry_interval          1
        max_check_attempts      5
        contact_groups          admins
        notification_interval   *
        notification_period     workhours
        }

define service{
        host_name                       sbc-siplab02
        service_description           dbstatus
        check_period                    24x7
        max_check_attempts         5
        normal_check_interval       5
        retry_check_interval          1
        }
Pardon my question if it is too basic, but I am not sure what 'check_command' should be added in the service dbstatus or if there is something else for passive checks that should be added

and when I run
Code: Select all/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

I get the following error:
Error: Could not register service (config file '/usr/local/nagios/etc/objects/store.cfg', starting on line 33)

line 33 is the dbstatus service I have added.

Any idea what is missing in this scenario ?

Thanks,
Peter

Re: Passive checks with NRDP

Posted: Mon Jun 27, 2016 8:23 am
by eloyd
You should start by reading https://assets.nagios.com/downloads/nag ... hecks.html if you have not already.

You'll need to set accept_passive_service_checks directive to 1 in /usr/local/nagios/etc/nagios.cfg, and set the passive_checks_enabled directive in your host and/or service definitions to 1. Then, the check_command should probably set to "check_dummy!1!Passive check result not received" or something like that. Here's why:

When a check is defined as passive, Nagios does not control when it is executed and thus has no idea how long it will be before the next check comes in. So the "freshness_interval" defines how long Nagios will wait for a passive check result, and if it doesn't see one in that length of time, it will execute its local check_command. Mostly, you want to simply notify yourself that the passive check hasn't come in, which is why I recommend check_dummy as above.

Good luck!

Re: Passive checks with NRDP

Posted: Mon Jun 27, 2016 8:29 am
by eloyd
As a bonus, here's a copy of our NCPA passive check service template. Similar to what you're doing with NRDP, but NCPA is doing the scheduling and then sending the results back to our Nagios server via NRDP. The assumption here is that the passive checks are normally sent every 15 minutes, so if we don't have a check result within 2000 seconds (which is just over 33 minutes) then we get worried and execute our check_command.

Code: Select all

define service {
       name                                     NPCA Passive Service
       service_description                      NPCA Passive Service
       check_command                            check_dummy!1!WARNING: No data from passive check!!!!!!
       max_check_attempts                       5
       check_interval                           30
       retry_interval                           5
       active_checks_enabled                    0
       passive_checks_enabled                   1
       check_period                             24x7
       obsess_over_service                      0
       check_freshness                          1
       freshness_threshold                      2000
       notification_interval                    60
       first_notification_delay                 0
       notification_period                      24x7
       notifications_enabled                    0
       register                                 0
}

Re: Passive checks with NRDP

Posted: Mon Jun 27, 2016 9:52 am
by peter19x
Hello,

Thank again @eloyd for the reply.

I have read indeed the document and just double checked the parameter accept_passive_service_checks=1

I have also added the service and restarted nagios with no error as below:

Code: Select all

define service {
       name                                      dbstatus
       service_description                      dbstatus
       check_command                            check_dummy!1!WARNING: No data from passive check!!!!!!
       max_check_attempts                       5
       check_interval                           30
       retry_interval                           5
       active_checks_enabled                    0
       passive_checks_enabled                   1
       check_period                             24x7
       obsess_over_service                      0
       check_freshness                          1
       freshness_threshold                      20
       notification_interval                    60
       first_notification_delay                 0
       notification_period                      24x7
       notifications_enabled                    0
       register                                 0
}
and unfortunately still getting the same error when I send the passive check like the service I added doesn't exist:

Code: Select all

[1467038341] Error: Got check result for service 'dbstatus' on host 'sbc-siplab02'. Unable to find service
PS: didn't know if in the service definition the name is meant for hostname or service name, anyhow, tried both dbstatus and sbc-siplab02 with same result.

Best Regards,
Peter

Re: Passive checks with NRDP

Posted: Mon Jun 27, 2016 10:02 am
by peter19x
Stupid me. Forgot the to close the bracket in the command.cfg file when I added the check_dummy function.

It works perfectly now!:)

Thank you for helping me solve the issue since day one.

Best Regards,
Peter

Re: Passive checks with NRDP

Posted: Mon Jun 27, 2016 10:07 am
by eloyd
Typos suck. :-)

Glad I could help! Feel free to nominate me for an MVP award through the link in my signature if you think I've been especially helpful.

Re: Passive checks with NRDP

Posted: Mon Jun 27, 2016 1:32 pm
by mcapra
Closing this and marking as resolved