Skip to content

Commit

Permalink
naemon: add patch for host hard states
Browse files Browse the repository at this point in the history
  • Loading branch information
sni committed Sep 10, 2024
1 parent d980711 commit b9ef142
Showing 1 changed file with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
From 3ad1a5c7d30697c8dc14abd3423adcaccf8fdcf7 Mon Sep 17 00:00:00 2001
From: Sven Nierlein <[email protected]>
Date: Tue, 3 Sep 2024 15:26:01 +0200
Subject: [PATCH] fix host not being in hard state with max_check_attempts=1
(fixes #473)

a host should directly change into a hard state when max_check_attempts=1 is set and the host goes down.
---
src/naemon/checks_host.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/naemon/checks_host.c b/src/naemon/checks_host.c
index 7a6215c2..5c2588d7 100644
--- a/src/naemon/checks_host.c
+++ b/src/naemon/checks_host.c
@@ -830,7 +830,10 @@ static int process_host_check_result(host *hst, host *prev, int *alert_recorded)
if (hst->check_type == CHECK_TYPE_ACTIVE || passive_host_checks_are_soft == TRUE) {

/* set the state type */
- hst->state_type = SOFT_STATE;
+ if (hst->current_attempt == hst->max_attempts)
+ hst->state_type = HARD_STATE;
+ else
+ hst->state_type = SOFT_STATE;
}

/* by default, passive check results are treated as HARD states */

0 comments on commit b9ef142

Please sign in to comment.