Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dev.icinga.com #12156] Test the change with HARD OK transitions #4370

Closed
icinga-migration opened this issue Jul 15, 2016 · 2 comments
Closed
Labels
bug Something isn't working
Milestone

Comments

@icinga-migration
Copy link

This issue has been migrated from Redmine: https://dev.icinga.com/issues/12156

Created by mfriedrich on 2016-07-15 11:08:57 +00:00

Assignee: mfriedrich
Status: Closed (closed on 2016-08-04 10:06:23 +00:00)
Target Version: 2.5.0
Last Update: 2016-08-04 10:06:23 +00:00 (in Redmine)

Icinga Version: 2.4.10
Backport?: Not yet backported
Include in Changelog: 0

This patch always sets the state type to HARD when a check result with an OK state is received. It does not check whether a state change was performed or not (e.g. previously NOT-OK -> OK transition).

This could lead into unexpected behaviour with volatile notifications (GetStateType() is called and evaluated afterwards).

Requires tests before the 2.5 release.

michi@mbmif ~/coding/icinga/icinga2 (master) $ git show 8808e709c9f3e83f5dd9098f0282c6cafdb6b9ce
commit 8808e709c9f3e83f5dd9098f0282c6cafdb6b9ce
Author: Markus Frosch 
Date:   Tue May 31 17:03:49 2016 +0200

    Make change to OK always a hard state

    refs #11654

diff --git a/lib/icinga/checkable-check.cpp b/lib/icinga/checkable-check.cpp
index f912e82..fc5e88e 100644
--- a/lib/icinga/checkable-check.cpp
+++ b/lib/icinga/checkable-check.cpp
@@ -180,13 +180,10 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
        if (!old_cr) {
                SetStateType(StateTypeHard);
        } else if (IsStateOK(cr->GetState())) {
-               if (IsStateOK(old_state) && old_stateType == StateTypeSoft) {
-                       SetStateType(StateTypeHard); // SOFT OK -> HARD OK
-                       recovery = true;
-               }
+               SetStateType(StateTypeHard); // NOT-OK -> HARD OK

                if (!IsStateOK(old_state))
-                       recovery = true; // NOT OK -> SOFT/HARD OK
+                       recovery = true;

                ResetNotificationNumbers();
                SaveLastState(ServiceOK, Utility::GetTime());

Relations:

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2016-08-04 10:06:23 +00:00

  • Status changed from New to Closed
  • Assigned to set to mfriedrich
  • Done % changed from 0 to 100

Works for me in my notification tests.

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2016-08-23 12:37:07 +00:00

  • Relates set to 12517

@icinga-migration icinga-migration added bug Something isn't working libicinga labels Jan 17, 2017
@icinga-migration icinga-migration added this to the 2.5.0 milestone Jan 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant