You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 15, 2019. It is now read-only.
[dev.icinga.com #1331] freshness_threshold problem in host checks by using check_interval in HARD or OK state, else retry_interval (like service checks)
#592
Created by mfriedrich on 2011-03-22 22:18:18 +00:00
Assignee: mfriedrich
Status: Resolved (closed on 2011-06-15 16:57:49 +00:00)
Target Version: 1.5
Last Update: 2011-06-15 16:57:49 +00:00 (in Redmine)
We realised that the freshness_threshold does not use the retry_interval in host checks, when freshness_threshold=0 and our colletor goes down. It always uses the check_interval. So, one host can take a long time to have your state change to HARD.
On the other hand, the service checks works as expected, because it uses the retry_interval, when the state type = HARD or current state = OK, and it uses check_interval on other cases.
We can see this clearly when we look inside the base/checks.c source code:
[...]
/* tests whether or not a service's check results are fresh */
int is_service_result_fresh(service *temp_service, time_t current_time,
int log_this){
[...]
/* use user-supplied freshness threshold or auto-calculate a
freshness threshold to use? */
if(temp_service->freshness_threshold==0){
if(temp_service->state_type==HARD_STATE || temp_service->current_state==STATE_OK)
freshness_threshold=(temp_service->check_interval*interval_length)+temp_service->latency+additional_freshness_latency;
else
freshness_threshold=(temp_service->retry_interval*interval_length)+temp_service->latency+additional_freshness_latency;
}
else
freshness_threshold=temp_service->freshness_threshold;
[...]
/* checks to see if a hosts's check results are fresh */
int is_host_result_fresh(host *temp_host, time_t current_time, int
log_this){
[...]
/* use user-supplied freshness threshold or auto-calculate a
freshness threshold to use? */
if(temp_host->freshness_threshold==0)
freshness_threshold=(temp_host->check_interval*interval_length)+temp_host->latency+additional_freshness_latency;
else
freshness_threshold=temp_host->freshness_threshold;
[...]
I change the lines in the checks.c as below:
========================================================
FROM: Lines 2439 - 2440
if(temp_host->freshness_threshold==0)
freshness_threshold=(temp_host->check_interval*interval_length)+temp_host->latency+additional_freshness_latency;
TO:
if(temp_host->freshness_threshold==0){
if(temp_host->state_type==HARD_STATE || temp_host->current_state==STATE_OK)
freshness_threshold=(temp_host->check_interval*interval_length)+temp_host->latency+additional_freshness_latency;
else
freshness_threshold=(temp_host->retry_interval*interval_length)+temp_host->latency+additional_freshness_latency;
}
========================================================
It is working well, as expected. My retry interval is 1 minute and hosts are taking about 2 minutes to change SOFT states.
I´m sending attached the diff file between the original checks.c file and the modified checks.c file.
core: fix freshness_threshold problem in host checks by using check_interval in HARD or OK state, else retry_interval (like service checks) #1331
fixes #1331
core: fix freshness_threshold problem in host checks by using check_interval in HARD or OK state, else retry_interval (like service checks) #1331
fixes #1331
The text was updated successfully, but these errors were encountered:
Updated by mfriedrich on 2011-05-11 11:41:00 +00:00
Target Version set to 1.5
From 29232a3950bb84a3ca3fab653a07386aab3a22f7 Mon Sep 17 00:00:00 2001
From: Andreas Ericsson
Date: Tue, 10 May 2011 14:48:49 +0000
Subject: [PATCH] Use retry_interval for host freshness (re)checking
Previously the normal check_interval was used regardless of the
state of the host. This contradicted the documented behaviour
and the behaviour of services, so fix hosts to work as people
expect them to.
Updated by mfriedrich on 2011-06-15 16:00:43 +00:00
Subject changed from _freshness_threshold problem in host checks _ to freshness_threshold problem in host checks by using check_interval in HARD or OK state, else retry_interval (like service checks)
This issue has been migrated from Redmine: https://dev.icinga.com/issues/1331
Created by mfriedrich on 2011-03-22 22:18:18 +00:00
Assignee: mfriedrich
Status: Resolved (closed on 2011-06-15 16:57:49 +00:00)
Target Version: 1.5
Last Update: 2011-06-15 16:57:49 +00:00 (in Redmine)
http://tracker.nagios.org/view.php?id=184
Attachments
Changesets
2011-06-15 16:00:56 +00:00 by mfriedrich 33ab149
2011-06-20 17:06:48 +00:00 by mfriedrich 0e4605c
The text was updated successfully, but these errors were encountered: