Nagioc Core wrong returns $HOSTATTEMPT$.

Engage with the community of users including those using the open source solutions.
Includes Nagios Core, Plugins, and NCPA

Nagioc Core wrong returns $HOSTATTEMPT$.

Postby GemiX » Thu Jun 03, 2021 7:02 am

Hello. I use $HOSTATTEMPT$ macro in my event handler. But this parameter not work when my host returns from soft DOWN state to soft UP state.
My situation(max_check_attempts value of 3):

Time=====Check #======State=====State type=====$HOSTATTEMPT$
= 0 ======== 1 ========= UP ======= HARD ========== 1
= 1 ======== 1 ======= DOWN ====== SOFT ========== 1
= 2 ======== 2 ========= UP ======= SOFT ========== 1

Why when the host is checked a second time in the SOFT mode $HOSTATTEMPT$ returns 1 but it should be 2?
GemiX
 
Posts: 2
Joined: Thu Jun 03, 2021 6:39 am

Re: Nagioc Core wrong returns $HOSTATTEMPT$.

Postby GemiX » Wed Jun 09, 2021 3:24 am

How i can contact with devs about this problem?
I think $HOSTATTEMPT$ have a bug, because $SERVICEATTEMPT$ macros work correctly and return 2 when service is obtain OK status from 2 attempts.
I tested this with nagios 4.4.3 and 4.4.6.
GemiX
 
Posts: 2
Joined: Thu Jun 03, 2021 6:39 am

Re: Nagioc Core wrong returns $HOSTATTEMPT$.

Postby mcapra » Wed Jun 09, 2021 12:39 pm

What exactly is your event handler trying to do?

GemiX wrote:How i can contact with devs about this problem?


GitHub issues are the best way to report bugs:
https://github.com/NagiosEnterprises/nagioscore/issues

GemiX wrote:Why when the host is checked a second time in the SOFT mode $HOSTATTEMPT$ returns 1 but it should be 2?


Not sure -- the state types documentation indicates that the check#, which I think is meant to map to $HOSTATTEMPT$, should be 2 in this scenarion:
https://assets.nagios.com/downloads/nag ... types.html

I'm specifically referring to the last 3 rows in the table, where instead of SOFT DOWN we're seeing a SOFT UNKNOWN (should have the same effect):
Code: Select all
6   1   OK   HARD   Yes   Service experiences a HARD recovery. Event handlers execute and a recovery notification is sent out.
7   1   OK   HARD   No   Service is still OK.
8   1   UNKNOWN   SOFT   Yes   Service is detected as changing to a SOFT non-OK state. Event handlers execute.
9   2   OK   SOFT   Yes   Service experiences a SOFT recovery. Event handlers execute, but notification are not sent, as this wasn't a "real" problem. State type is set HARD and check # is reset to 1 immediately after this happens.
10   1   OK   HARD   No   Service stabilizes in an OK state.


I'm not sure if hosts are meant to have a different concept of check# than services -- that's not really addressed in the documentation.
Former Nagios employee
https://www.mcapra.com/
User avatar
mcapra
 
Posts: 3676
Joined: Thu May 05, 2016 3:54 pm


Return to Community Support

Who is online

Users browsing this forum: Fess [Nagios Bot], Google [Bot] and 19 guests