Nagioc Core wrong returns $HOSTATTEMPT$.

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
GemiX
Posts: 2
Joined: Thu Jun 03, 2021 6:39 am

Nagioc Core wrong returns $HOSTATTEMPT$.

Post by GemiX »

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$.

Post by GemiX »

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.
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Nagioc Core wrong returns $HOSTATTEMPT$.

Post by mcapra »

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/
Locked