Notification#BeginExecuteNotification(): track state change notifications

This commit is contained in:
Alexander A. Klimov 2023-06-14 12:48:22 +02:00
parent 2d167ccd28
commit b25ba7a316
2 changed files with 14 additions and 0 deletions

View File

@ -452,6 +452,16 @@ void Notification::BeginExecuteNotification(NotificationType type, const CheckRe
/* collect all notified users */
allNotifiedUsers.insert(user);
switch (type) {
case NotificationProblem:
case NotificationRecovery: {
auto [host, service] = GetHostService(checkable);
GetLastNotifiedStatePerUser()->Set(userName, service ? service->GetState() : host->GetState());
}
default:
;
}
/* store all notified users for later recovery checks */
if (type == NotificationProblem && !notifiedProblemUsers->Contains(userName))
notifiedProblemUsers->Add(userName);

View File

@ -90,6 +90,10 @@ class Notification : CustomVarObject < NotificationNameComposer
default {{{ return 0; }}}
};
[state, no_user_view, no_user_modify] Dictionary::Ptr last_notified_state_per_user {
default {{{ return new Dictionary(); }}}
};
[config, navigation] name(Endpoint) command_endpoint (CommandEndpointRaw) {
navigate {{{
return Endpoint::GetByName(GetCommandEndpointRaw());