Nagios 4.0.8 passive checks

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
sspaise
Posts: 14
Joined: Wed Mar 25, 2015 11:28 pm

Nagios 4.0.8 passive checks

Post by sspaise »

Hi Everybody,

I have just recently set up a new Nagios system using 4.0.8 with passive service checking only. This is working as expected, passive alerts are being received etc, but I appear to be having a problem with stale results.

I would like to set up the system so that when a check goes stale, a command is run to mark the service with a WARNING state, and the message "no recent passive updates received". Below I have attempted to explain the issue in more detail, and provided all the necessary configuration:

a) After three minutes (for this particular check) the results turn stale due to receiving no passive update:

Code: Select all

[1442935266] Warning: The results of service 'System-Memory' on host 'testunit' are stale by 0d 0h 0m 34s (threshold=0d 0h 3m 20s).  I'm forcing an immediate check of the service.
Nothing happens after this. It is supposed to be passed to a defined command called "no_recent_passive" which uses the check_dummy plugin as shown below:

Code: Select all

# no_recent_passive definition
define command {
        command_name no_recent_passive
        command_line /usr/local/nagios/libexec/check_dummy 1 "There have been no recent passive updates"
}
It would appear that this command is never called. The stale result message is displayed again three minutes later instead of marking the service as a WARNING.

Service definition:

Code: Select all

define service{
        name                            passive-service ; The 'name' of this service template
        active_checks_enabled           1       ; Active service checks are enabled
        passive_checks_enabled          1       ; Passive service checks are enabled/accepted
        parallelize_check               1       ; Active service checks should be parallelized (disabling this can lead to major performance problems)
        obsess_over_service             1       ; We should obsess over this service (if necessary)
        check_freshness                 1       ; check service 'freshness'
        freshness_threshold             600     ;  complain if the data recieved is more than 10 mins old.
        check_command                   no_recent_passive   ; Report staleness
        notifications_enabled           1       ; Service notifications are enabled
        event_handler_enabled           1       ; Service event handler is enabled
        flap_detection_enabled          0       ; Flap detection is enabled .... disabled
        process_perf_data               1       ; Process performance data
        retain_status_information       1       ; Retain status information across program restarts
        retain_nonstatus_information    1       ; Retain non-status information across program restarts
        notification_interval           0       ; Only send notifications on status change by default.
;       is_volatile                     0
        check_period                    24x7
        check_interval                  0
        retry_check_interval            1
        max_check_attempts              1
        notification_period             24x7
        notification_options            w,u,c,r
        contact_groups                  admins
        register                        0       ; Don't register this template
        }
Enabled in main nagios.conf file:
check_service_freshness=1

Is anyone able to point me in the right direction as to why the "check_command" is not called when a result turns stale?

Many thanks,
Sam
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Nagios 4.0.8 passive checks

Post by lmiltchev »

You will need to remove:

Code: Select all

register                        0
if this is a "regular" service definition. The way you have it now, it is a "template".
Be sure to check out our Knowledgebase for helpful articles and solutions!
sspaise
Posts: 14
Joined: Wed Mar 25, 2015 11:28 pm

Re: Nagios 4.0.8 passive checks

Post by sspaise »

Hi Imiltchev,

Thanks for your reply. I would actually like to use this as a template for other hosts rather than a regular service definition.

The template in use was pulled from our previous nagios server (which I had no part in setting up), where the register statement is still present in the configuration, and the check_command is working as expected for passive updates.

Is there a way to template this and still use the "check_command"?

Thanks,
Sam
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Nagios 4.0.8 passive checks

Post by ssax »

Yes, you can specify the check_command in the template and then if you want to override the check_command for one of them you would just define it locally on that service.
sspaise
Posts: 14
Joined: Wed Mar 25, 2015 11:28 pm

Re: Nagios 4.0.8 passive checks

Post by sspaise »

Hi ssax,

The check_command is defined in the template, and I've actually tried defining it on the service also, but it still never gets called.

I have a feeling something else is in play here, because no matter how its configured the check_command is never called on a stale state.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Nagios 4.0.8 passive checks

Post by scottwilkerson »

make sure your nagios.cfg has

Code: Select all

check_service_freshness=1
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
sspaise
Posts: 14
Joined: Wed Mar 25, 2015 11:28 pm

Re: Nagios 4.0.8 passive checks

Post by sspaise »

HI Scott,

I can confirm, as per my original posting that this option is already enabled in the configuration:

[root@invnag nagios]# grep "check_service_freshness" nagios.cfg
check_service_freshness=1
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Nagios 4.0.8 passive checks

Post by tmcdonald »

In your nagios.cfg, set debug_level=-1 and restart nagios. Wait long enough for a check to go stale then stop nagios and set debug_level=0 and start back up, then post/PM the nagios.debug file (wherever you have it defined).
Former Nagios employee
sspaise
Posts: 14
Joined: Wed Mar 25, 2015 11:28 pm

Re: Nagios 4.0.8 passive checks

Post by sspaise »

Hi All,

Just wanted to say thanks for your input, I've now managed to resolve this.

My NSCA daemon was throwing a wobbly and not processing commands correctly. After a reinstall commands started working as expected for passive checks.

Cheers,
Sam
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Nagios 4.0.8 passive checks

Post by hsmith »

Glad to hear this one is working for you now. I'll go ahead and close the thread up and mark it resolved.
Former Nagios Employee.
me.
Locked