From 92becec37f63e32e0a6528a4f7399863b52a53c1 Mon Sep 17 00:00:00 2001 From: Yonas Habteab Date: Tue, 31 May 2022 16:41:40 +0200 Subject: [PATCH 1/2] IcingaDB: Add `_name` suffix to columns referring to name --- lib/icingadb/icingadb-objects.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/icingadb/icingadb-objects.cpp b/lib/icingadb/icingadb-objects.cpp index 4f0049d88..fdd199f1b 100644 --- a/lib/icingadb/icingadb-objects.cpp +++ b/lib/icingadb/icingadb-objects.cpp @@ -1226,7 +1226,7 @@ bool IcingaDB::PrepareObject(const ConfigObject::Ptr& object, Dictionary::Ptr& a if (ObjectsZone) { attributes->Set("zone_id", GetObjectIdentifier(ObjectsZone)); - attributes->Set("zone", ObjectsZone->GetName()); + attributes->Set("zone_name", ObjectsZone->GetName()); } if (type == Endpoint::TypeInstance) { @@ -1252,7 +1252,7 @@ bool IcingaDB::PrepareObject(const ConfigObject::Ptr& object, Dictionary::Ptr& a if (type == Host::TypeInstance || type == Service::TypeInstance) { Checkable::Ptr checkable = static_pointer_cast(object); - attributes->Set("checkcommand", checkable->GetCheckCommand()->GetName()); + attributes->Set("checkcommand_name", checkable->GetCheckCommand()->GetName()); attributes->Set("max_check_attempts", checkable->GetMaxCheckAttempts()); attributes->Set("check_timeout", checkable->GetCheckTimeout()); attributes->Set("check_interval", checkable->GetCheckInterval()); @@ -1274,19 +1274,19 @@ bool IcingaDB::PrepareObject(const ConfigObject::Ptr& object, Dictionary::Ptr& a Endpoint::Ptr commandEndpoint = checkable->GetCommandEndpoint(); if (commandEndpoint) { attributes->Set("command_endpoint_id", GetObjectIdentifier(commandEndpoint)); - attributes->Set("command_endpoint", commandEndpoint->GetName()); + attributes->Set("command_endpoint_name", commandEndpoint->GetName()); } TimePeriod::Ptr timePeriod = checkable->GetCheckPeriod(); if (timePeriod) { attributes->Set("check_timeperiod_id", GetObjectIdentifier(timePeriod)); - attributes->Set("check_timeperiod", timePeriod->GetName()); + attributes->Set("check_timeperiod_name", timePeriod->GetName()); } EventCommand::Ptr eventCommand = checkable->GetEventCommand(); if (eventCommand) { attributes->Set("eventcommand_id", GetObjectIdentifier(eventCommand)); - attributes->Set("eventcommand", eventCommand->GetName()); + attributes->Set("eventcommand_name", eventCommand->GetName()); } String actionUrl = checkable->GetActionUrl(); From 45f536ca0686649c2ae982ef8733fc8921aa5e9d Mon Sep 17 00:00:00 2001 From: Yonas Habteab Date: Tue, 7 Jun 2022 12:55:12 +0200 Subject: [PATCH 2/2] Bump Redis schema version to 5 --- lib/icingadb/icingadb-objects.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/icingadb/icingadb-objects.cpp b/lib/icingadb/icingadb-objects.cpp index fdd199f1b..ac876b61b 100644 --- a/lib/icingadb/icingadb-objects.cpp +++ b/lib/icingadb/icingadb-objects.cpp @@ -166,7 +166,7 @@ void IcingaDB::ConfigStaticInitialize() void IcingaDB::UpdateAllConfigObjects() { m_Rcon->Sync(); - m_Rcon->FireAndForgetQuery({"XADD", "icinga:schema", "MAXLEN", "1", "*", "version", "4"}, Prio::Heartbeat); + m_Rcon->FireAndForgetQuery({"XADD", "icinga:schema", "MAXLEN", "1", "*", "version", "5"}, Prio::Heartbeat); Log(LogInformation, "IcingaDB") << "Starting initial config/status dump"; double startTime = Utility::GetTime();