From 76d5915b3fcdf4b6c20b348eae6116b16a06a114 Mon Sep 17 00:00:00 2001 From: Yonas Habteab Date: Tue, 20 May 2025 17:20:56 +0200 Subject: [PATCH] IcingaDB: Set `notification_histor#type` to its string representation So that Icinga DB (Go) daemon doesn't have to make the mappings again. --- lib/icingadb/icingadb-objects.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/icingadb/icingadb-objects.cpp b/lib/icingadb/icingadb-objects.cpp index a842dd7cb..ca29dc38e 100644 --- a/lib/icingadb/icingadb-objects.cpp +++ b/lib/icingadb/icingadb-objects.cpp @@ -2047,8 +2047,9 @@ void IcingaDB::SendSentNotification( auto usersAmount (users.size()); auto sendTs (TimestampToMilliseconds(sendTime)); + auto notificationTypeStr(GetNotificationTypeByEnum(type)); Array::Ptr rawId = new Array({m_EnvironmentId, notification->GetName()}); - rawId->Add(GetNotificationTypeByEnum(type)); + rawId->Add(notificationTypeStr); rawId->Add(sendTs); auto notificationHistoryId (HashValue(rawId)); @@ -2059,7 +2060,7 @@ void IcingaDB::SendSentNotification( "environment_id", m_EnvironmentId, "notification_id", GetObjectIdentifier(notification), "host_id", GetObjectIdentifier(host), - "type", Convert::ToString(type), + "type", notificationTypeStr, "state", Convert::ToString(cr ? service ? Convert::ToLong(cr->GetState()) : Convert::ToLong(Host::CalculateState(cr->GetState())) : 99), "previous_hard_state", Convert::ToString(cr ? service ? Convert::ToLong(cr->GetPreviousHardState()) : Convert::ToLong(Host::CalculateState(cr->GetPreviousHardState())) : 99), "author", Utility::ValidateUTF8(author),