diff --git a/lib/icinga/checkable.cpp b/lib/icinga/checkable.cpp index c4265d05f..55bbfeb16 100644 --- a/lib/icinga/checkable.cpp +++ b/lib/icinga/checkable.cpp @@ -130,6 +130,9 @@ void Checkable::AcknowledgeProblem(const String& author, const String& comment, if (notify && !IsPaused()) OnNotificationsRequested(this, NotificationAcknowledgement, GetLastCheckResult(), author, comment, nullptr); + Log(LogInformation, "Checkable") + << "Acknowledgement set for checkable '" << GetName() << "'."; + OnAcknowledgementSet(this, author, comment, type, notify, persistent, expiry, origin); } @@ -138,6 +141,9 @@ void Checkable::ClearAcknowledgement(const MessageOrigin::Ptr& origin) SetAcknowledgementRaw(AcknowledgementNone); SetAcknowledgementExpiry(0); + Log(LogInformation, "Checkable") + << "Acknowledgement cleared for checkable '" << GetName() << "'."; + OnAcknowledgementCleared(this, origin); } diff --git a/lib/icinga/downtime.cpp b/lib/icinga/downtime.cpp index 856ac9b10..f003bc746 100644 --- a/lib/icinga/downtime.cpp +++ b/lib/icinga/downtime.cpp @@ -298,10 +298,11 @@ String Downtime::AddDowntime(const Checkable::Ptr& checkable, const String& auth if (!downtime) BOOST_THROW_EXCEPTION(std::runtime_error("Could not create downtime object.")); - Log(LogNotice, "Downtime") + Log(LogInformation, "Downtime") << "Added downtime '" << downtime->GetName() << "' between '" << Utility::FormatDateTime("%Y-%m-%d %H:%M:%S", startTime) - << "' and '" << Utility::FormatDateTime("%Y-%m-%d %H:%M:%S", endTime) << "'."; + << "' and '" << Utility::FormatDateTime("%Y-%m-%d %H:%M:%S", endTime) << "', author: '" + << author << "', " << (fixed ? "fixed" : "flexible with " + Convert::ToString(duration) + "s duration"); return fullName; } @@ -323,9 +324,6 @@ void Downtime::RemoveDowntime(const String& id, bool cancelled, bool expired, co downtime->SetWasCancelled(cancelled); - Log(LogNotice, "Downtime") - << "Removed downtime '" << downtime->GetName() << "' from object '" << downtime->GetCheckable()->GetName() << "'."; - Array::Ptr errors = new Array(); if (!ConfigObjectUtility::DeleteObject(downtime, false, errors, nullptr)) { @@ -336,6 +334,21 @@ void Downtime::RemoveDowntime(const String& id, bool cancelled, bool expired, co BOOST_THROW_EXCEPTION(std::runtime_error("Could not remove downtime.")); } + + String reason; + + if (expired) { + reason = "expired at " + Utility::FormatDateTime("%Y-%m-%d %H:%M:%S %z", downtime->GetEndTime()); + } else if (cancelled) { + reason = "cancelled by user"; + } else { + reason = "<unknown>"; + } + + Log(LogInformation, "Downtime") + << "Removed downtime '" << downtime->GetName() << "' from checkable '" + << downtime->GetCheckable()->GetName() << "' (Reason: " << reason << ")."; + } bool Downtime::CanBeTriggered() @@ -359,8 +372,10 @@ void Downtime::TriggerDowntime() if (!CanBeTriggered()) return; - Log(LogNotice, "Downtime") - << "Triggering downtime '" << GetName() << "'."; + Checkable::Ptr checkable = GetCheckable(); + + Log(LogInformation, "Downtime") + << "Triggering downtime '" << GetName() << "' for checkable '" << checkable->GetName() << "'."; if (GetTriggerTime() == 0) SetTriggerTime(Utility::GetTime()); diff --git a/lib/remote/configobjectutility.cpp b/lib/remote/configobjectutility.cpp index 6b83eb2cf..f7c405e86 100644 --- a/lib/remote/configobjectutility.cpp +++ b/lib/remote/configobjectutility.cpp @@ -292,6 +292,9 @@ bool ConfigObjectUtility::DeleteObjectHelper(const ConfigObject::Ptr& object, bo Utility::Remove(path); + Log(LogInformation, "ConfigObjectUtility") + << "Deleted object '" << name << "' of type '" << type->GetName() << "'."; + return true; }