Skip to content

Commit

Permalink
Merge pull request #7050 from Icinga/feature/previous-state-change
Browse files Browse the repository at this point in the history
Implement previous_state_change
  • Loading branch information
Michael Friedrich authored Apr 17, 2019
2 parents 3665430 + 9303070 commit 02db12a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/icinga/checkable-check.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,9 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
else
stateChange = (Host::CalculateState(old_state) != Host::CalculateState(new_state));

/* Store the current last state change for the next iteration. */
SetPreviousStateChange(GetLastStateChange());

if (stateChange) {
SetLastStateChange(now);

Expand Down
3 changes: 3 additions & 0 deletions lib/icinga/checkable.ti
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ abstract class Checkable : CustomVarObject
};
[state] Timestamp last_state_unreachable;

[state] Timestamp previous_state_change {
default {{{ return Application::GetStartTime(); }}}
};
[no_storage] int severity {
get;
};
Expand Down

0 comments on commit 02db12a

Please sign in to comment.