From 3ecec31af34615096154b09cc75bcc3e14b84de6 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Wed, 28 May 2014 13:45:45 +0200 Subject: [PATCH] Change log message identifier for libicinga. Refs #6346 --- lib/hello/hello.cpp | 2 +- lib/icinga/api.cpp | 2 +- lib/icinga/checkable-check.cpp | 12 +- lib/icinga/checkable-comment.cpp | 2 +- lib/icinga/checkable-dependency.cpp | 2 +- lib/icinga/checkable-downtime.cpp | 14 +- lib/icinga/checkable-event.cpp | 2 +- lib/icinga/checkable-flapping.cpp | 2 +- lib/icinga/checkable-notification.cpp | 10 +- lib/icinga/customvarobject.cpp | 2 +- lib/icinga/dependency-apply.cpp | 8 +- lib/icinga/dependency.cpp | 24 +-- lib/icinga/externalcommandprocessor.cpp | 234 ++++++++++++------------ lib/icinga/hostgroup.cpp | 6 +- lib/icinga/icingaapplication.cpp | 4 +- lib/icinga/icingastatuswriter.cpp | 4 +- lib/icinga/legacytimeperiod.cpp | 10 +- lib/icinga/macroprocessor.cpp | 2 +- lib/icinga/notification-apply.cpp | 8 +- lib/icinga/notification.cpp | 26 +-- lib/icinga/pluginutility.cpp | 2 +- lib/icinga/scheduleddowntime-apply.cpp | 8 +- lib/icinga/scheduleddowntime.cpp | 2 +- lib/icinga/service-apply.cpp | 4 +- lib/icinga/servicegroup.cpp | 6 +- lib/icinga/timeperiod.cpp | 14 +- lib/icinga/usergroup.cpp | 6 +- 27 files changed, 209 insertions(+), 209 deletions(-) diff --git a/lib/hello/hello.cpp b/lib/hello/hello.cpp index fc4d23cfc..a75becd4b 100644 --- a/lib/hello/hello.cpp +++ b/lib/hello/hello.cpp @@ -32,7 +32,7 @@ REGISTER_TYPE(Hello); */ int Hello::Main(void) { - Log(LogInformation, "hello", "Hello World!"); + Log(LogInformation, "Hello", "Hello World!"); return 0; } diff --git a/lib/icinga/api.cpp b/lib/icinga/api.cpp index 67cfdc466..7c8c10d4c 100644 --- a/lib/icinga/api.cpp +++ b/lib/icinga/api.cpp @@ -32,7 +32,7 @@ Value API::GetAnswerToEverything(const Dictionary::Ptr& params) if (params) text = params->Get("text"); - Log(LogInformation, "icinga", "Hello from the Icinga 2 API: " + text); + Log(LogInformation, "API", "Hello from the Icinga 2 API: " + text); return 42; } diff --git a/lib/icinga/checkable-check.cpp b/lib/icinga/checkable-check.cpp index 9e6c2525e..9e287e5a9 100644 --- a/lib/icinga/checkable-check.cpp +++ b/lib/icinga/checkable-check.cpp @@ -400,7 +400,7 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig olock.Unlock(); -// Log(LogDebug, "icinga", "Flapping: Checkable " + GetName() + +// Log(LogDebug, "Checkable", "Flapping: Checkable " + GetName() + // " was: " + Convert::ToString(was_flapping) + // " is: " + Convert::ToString(is_flapping) + // " threshold: " + Convert::ToString(GetFlappingThreshold()) + @@ -416,10 +416,10 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig if (hardChange) { OnStateChange(GetSelf(), cr, StateTypeHard, origin); - Log(LogNotice, "icinga", "State Change: Checkable " + GetName() + " hard state change from " + old_state_str + " to " + new_state_str + " detected."); + Log(LogNotice, "Checkable", "State Change: Checkable " + GetName() + " hard state change from " + old_state_str + " to " + new_state_str + " detected."); } else if (stateChange) { OnStateChange(GetSelf(), cr, StateTypeSoft, origin); - Log(LogNotice, "icinga", "State Change: Checkable " + GetName() + " soft state change from " + old_state_str + " to " + new_state_str + " detected."); + Log(LogNotice, "Checkable", "State Change: Checkable " + GetName() + " soft state change from " + old_state_str + " to " + new_state_str + " detected."); } if (GetStateType() == StateTypeSoft || hardChange || recovery) @@ -431,12 +431,12 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig if (!was_flapping && is_flapping) { OnNotificationsRequested(GetSelf(), NotificationFlappingStart, cr, "", ""); - Log(LogNotice, "icinga", "Flapping: Checkable " + GetName() + " started flapping (" + Convert::ToString(GetFlappingThreshold()) + "% < " + Convert::ToString(GetFlappingCurrent()) + "%)."); + Log(LogNotice, "Checkable", "Flapping: Checkable " + GetName() + " started flapping (" + Convert::ToString(GetFlappingThreshold()) + "% < " + Convert::ToString(GetFlappingCurrent()) + "%)."); OnFlappingChanged(GetSelf(), FlappingStarted); } else if (was_flapping && !is_flapping) { OnNotificationsRequested(GetSelf(), NotificationFlappingEnd, cr, "", ""); - Log(LogNotice, "icinga", "Flapping: Checkable " + GetName() + " stopped flapping (" + Convert::ToString(GetFlappingThreshold()) + "% >= " + Convert::ToString(GetFlappingCurrent()) + "%)."); + Log(LogNotice, "Checkable", "Flapping: Checkable " + GetName() + " stopped flapping (" + Convert::ToString(GetFlappingThreshold()) + "% >= " + Convert::ToString(GetFlappingCurrent()) + "%)."); OnFlappingChanged(GetSelf(), FlappingStopped); } else if (send_notification) OnNotificationsRequested(GetSelf(), recovery ? NotificationRecovery : NotificationProblem, cr, "", ""); @@ -501,7 +501,7 @@ void Checkable::UpdateStatistics(const CheckResult::Ptr& cr, CheckableType type) else CIB::UpdatePassiveServiceChecksStatistics(ts, 1); } else { - Log(LogWarning, "icinga", "Unknown checkable type for statistic update."); + Log(LogWarning, "Checkable", "Unknown checkable type for statistic update."); } } diff --git a/lib/icinga/checkable-comment.cpp b/lib/icinga/checkable-comment.cpp index ba634b31e..ce60b91c1 100644 --- a/lib/icinga/checkable-comment.cpp +++ b/lib/icinga/checkable-comment.cpp @@ -166,7 +166,7 @@ Comment::Ptr Checkable::GetCommentByID(const String& id) void Checkable::AddCommentsToCache(void) { #ifdef _DEBUG - Log(LogDebug, "icinga", "Updating Checkable comments cache."); + Log(LogDebug, "Checkable", "Updating Checkable comments cache."); #endif /* _DEBUG */ Dictionary::Ptr comments = GetComments(); diff --git a/lib/icinga/checkable-dependency.cpp b/lib/icinga/checkable-dependency.cpp index 8bb541ef8..4a6828b85 100644 --- a/lib/icinga/checkable-dependency.cpp +++ b/lib/icinga/checkable-dependency.cpp @@ -63,7 +63,7 @@ std::set Checkable::GetReverseDependencies(void) const bool Checkable::IsReachable(DependencyType dt, Dependency::Ptr *failedDependency, int rstack) const { if (rstack > 20) { - Log(LogWarning, "icinga", "Too many nested dependencies for service '" + GetName() + "': Dependency failed."); + Log(LogWarning, "Checkable", "Too many nested dependencies for service '" + GetName() + "': Dependency failed."); return false; } diff --git a/lib/icinga/checkable-downtime.cpp b/lib/icinga/checkable-downtime.cpp index b74d6eae4..735cfade4 100644 --- a/lib/icinga/checkable-downtime.cpp +++ b/lib/icinga/checkable-downtime.cpp @@ -104,7 +104,7 @@ String Checkable::AddDowntime(const String& author, const String& comment, l_DowntimesCache[uid] = GetSelf(); } - Log(LogNotice, "icinga", "Added downtime with ID '" + Convert::ToString(downtime->GetLegacyId()) + + Log(LogNotice, "Checkable", "Added downtime with ID '" + Convert::ToString(downtime->GetLegacyId()) + "' between '" + Utility::FormatDateTime("%Y-%m-%d %H:%M:%S", startTime) + "' and '" + Utility::FormatDateTime("%Y-%m-%d %H:%M:%S", endTime) + "'."); OnDowntimeAdded(GetSelf(), downtime, origin); @@ -131,7 +131,7 @@ void Checkable::RemoveDowntime(const String& id, bool cancelled, const MessageOr String config_owner = downtime->GetConfigOwner(); if (!config_owner.IsEmpty()) { - Log(LogWarning, "icinga", "Cannot remove downtime with ID '" + Convert::ToString(legacy_id) + "'. It is owned by scheduled downtime object '" + config_owner + "'"); + Log(LogWarning, "Checkable", "Cannot remove downtime with ID '" + Convert::ToString(legacy_id) + "'. It is owned by scheduled downtime object '" + config_owner + "'"); return; } @@ -145,7 +145,7 @@ void Checkable::RemoveDowntime(const String& id, bool cancelled, const MessageOr downtime->SetWasCancelled(cancelled); - Log(LogNotice, "icinga", "Removed downtime with ID '" + Convert::ToString(downtime->GetLegacyId()) + "' from service '" + owner->GetName() + "'."); + Log(LogNotice, "Checkable", "Removed downtime with ID '" + Convert::ToString(downtime->GetLegacyId()) + "' from service '" + owner->GetName() + "'."); OnDowntimeRemoved(owner, downtime, origin); } @@ -178,16 +178,16 @@ void Checkable::TriggerDowntime(const String& id) return; if (downtime->IsActive() && downtime->IsTriggered()) { - Log(LogDebug, "icinga", "Not triggering downtime with ID '" + Convert::ToString(downtime->GetLegacyId()) + "': already triggered."); + Log(LogDebug, "Checkable", "Not triggering downtime with ID '" + Convert::ToString(downtime->GetLegacyId()) + "': already triggered."); return; } if (downtime->IsExpired()) { - Log(LogDebug, "icinga", "Not triggering downtime with ID '" + Convert::ToString(downtime->GetLegacyId()) + "': expired."); + Log(LogDebug, "Checkable", "Not triggering downtime with ID '" + Convert::ToString(downtime->GetLegacyId()) + "': expired."); return; } - Log(LogNotice, "icinga", "Triggering downtime with ID '" + Convert::ToString(downtime->GetLegacyId()) + "'."); + Log(LogNotice, "Checkable", "Triggering downtime with ID '" + Convert::ToString(downtime->GetLegacyId()) + "'."); if (downtime->GetTriggerTime() == 0) downtime->SetTriggerTime(Utility::GetTime()); @@ -245,7 +245,7 @@ void Checkable::StartDowntimesExpiredTimer(void) void Checkable::AddDowntimesToCache(void) { #ifdef _DEBUG - Log(LogDebug, "icinga", "Updating Checkable downtimes cache."); + Log(LogDebug, "Checkable", "Updating Checkable downtimes cache."); #endif /* _DEBUG */ Dictionary::Ptr downtimes = GetDowntimes(); diff --git a/lib/icinga/checkable-event.cpp b/lib/icinga/checkable-event.cpp index d52ebc170..abecdc8c7 100644 --- a/lib/icinga/checkable-event.cpp +++ b/lib/icinga/checkable-event.cpp @@ -69,7 +69,7 @@ void Checkable::ExecuteEventHandler(void) if (!ec) return; - Log(LogNotice, "icinga", "Executing event handler '" + ec->GetName() + "' for service '" + GetName() + "'"); + Log(LogNotice, "Checkable", "Executing event handler '" + ec->GetName() + "' for service '" + GetName() + "'"); ec->Execute(GetSelf()); diff --git a/lib/icinga/checkable-flapping.cpp b/lib/icinga/checkable-flapping.cpp index 34ecb7e6d..70608aebd 100644 --- a/lib/icinga/checkable-flapping.cpp +++ b/lib/icinga/checkable-flapping.cpp @@ -80,7 +80,7 @@ void Checkable::UpdateFlappingStatus(bool stateChange) if (negative < 0) negative = 0; -// Log(LogDebug, "icinga", "Flapping counter for '" + GetName() + "' is positive=" + Convert::ToString(positive) + ", negative=" + Convert::ToString(negative)); +// Log(LogDebug, "Checkable", "Flapping counter for '" + GetName() + "' is positive=" + Convert::ToString(positive) + ", negative=" + Convert::ToString(negative)); SetFlappingLastChange(now); SetFlappingPositive(positive); diff --git a/lib/icinga/checkable-notification.cpp b/lib/icinga/checkable-notification.cpp index 5a2af26da..4911a5c1d 100644 --- a/lib/icinga/checkable-notification.cpp +++ b/lib/icinga/checkable-notification.cpp @@ -51,21 +51,21 @@ void Checkable::SendNotifications(NotificationType type, const CheckResult::Ptr& if (!IcingaApplication::GetInstance()->GetEnableNotifications() || !GetEnableNotifications()) { if (!force) { - Log(LogInformation, "icinga", "Notifications are disabled for service '" + GetName() + "'."); + Log(LogInformation, "Checkable", "Notifications are disabled for service '" + GetName() + "'."); return; } SetForceNextNotification(false); } - Log(LogInformation, "icinga", "Sending notifications for object '" + GetName() + "'"); + Log(LogInformation, "Checkable", "Sending notifications for object '" + GetName() + "'"); std::set notifications = GetNotifications(); if (notifications.empty()) - Log(LogInformation, "icinga", "Checkable '" + GetName() + "' does not have any notifications."); + Log(LogInformation, "Checkable", "Checkable '" + GetName() + "' does not have any notifications."); - Log(LogDebug, "icinga", "Checkable '" + GetName() + "' has " + Convert::ToString(notifications.size()) + " notification(s)."); + Log(LogDebug, "Checkable", "Checkable '" + GetName() + "' has " + Convert::ToString(notifications.size()) + " notification(s)."); BOOST_FOREACH(const Notification::Ptr& notification, notifications) { try { @@ -76,7 +76,7 @@ void Checkable::SendNotifications(NotificationType type, const CheckResult::Ptr& << GetName() << "': " << DiagnosticInformation(ex); String message = msgbuf.str(); - Log(LogWarning, "icinga", message); + Log(LogWarning, "Checkable", message); } } } diff --git a/lib/icinga/customvarobject.cpp b/lib/icinga/customvarobject.cpp index df0774ab2..cdb9b59cd 100644 --- a/lib/icinga/customvarobject.cpp +++ b/lib/icinga/customvarobject.cpp @@ -38,7 +38,7 @@ void CustomVarObject::SetVars(const Dictionary::Ptr& vars, const MessageOrigin& { SetOverrideVars(vars); - Log(LogNotice, "icinga", "Setting vars for object '" + GetName() + "'"); + Log(LogNotice, "CustomVarObject", "Setting vars for object '" + GetName() + "'"); OnVarsChanged(GetSelf(), origin); } diff --git a/lib/icinga/dependency-apply.cpp b/lib/icinga/dependency-apply.cpp index 62a3e80b3..9a2509e22 100644 --- a/lib/icinga/dependency-apply.cpp +++ b/lib/icinga/dependency-apply.cpp @@ -62,7 +62,7 @@ bool Dependency::EvaluateApplyRuleOne(const Checkable::Ptr& checkable, const App std::ostringstream msgbuf2; msgbuf2 << "Applying dependency '" << rule.GetName() << "' to object '" << checkable->GetName() << "' for rule " << di; - Log(LogDebug, "icinga", msgbuf2.str()); + Log(LogDebug, "Dependency", msgbuf2.str()); ConfigItemBuilder::Ptr builder = make_shared(di); builder->SetType("Dependency"); @@ -120,7 +120,7 @@ void Dependency::EvaluateApplyRule(const ApplyRule& rule) } if (apply_count == 0) - Log(LogWarning, "icinga", "Apply rule '" + rule.GetName() + "' for host does not match anywhere!"); + Log(LogWarning, "Dependency", "Apply rule '" + rule.GetName() + "' for host does not match anywhere!"); } else if (rule.GetTargetType() == "Service") { apply_count = 0; @@ -133,10 +133,10 @@ void Dependency::EvaluateApplyRule(const ApplyRule& rule) } if (apply_count == 0) - Log(LogWarning, "icinga", "Apply rule '" + rule.GetName() + "' for service does not match anywhere!"); + Log(LogWarning, "Dependency", "Apply rule '" + rule.GetName() + "' for service does not match anywhere!"); } else { - Log(LogWarning, "icinga", "Wrong target type for apply rule '" + rule.GetName() + "'!"); + Log(LogWarning, "Dependency", "Wrong target type for apply rule '" + rule.GetName() + "'!"); } } diff --git a/lib/icinga/dependency.cpp b/lib/icinga/dependency.cpp index 463743021..e8d906e16 100644 --- a/lib/icinga/dependency.cpp +++ b/lib/icinga/dependency.cpp @@ -63,12 +63,12 @@ void Dependency::OnStateLoaded(void) ASSERT(!OwnsLock()); if (!GetChild()) - Log(LogWarning, "icinga", "Dependency '" + GetName() + "' references an invalid child object and will be ignored."); + Log(LogWarning, "Dependency", "Dependency '" + GetName() + "' references an invalid child object and will be ignored."); else GetChild()->AddDependency(GetSelf()); if (!GetParent()) - Log(LogWarning, "icinga", "Dependency '" + GetName() + "' references an invalid parent object and will always fail."); + Log(LogWarning, "Dependency", "Dependency '" + GetName() + "' references an invalid parent object and will always fail."); else GetParent()->AddReverseDependency(GetSelf()); } @@ -97,19 +97,19 @@ bool Dependency::IsAvailable(DependencyType dt) const /* ignore if it's the same checkable object */ if (parent == GetChild()) { - Log(LogNotice, "icinga", "Dependency '" + GetName() + "' passed: Parent and child " + (service ? "service" : "host") + " are identical."); + Log(LogNotice, "Dependency", "Dependency '" + GetName() + "' passed: Parent and child " + (service ? "service" : "host") + " are identical."); return true; } /* ignore pending */ if (!parent->GetLastCheckResult()) { - Log(LogNotice, "icinga", "Dependency '" + GetName() + "' passed: " + (service ? "Service" : "Host") + " '" + parent->GetName() + "' hasn't been checked yet."); + Log(LogNotice, "Dependency", "Dependency '" + GetName() + "' passed: " + (service ? "Service" : "Host") + " '" + parent->GetName() + "' hasn't been checked yet."); return true; } /* ignore soft states */ if (parent->GetStateType() == StateTypeSoft) { - Log(LogNotice, "icinga", "Dependency '" + GetName() + "' passed: " + (service ? "Service" : "Host") + " '" + parent->GetName() + "' is in a soft state."); + Log(LogNotice, "Dependency", "Dependency '" + GetName() + "' passed: " + (service ? "Service" : "Host") + " '" + parent->GetName() + "' is in a soft state."); return true; } @@ -122,26 +122,26 @@ bool Dependency::IsAvailable(DependencyType dt) const /* check state */ if (state & GetStateFilter()) { - Log(LogNotice, "icinga", "Dependency '" + GetName() + "' passed: " + (service ? "Service" : "Host") + " '" + parent->GetName() + "' matches state filter."); + Log(LogNotice, "Dependency", "Dependency '" + GetName() + "' passed: " + (service ? "Service" : "Host") + " '" + parent->GetName() + "' matches state filter."); return true; } /* ignore if not in time period */ TimePeriod::Ptr tp = GetPeriod(); if (tp && !tp->IsInside(Utility::GetTime())) { - Log(LogNotice, "icinga", "Dependency '" + GetName() + "' passed: Outside time period."); + Log(LogNotice, "Dependency", "Dependency '" + GetName() + "' passed: Outside time period."); return true; } if (dt == DependencyCheckExecution && !GetDisableChecks()) { - Log(LogNotice, "icinga", "Dependency '" + GetName() + "' passed: Checks are not disabled."); + Log(LogNotice, "Dependency", "Dependency '" + GetName() + "' passed: Checks are not disabled."); return true; } else if (dt == DependencyNotification && !GetDisableNotifications()) { - Log(LogNotice, "icinga", "Dependency '" + GetName() + "' passed: Notifications are not disabled"); + Log(LogNotice, "Dependency", "Dependency '" + GetName() + "' passed: Notifications are not disabled"); return true; } - Log(LogNotice, "icinga", "Dependency '" + GetName() + "' failed. Parent " + + Log(LogNotice, "Dependency", "Dependency '" + GetName() + "' failed. Parent " + (service ? "service" : "host") + " '" + parent->GetName() + "' is " + (service ? Service::StateToString(service->GetState()) : Host::StateToString(host->GetState()))); return false; @@ -168,10 +168,10 @@ Checkable::Ptr Dependency::GetParent(void) const return Service::Ptr(); if (GetParentServiceName().IsEmpty()) { - Log(LogDebug, "icinga", "Dependency '" + GetName() + "' parent host '" + GetParentHostName() + "."); + Log(LogDebug, "Dependency", "Dependency '" + GetName() + "' parent host '" + GetParentHostName() + "."); return host; } else { - Log(LogDebug, "icinga", "Dependency '" + GetName() + "' parent host '" + GetParentHostName() + "' service '" + GetParentServiceName() + "' ."); + Log(LogDebug, "Dependency", "Dependency '" + GetName() + "' parent host '" + GetParentHostName() + "' service '" + GetParentServiceName() + "' ."); return host->GetServiceByShortName(GetParentServiceName()); } } diff --git a/lib/icinga/externalcommandprocessor.cpp b/lib/icinga/externalcommandprocessor.cpp index ebd283ff7..374b0e26a 100644 --- a/lib/icinga/externalcommandprocessor.cpp +++ b/lib/icinga/externalcommandprocessor.cpp @@ -325,7 +325,7 @@ void ExternalCommandProcessor::ProcessHostCheckResult(double time, const std::ve result->SetExecutionEnd(time); result->SetActive(false); - Log(LogNotice, "icinga", "Processing passive check result for host '" + arguments[0] + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Processing passive check result for host '" + arguments[0] + "'"); host->ProcessCheckResult(result); { @@ -361,7 +361,7 @@ void ExternalCommandProcessor::ProcessServiceCheckResult(double time, const std: result->SetExecutionEnd(time); result->SetActive(false); - Log(LogNotice, "icinga", "Processing passive check result for service '" + arguments[1] + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Processing passive check result for service '" + arguments[1] + "'"); service->ProcessCheckResult(result); { @@ -384,12 +384,12 @@ void ExternalCommandProcessor::ScheduleHostCheck(double, const std::vector host->GetNextCheck()) { - Log(LogNotice, "icinga", "Ignoring reschedule request for host '" + + Log(LogNotice, "ExternalCommandProcessor", "Ignoring reschedule request for host '" + arguments[0] + "' (next check is already sooner than requested check time)"); return; } - Log(LogNotice, "icinga", "Rescheduling next check for host '" + arguments[0] + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Rescheduling next check for host '" + arguments[0] + "'"); if (planned_check < Utility::GetTime()) planned_check = Utility::GetTime(); @@ -408,7 +408,7 @@ void ExternalCommandProcessor::ScheduleForcedHostCheck(double, const std::vector if (!host) BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot reschedule forced host check for non-existent host '" + arguments[0] + "'")); - Log(LogNotice, "icinga", "Rescheduling next check for host '" + arguments[0] + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Rescheduling next check for host '" + arguments[0] + "'"); { ObjectLock olock(host); @@ -428,12 +428,12 @@ void ExternalCommandProcessor::ScheduleSvcCheck(double, const std::vector service->GetNextCheck()) { - Log(LogNotice, "icinga", "Ignoring reschedule request for service '" + + Log(LogNotice, "ExternalCommandProcessor", "Ignoring reschedule request for service '" + arguments[1] + "' (next check is already sooner than requested check time)"); return; } - Log(LogNotice, "icinga", "Rescheduling next check for service '" + arguments[1] + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Rescheduling next check for service '" + arguments[1] + "'"); if (planned_check < Utility::GetTime()) planned_check = Utility::GetTime(); @@ -452,7 +452,7 @@ void ExternalCommandProcessor::ScheduleForcedSvcCheck(double, const std::vector< if (!service) BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot reschedule forced service check for non-existent service '" + arguments[1] + "' on host '" + arguments[0] + "'")); - Log(LogNotice, "icinga", "Rescheduling next check for service '" + arguments[1] + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Rescheduling next check for service '" + arguments[1] + "'"); { ObjectLock olock(service); @@ -469,7 +469,7 @@ void ExternalCommandProcessor::EnableHostCheck(double, const std::vector if (!host) BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot enable host checks for non-existent host '" + arguments[0] + "'")); - Log(LogNotice, "icinga", "Enabling active checks for host '" + arguments[0] + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Enabling active checks for host '" + arguments[0] + "'"); { ObjectLock olock(host); @@ -485,7 +485,7 @@ void ExternalCommandProcessor::DisableHostCheck(double, const std::vector& if (!service) BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot enable service check for non-existent service '" + arguments[1] + "' on host '" + arguments[0] + "'")); - Log(LogNotice, "icinga", "Enabling active checks for service '" + arguments[1] + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Enabling active checks for service '" + arguments[1] + "'"); { ObjectLock olock(service); @@ -517,7 +517,7 @@ void ExternalCommandProcessor::DisableSvcCheck(double, const std::vector if (!service) BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot disable service check for non-existent service '" + arguments[1] + "' on host '" + arguments[0] + "'")); - Log(LogNotice, "icinga", "Disabling active checks for service '" + arguments[1] + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Disabling active checks for service '" + arguments[1] + "'"); { ObjectLock olock(service); @@ -528,13 +528,13 @@ void ExternalCommandProcessor::DisableSvcCheck(double, const std::vector void ExternalCommandProcessor::ShutdownProcess(double, const std::vector&) { - Log(LogNotice, "icinga", "Shutting down Icinga via external command."); + Log(LogNotice, "ExternalCommandProcessor", "Shutting down Icinga via external command."); Application::RequestShutdown(); } void ExternalCommandProcessor::RestartProcess(double, const std::vector&) { - Log(LogNotice, "icinga", "Restarting Icinga via external command."); + Log(LogNotice, "ExternalCommandProcessor", "Restarting Icinga via external command."); Application::RequestRestart(); } @@ -548,7 +548,7 @@ void ExternalCommandProcessor::ScheduleForcedHostSvcChecks(double, const std::ve BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot reschedule forced host service checks for non-existent host '" + arguments[0] + "'")); BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) { - Log(LogNotice, "icinga", "Rescheduling next check for service '" + service->GetName() + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Rescheduling next check for service '" + service->GetName() + "'"); { ObjectLock olock(service); @@ -573,12 +573,12 @@ void ExternalCommandProcessor::ScheduleHostSvcChecks(double, const std::vectorGetServices()) { if (planned_check > service->GetNextCheck()) { - Log(LogNotice, "icinga", "Ignoring reschedule request for service '" + + Log(LogNotice, "ExternalCommandProcessor", "Ignoring reschedule request for service '" + service->GetName() + "' (next check is already sooner than requested check time)"); continue; } - Log(LogNotice, "icinga", "Rescheduling next check for service '" + service->GetName() + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Rescheduling next check for service '" + service->GetName() + "'"); { ObjectLock olock(service); @@ -596,7 +596,7 @@ void ExternalCommandProcessor::EnableHostSvcChecks(double, const std::vectorGetServices()) { - Log(LogNotice, "icinga", "Enabling active checks for service '" + service->GetName() + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Enabling active checks for service '" + service->GetName() + "'"); service->SetEnableActiveChecks(true); } } @@ -609,7 +609,7 @@ void ExternalCommandProcessor::DisableHostSvcChecks(double, const std::vectorGetServices()) { - Log(LogNotice, "icinga", "Disabling active checks for service '" + service->GetName() + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Disabling active checks for service '" + service->GetName() + "'"); { ObjectLock olock(service); @@ -631,7 +631,7 @@ void ExternalCommandProcessor::AcknowledgeSvcProblem(double, const std::vectorGetState() == ServiceOK) BOOST_THROW_EXCEPTION(std::invalid_argument("The service '" + arguments[1] + "' is OK.")); - Log(LogNotice, "icinga", "Setting acknowledgement for service '" + service->GetName() + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Setting acknowledgement for service '" + service->GetName() + "'"); service->AddComment(CommentAcknowledgement, arguments[5], arguments[6], 0); service->AcknowledgeProblem(arguments[5], arguments[6], sticky ? AcknowledgementSticky : AcknowledgementNormal); @@ -650,7 +650,7 @@ void ExternalCommandProcessor::AcknowledgeSvcProblemExpire(double, const std::ve if (service->GetState() == ServiceOK) BOOST_THROW_EXCEPTION(std::invalid_argument("The service '" + arguments[1] + "' is OK.")); - Log(LogNotice, "icinga", "Setting timed acknowledgement for service '" + service->GetName() + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Setting timed acknowledgement for service '" + service->GetName() + "'"); service->AddComment(CommentAcknowledgement, arguments[6], arguments[7], 0); service->AcknowledgeProblem(arguments[6], arguments[7], sticky ? AcknowledgementSticky : AcknowledgementNormal, timestamp); @@ -663,7 +663,7 @@ void ExternalCommandProcessor::RemoveSvcAcknowledgement(double, const std::vecto if (!service) BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot remove service acknowledgement for non-existent service '" + arguments[1] + "' on host '" + arguments[0] + "'")); - Log(LogNotice, "icinga", "Removing acknowledgement for service '" + service->GetName() + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Removing acknowledgement for service '" + service->GetName() + "'"); { ObjectLock olock(service); @@ -682,7 +682,7 @@ void ExternalCommandProcessor::AcknowledgeHostProblem(double, const std::vector< if (!host) BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot acknowledge host problem for non-existent host '" + arguments[0] + "'")); - Log(LogNotice, "icinga", "Setting acknowledgement for host '" + host->GetName() + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Setting acknowledgement for host '" + host->GetName() + "'"); if (host->GetState() == HostUp) BOOST_THROW_EXCEPTION(std::invalid_argument("The host '" + arguments[0] + "' is OK.")); @@ -701,7 +701,7 @@ void ExternalCommandProcessor::AcknowledgeHostProblemExpire(double, const std::v if (!host) BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot acknowledge host problem with expire time for non-existent host '" + arguments[0] + "'")); - Log(LogNotice, "icinga", "Setting timed acknowledgement for host '" + host->GetName() + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Setting timed acknowledgement for host '" + host->GetName() + "'"); if (host->GetState() == HostUp) BOOST_THROW_EXCEPTION(std::invalid_argument("The host '" + arguments[0] + "' is OK.")); @@ -717,7 +717,7 @@ void ExternalCommandProcessor::RemoveHostAcknowledgement(double, const std::vect if (!host) BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot remove acknowledgement for non-existent host '" + arguments[0] + "'")); - Log(LogNotice, "icinga", "Removing acknowledgement for host '" + host->GetName() + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Removing acknowledgement for host '" + host->GetName() + "'"); { ObjectLock olock(host); @@ -735,7 +735,7 @@ void ExternalCommandProcessor::EnableHostgroupSvcChecks(double, const std::vecto BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) { BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) { - Log(LogNotice, "icinga", "Enabling active checks for service '" + service->GetName() + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Enabling active checks for service '" + service->GetName() + "'"); { ObjectLock olock(service); @@ -755,7 +755,7 @@ void ExternalCommandProcessor::DisableHostgroupSvcChecks(double, const std::vect BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) { BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) { - Log(LogNotice, "icinga", "Disabling active checks for service '" + service->GetName() + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Disabling active checks for service '" + service->GetName() + "'"); { ObjectLock olock(service); @@ -774,7 +774,7 @@ void ExternalCommandProcessor::EnableServicegroupSvcChecks(double, const std::ve BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot enable servicegroup service checks for non-existent servicegroup '" + arguments[0] + "'")); BOOST_FOREACH(const Service::Ptr& service, sg->GetMembers()) { - Log(LogNotice, "icinga", "Enabling active checks for service '" + service->GetName() + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Enabling active checks for service '" + service->GetName() + "'"); { ObjectLock olock(service); @@ -792,7 +792,7 @@ void ExternalCommandProcessor::DisableServicegroupSvcChecks(double, const std::v BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot disable servicegroup service checks for non-existent servicegroup '" + arguments[0] + "'")); BOOST_FOREACH(const Service::Ptr& service, sg->GetMembers()) { - Log(LogNotice, "icinga", "Disabling active checks for service '" + service->GetName() + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Disabling active checks for service '" + service->GetName() + "'"); { ObjectLock olock(service); @@ -809,7 +809,7 @@ void ExternalCommandProcessor::EnablePassiveHostChecks(double, const std::vector if (!host) BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot enable passive host checks for non-existent host '" + arguments[0] + "'")); - Log(LogNotice, "icinga", "Enabling passive checks for host '" + arguments[0] + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Enabling passive checks for host '" + arguments[0] + "'"); { ObjectLock olock(host); @@ -825,7 +825,7 @@ void ExternalCommandProcessor::DisablePassiveHostChecks(double, const std::vecto if (!host) BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot disable passive host checks for non-existent host '" + arguments[0] + "'")); - Log(LogNotice, "icinga", "Disabling passive checks for host '" + arguments[0] + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Disabling passive checks for host '" + arguments[0] + "'"); { ObjectLock olock(host); @@ -841,7 +841,7 @@ void ExternalCommandProcessor::EnablePassiveSvcChecks(double, const std::vector< if (!service) BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot enable service checks for non-existent service '" + arguments[1] + "' on host '" + arguments[0] + "'")); - Log(LogNotice, "icinga", "Enabling passive checks for service '" + arguments[1] + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Enabling passive checks for service '" + arguments[1] + "'"); { ObjectLock olock(service); @@ -857,7 +857,7 @@ void ExternalCommandProcessor::DisablePassiveSvcChecks(double, const std::vector if (!service) BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot disable service checks for non-existent service '" + arguments[1] + "' on host '" + arguments[0] + "'")); - Log(LogNotice, "icinga", "Disabling passive checks for service '" + arguments[1] + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Disabling passive checks for service '" + arguments[1] + "'"); { ObjectLock olock(service); @@ -874,7 +874,7 @@ void ExternalCommandProcessor::EnableServicegroupPassiveSvcChecks(double, const BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot enable servicegroup passive service checks for non-existent servicegroup '" + arguments[0] + "'")); BOOST_FOREACH(const Service::Ptr& service, sg->GetMembers()) { - Log(LogNotice, "icinga", "Enabling passive checks for service '" + service->GetName() + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Enabling passive checks for service '" + service->GetName() + "'"); { ObjectLock olock(service); @@ -892,7 +892,7 @@ void ExternalCommandProcessor::DisableServicegroupPassiveSvcChecks(double, const BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot disable servicegroup passive service checks for non-existent servicegroup '" + arguments[0] + "'")); BOOST_FOREACH(const Service::Ptr& service, sg->GetMembers()) { - Log(LogNotice, "icinga", "Disabling passive checks for service '" + service->GetName() + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Disabling passive checks for service '" + service->GetName() + "'"); { ObjectLock olock(service); @@ -911,7 +911,7 @@ void ExternalCommandProcessor::EnableHostgroupPassiveSvcChecks(double, const std BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) { BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) { - Log(LogNotice, "icinga", "Enabling passive checks for service '" + service->GetName() + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Enabling passive checks for service '" + service->GetName() + "'"); { ObjectLock olock(service); @@ -931,7 +931,7 @@ void ExternalCommandProcessor::DisableHostgroupPassiveSvcChecks(double, const st BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) { BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) { - Log(LogNotice, "icinga", "Disabling passive checks for service '" + service->GetName() + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Disabling passive checks for service '" + service->GetName() + "'"); { ObjectLock olock(service); @@ -963,7 +963,7 @@ void ExternalCommandProcessor::ProcessFile(double, const std::vector& ar } catch (const std::exception& ex) { std::ostringstream msgbuf; msgbuf << "External command failed: " << DiagnosticInformation(ex); - Log(LogWarning, "icinga", msgbuf.str()); + Log(LogWarning, "ExternalCommandProcessor", msgbuf.str()); } } @@ -985,7 +985,7 @@ void ExternalCommandProcessor::ScheduleSvcDowntime(double, const std::vectorGetName()); + Log(LogNotice, "ExternalCommandProcessor", "Creating downtime for service " + service->GetName()); (void) service->AddDowntime(arguments[7], arguments[8], Convert::ToDouble(arguments[2]), Convert::ToDouble(arguments[3]), Convert::ToBool(arguments[4]), triggeredBy, Convert::ToDouble(arguments[6])); @@ -994,7 +994,7 @@ void ExternalCommandProcessor::ScheduleSvcDowntime(double, const std::vector& arguments) { int id = Convert::ToLong(arguments[0]); - Log(LogNotice, "icinga", "Removing downtime ID " + arguments[0]); + Log(LogNotice, "ExternalCommandProcessor", "Removing downtime ID " + arguments[0]); String rid = Service::GetDowntimeIDFromLegacyID(id); Service::RemoveDowntime(rid, true); } @@ -1011,7 +1011,7 @@ void ExternalCommandProcessor::ScheduleHostDowntime(double, const std::vectorGetName()); + Log(LogNotice, "ExternalCommandProcessor", "Creating downtime for host " + host->GetName()); (void) host->AddDowntime(arguments[6], arguments[7], Convert::ToDouble(arguments[1]), Convert::ToDouble(arguments[2]), @@ -1021,7 +1021,7 @@ void ExternalCommandProcessor::ScheduleHostDowntime(double, const std::vector& arguments) { int id = Convert::ToLong(arguments[0]); - Log(LogNotice, "icinga", "Removing downtime ID " + arguments[0]); + Log(LogNotice, "ExternalCommandProcessor", "Removing downtime ID " + arguments[0]); String rid = Service::GetDowntimeIDFromLegacyID(id); Service::RemoveDowntime(rid, true); } @@ -1039,7 +1039,7 @@ void ExternalCommandProcessor::ScheduleHostSvcDowntime(double, const std::vector triggeredBy = Service::GetDowntimeIDFromLegacyID(triggeredByLegacy); BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) { - Log(LogNotice, "icinga", "Creating downtime for service " + service->GetName()); + Log(LogNotice, "ExternalCommandProcessor", "Creating downtime for service " + service->GetName()); (void) service->AddDowntime(arguments[6], arguments[7], Convert::ToDouble(arguments[1]), Convert::ToDouble(arguments[2]), Convert::ToBool(arguments[3]), triggeredBy, Convert::ToDouble(arguments[5])); @@ -1059,7 +1059,7 @@ void ExternalCommandProcessor::ScheduleHostgroupHostDowntime(double, const std:: triggeredBy = Service::GetDowntimeIDFromLegacyID(triggeredByLegacy); BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) { - Log(LogNotice, "icinga", "Creating downtime for host " + host->GetName()); + Log(LogNotice, "ExternalCommandProcessor", "Creating downtime for host " + host->GetName()); (void) host->AddDowntime(arguments[6], arguments[7], Convert::ToDouble(arguments[1]), Convert::ToDouble(arguments[2]), @@ -1092,7 +1092,7 @@ void ExternalCommandProcessor::ScheduleHostgroupSvcDowntime(double, const std::v } BOOST_FOREACH(const Service::Ptr& service, services) { - Log(LogNotice, "icinga", "Creating downtime for service " + service->GetName()); + Log(LogNotice, "ExternalCommandProcessor", "Creating downtime for service " + service->GetName()); (void) service->AddDowntime(arguments[6], arguments[7], Convert::ToDouble(arguments[1]), Convert::ToDouble(arguments[2]), Convert::ToBool(arguments[3]), triggeredBy, Convert::ToDouble(arguments[5])); @@ -1123,7 +1123,7 @@ void ExternalCommandProcessor::ScheduleServicegroupHostDowntime(double, const st } BOOST_FOREACH(const Host::Ptr& host, hosts) { - Log(LogNotice, "icinga", "Creating downtime for host " + host->GetName()); + Log(LogNotice, "ExternalCommandProcessor", "Creating downtime for host " + host->GetName()); (void) host->AddDowntime(arguments[6], arguments[7], Convert::ToDouble(arguments[1]), Convert::ToDouble(arguments[2]), Convert::ToBool(arguments[3]), triggeredBy, Convert::ToDouble(arguments[5])); @@ -1143,7 +1143,7 @@ void ExternalCommandProcessor::ScheduleServicegroupSvcDowntime(double, const std triggeredBy = Service::GetDowntimeIDFromLegacyID(triggeredByLegacy); BOOST_FOREACH(const Service::Ptr& service, sg->GetMembers()) { - Log(LogNotice, "icinga", "Creating downtime for service " + service->GetName()); + Log(LogNotice, "ExternalCommandProcessor", "Creating downtime for service " + service->GetName()); (void) service->AddDowntime(arguments[6], arguments[7], Convert::ToDouble(arguments[1]), Convert::ToDouble(arguments[2]), Convert::ToBool(arguments[3]), triggeredBy, Convert::ToDouble(arguments[5])); @@ -1157,14 +1157,14 @@ void ExternalCommandProcessor::AddHostComment(double, const std::vector& if (!host) BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot add host comment for non-existent host '" + arguments[0] + "'")); - Log(LogNotice, "icinga", "Creating comment for host " + host->GetName()); + Log(LogNotice, "ExternalCommandProcessor", "Creating comment for host " + host->GetName()); (void) host->AddComment(CommentUser, arguments[2], arguments[3], 0); } void ExternalCommandProcessor::DelHostComment(double, const std::vector& arguments) { int id = Convert::ToLong(arguments[0]); - Log(LogNotice, "icinga", "Removing comment ID " + arguments[0]); + Log(LogNotice, "ExternalCommandProcessor", "Removing comment ID " + arguments[0]); String rid = Service::GetCommentIDFromLegacyID(id); Service::RemoveComment(rid); } @@ -1176,14 +1176,14 @@ void ExternalCommandProcessor::AddSvcComment(double, const std::vector& if (!service) BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot add service comment for non-existent service '" + arguments[1] + "' on host '" + arguments[0] + "'")); - Log(LogNotice, "icinga", "Creating comment for service " + service->GetName()); + Log(LogNotice, "ExternalCommandProcessor", "Creating comment for service " + service->GetName()); (void) service->AddComment(CommentUser, arguments[3], arguments[4], 0); } void ExternalCommandProcessor::DelSvcComment(double, const std::vector& arguments) { int id = Convert::ToLong(arguments[0]); - Log(LogNotice, "icinga", "Removing comment ID " + arguments[0]); + Log(LogNotice, "ExternalCommandProcessor", "Removing comment ID " + arguments[0]); String rid = Service::GetCommentIDFromLegacyID(id); Service::RemoveComment(rid); @@ -1196,7 +1196,7 @@ void ExternalCommandProcessor::DelAllHostComments(double, const std::vectorGetName()); + Log(LogNotice, "ExternalCommandProcessor", "Removing all comments for host " + host->GetName()); host->RemoveAllComments(); } @@ -1207,7 +1207,7 @@ void ExternalCommandProcessor::DelAllSvcComments(double, const std::vectorGetName()); + Log(LogNotice, "ExternalCommandProcessor", "Removing all comments for service " + service->GetName()); service->RemoveAllComments(); } @@ -1220,7 +1220,7 @@ void ExternalCommandProcessor::SendCustomHostNotification(double, const std::vec int options = Convert::ToLong(arguments[1]); - Log(LogNotice, "icinga", "Sending custom notification for host " + host->GetName()); + Log(LogNotice, "ExternalCommandProcessor", "Sending custom notification for host " + host->GetName()); if (options & 2) { ObjectLock olock(host); host->SetForceNextNotification(true); @@ -1238,7 +1238,7 @@ void ExternalCommandProcessor::SendCustomSvcNotification(double, const std::vect int options = Convert::ToLong(arguments[2]); - Log(LogNotice, "icinga", "Sending custom notification for service " + service->GetName()); + Log(LogNotice, "ExternalCommandProcessor", "Sending custom notification for service " + service->GetName()); if (options & 2) { ObjectLock olock(service); @@ -1255,7 +1255,7 @@ void ExternalCommandProcessor::DelayHostNotification(double, const std::vectorGetName() + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Delaying notifications for host '" + host->GetName() + "'"); BOOST_FOREACH(const Notification::Ptr& notification, host->GetNotifications()) { ObjectLock olock(notification); @@ -1271,7 +1271,7 @@ void ExternalCommandProcessor::DelaySvcNotification(double, const std::vectorGetName()); + Log(LogNotice, "ExternalCommandProcessor", "Delaying notifications for service " + service->GetName()); BOOST_FOREACH(const Notification::Ptr& notification, service->GetNotifications()) { ObjectLock olock(notification); @@ -1287,7 +1287,7 @@ void ExternalCommandProcessor::EnableHostNotifications(double, const std::vector if (!host) BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot enable host notifications for non-existent host '" + arguments[0] + "'")); - Log(LogNotice, "icinga", "Enabling notifications for host '" + arguments[0] + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Enabling notifications for host '" + arguments[0] + "'"); { ObjectLock olock(host); @@ -1303,7 +1303,7 @@ void ExternalCommandProcessor::DisableHostNotifications(double, const std::vecto if (!host) BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot disable host notifications for non-existent host '" + arguments[0] + "'")); - Log(LogNotice, "icinga", "Disabling notifications for host '" + arguments[0] + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Disabling notifications for host '" + arguments[0] + "'"); { ObjectLock olock(host); @@ -1319,7 +1319,7 @@ void ExternalCommandProcessor::EnableSvcNotifications(double, const std::vector< if (!service) BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot enable service notifications for non-existent service '" + arguments[1] + "' on host '" + arguments[0] + "'")); - Log(LogNotice, "icinga", "Enabling notifications for service '" + arguments[1] + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Enabling notifications for service '" + arguments[1] + "'"); { ObjectLock olock(service); @@ -1335,7 +1335,7 @@ void ExternalCommandProcessor::DisableSvcNotifications(double, const std::vector if (!service) BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot disable service notifications for non-existent service '" + arguments[1] + "' on host '" + arguments[0] + "'")); - Log(LogNotice, "icinga", "Disabling notifications for service '" + arguments[1] + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Disabling notifications for service '" + arguments[1] + "'"); { ObjectLock olock(service); @@ -1352,7 +1352,7 @@ void ExternalCommandProcessor::DisableHostgroupHostChecks(double, const std::vec BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot disable hostgroup host checks for non-existent hostgroup '" + arguments[0] + "'")); BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) { - Log(LogNotice, "icinga", "Disabling active checks for host '" + host->GetName() + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Disabling active checks for host '" + host->GetName() + "'"); { ObjectLock olock(host); @@ -1370,7 +1370,7 @@ void ExternalCommandProcessor::DisableHostgroupPassiveHostChecks(double, const s BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot disable hostgroup passive host checks for non-existent hostgroup '" + arguments[0] + "'")); BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) { - Log(LogNotice, "icinga", "Disabling passive checks for host '" + host->GetName() + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Disabling passive checks for host '" + host->GetName() + "'"); { ObjectLock olock(host); @@ -1390,7 +1390,7 @@ void ExternalCommandProcessor::DisableServicegroupHostChecks(double, const std:: BOOST_FOREACH(const Service::Ptr& service, sg->GetMembers()) { Host::Ptr host = service->GetHost(); - Log(LogNotice, "icinga", "Disabling active checks for host '" + host->GetName() + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Disabling active checks for host '" + host->GetName() + "'"); { ObjectLock olock(host); @@ -1410,7 +1410,7 @@ void ExternalCommandProcessor::DisableServicegroupPassiveHostChecks(double, cons BOOST_FOREACH(const Service::Ptr& service, sg->GetMembers()) { Host::Ptr host = service->GetHost(); - Log(LogNotice, "icinga", "Disabling passive checks for host '" + host->GetName() + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Disabling passive checks for host '" + host->GetName() + "'"); { ObjectLock olock(host); @@ -1428,7 +1428,7 @@ void ExternalCommandProcessor::EnableHostgroupHostChecks(double, const std::vect BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot enable hostgroup host checks for non-existent hostgroup '" + arguments[0] + "'")); BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) { - Log(LogNotice, "icinga", "Enabling active checks for host '" + host->GetName() + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Enabling active checks for host '" + host->GetName() + "'"); { ObjectLock olock(host); @@ -1446,7 +1446,7 @@ void ExternalCommandProcessor::EnableHostgroupPassiveHostChecks(double, const st BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot enable hostgroup passive host checks for non-existent hostgroup '" + arguments[0] + "'")); BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) { - Log(LogNotice, "icinga", "Enabling passive checks for host '" + host->GetName() + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Enabling passive checks for host '" + host->GetName() + "'"); { ObjectLock olock(host); @@ -1466,7 +1466,7 @@ void ExternalCommandProcessor::EnableServicegroupHostChecks(double, const std::v BOOST_FOREACH(const Service::Ptr& service, sg->GetMembers()) { Host::Ptr host = service->GetHost(); - Log(LogNotice, "icinga", "Enabling active checks for host '" + host->GetName() + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Enabling active checks for host '" + host->GetName() + "'"); { ObjectLock olock(host); @@ -1486,7 +1486,7 @@ void ExternalCommandProcessor::EnableServicegroupPassiveHostChecks(double, const BOOST_FOREACH(const Service::Ptr& service, sg->GetMembers()) { Host::Ptr host = service->GetHost(); - Log(LogNotice, "icinga", "Enabling passive checks for host '" + host->GetName() + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Enabling passive checks for host '" + host->GetName() + "'"); { ObjectLock olock(host); @@ -1503,7 +1503,7 @@ void ExternalCommandProcessor::EnableHostFlapping(double, const std::vector&) { - Log(LogNotice, "icinga", "Globally enabling notifications."); + Log(LogNotice, "ExternalCommandProcessor", "Globally enabling notifications."); IcingaApplication::GetInstance()->SetEnableNotifications(true); } void ExternalCommandProcessor::DisableNotifications(double, const std::vector&) { - Log(LogNotice, "icinga", "Globally disabling notifications."); + Log(LogNotice, "ExternalCommandProcessor", "Globally disabling notifications."); IcingaApplication::GetInstance()->SetEnableNotifications(false); } void ExternalCommandProcessor::EnableFlapDetection(double, const std::vector&) { - Log(LogNotice, "icinga", "Globally enabling flap detection."); + Log(LogNotice, "ExternalCommandProcessor", "Globally enabling flap detection."); IcingaApplication::GetInstance()->SetEnableFlapping(true); } void ExternalCommandProcessor::DisableFlapDetection(double, const std::vector&) { - Log(LogNotice, "icinga", "Globally disabling flap detection."); + Log(LogNotice, "ExternalCommandProcessor", "Globally disabling flap detection."); IcingaApplication::GetInstance()->SetEnableFlapping(false); } void ExternalCommandProcessor::EnableEventHandlers(double, const std::vector&) { - Log(LogNotice, "icinga", "Globally enabling event handlers."); + Log(LogNotice, "ExternalCommandProcessor", "Globally enabling event handlers."); IcingaApplication::GetInstance()->SetEnableEventHandlers(true); } void ExternalCommandProcessor::DisableEventHandlers(double, const std::vector&) { - Log(LogNotice, "icinga", "Globally disabling event handlers."); + Log(LogNotice, "ExternalCommandProcessor", "Globally disabling event handlers."); IcingaApplication::GetInstance()->SetEnableEventHandlers(false); } void ExternalCommandProcessor::EnablePerformanceData(double, const std::vector&) { - Log(LogNotice, "icinga", "Globally enabling performance data processing."); + Log(LogNotice, "ExternalCommandProcessor", "Globally enabling performance data processing."); IcingaApplication::GetInstance()->SetEnablePerfdata(true); } void ExternalCommandProcessor::DisablePerformanceData(double, const std::vector&) { - Log(LogNotice, "icinga", "Globally disabling performance data processing."); + Log(LogNotice, "ExternalCommandProcessor", "Globally disabling performance data processing."); IcingaApplication::GetInstance()->SetEnablePerfdata(false); } void ExternalCommandProcessor::StartExecutingSvcChecks(double, const std::vector&) { - Log(LogNotice, "icinga", "Globally enabling service checks."); + Log(LogNotice, "ExternalCommandProcessor", "Globally enabling service checks."); IcingaApplication::GetInstance()->SetEnableServiceChecks(true); } void ExternalCommandProcessor::StopExecutingSvcChecks(double, const std::vector&) { - Log(LogNotice, "icinga", "Globally disabling service checks."); + Log(LogNotice, "ExternalCommandProcessor", "Globally disabling service checks."); IcingaApplication::GetInstance()->SetEnableServiceChecks(false); } void ExternalCommandProcessor::StartExecutingHostChecks(double, const std::vector&) { - Log(LogNotice, "icinga", "Globally enabling host checks."); + Log(LogNotice, "ExternalCommandProcessor", "Globally enabling host checks."); IcingaApplication::GetInstance()->SetEnableHostChecks(true); } void ExternalCommandProcessor::StopExecutingHostChecks(double, const std::vector&) { - Log(LogNotice, "icinga", "Globally disabling host checks."); + Log(LogNotice, "ExternalCommandProcessor", "Globally disabling host checks."); IcingaApplication::GetInstance()->SetEnableHostChecks(false); } @@ -1653,7 +1653,7 @@ void ExternalCommandProcessor::ChangeSvcModattr(double, const std::vectorGetName() + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Updating modified attributes for command '" + command->GetName() + "'"); { ObjectLock olock(command); @@ -1748,7 +1748,7 @@ void ExternalCommandProcessor::ChangeNormalSvcCheckInterval(double, const std::v double interval = Convert::ToDouble(arguments[2]); - Log(LogNotice, "icinga", "Updating check interval for service '" + arguments[1] + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Updating check interval for service '" + arguments[1] + "'"); { ObjectLock olock(service); @@ -1764,7 +1764,7 @@ void ExternalCommandProcessor::ChangeNormalHostCheckInterval(double, const std:: if (!host) BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot update check interval for non-existent host '" + arguments[0] + "'")); - Log(LogNotice, "icinga", "Updating check interval for host '" + arguments[0] + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Updating check interval for host '" + arguments[0] + "'"); double interval = Convert::ToDouble(arguments[1]); @@ -1784,7 +1784,7 @@ void ExternalCommandProcessor::ChangeRetrySvcCheckInterval(double, const std::ve double interval = Convert::ToDouble(arguments[2]); - Log(LogNotice, "icinga", "Updating retry interval for service '" + arguments[1] + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Updating retry interval for service '" + arguments[1] + "'"); { ObjectLock olock(service); @@ -1800,7 +1800,7 @@ void ExternalCommandProcessor::ChangeRetryHostCheckInterval(double, const std::v if (!host) BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot update retry interval for non-existent host '" + arguments[0] + "'")); - Log(LogNotice, "icinga", "Updating retry interval for host '" + arguments[0] + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Updating retry interval for host '" + arguments[0] + "'"); double interval = Convert::ToDouble(arguments[1]); @@ -1818,7 +1818,7 @@ void ExternalCommandProcessor::EnableHostEventHandler(double, const std::vector< if (!host) BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot enable event handler for non-existent host '" + arguments[0] + "'")); - Log(LogNotice, "icinga", "Enabling event handler for host '" + arguments[0] + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Enabling event handler for host '" + arguments[0] + "'"); { ObjectLock olock(host); @@ -1834,7 +1834,7 @@ void ExternalCommandProcessor::DisableHostEventHandler(double, const std::vector if (!host) BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot disable event handler for non-existent host '" + arguments[0] + "'")); - Log(LogNotice, "icinga", "Disabling event handler for host '" + arguments[0] + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Disabling event handler for host '" + arguments[0] + "'"); { ObjectLock olock(host); @@ -1850,7 +1850,7 @@ void ExternalCommandProcessor::EnableSvcEventHandler(double, const std::vectorSet(arguments[1], arguments[2]); - Log(LogNotice, "icinga", "Changing custom var '" + arguments[1] + "' for host '" + arguments[0] + "' to value '" + arguments[2] + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Changing custom var '" + arguments[1] + "' for host '" + arguments[0] + "' to value '" + arguments[2] + "'"); { ObjectLock olock(host); @@ -2089,7 +2089,7 @@ void ExternalCommandProcessor::ChangeCustomSvcVar(double, const std::vectorSet(arguments[2], arguments[3]); - Log(LogNotice, "icinga", "Changing custom var '" + arguments[2] + "' for service '" + arguments[1] + "' on host '" + + Log(LogNotice, "ExternalCommandProcessor", "Changing custom var '" + arguments[2] + "' for service '" + arguments[1] + "' on host '" + arguments[0] + "' to value '" + arguments[3] + "'"); { @@ -2115,7 +2115,7 @@ void ExternalCommandProcessor::ChangeCustomUserVar(double, const std::vectorSet(arguments[1], arguments[2]); - Log(LogNotice, "icinga", "Changing custom var '" + arguments[1] + "' for user '" + arguments[0] + "' to value '" + arguments[2] + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Changing custom var '" + arguments[1] + "' for user '" + arguments[0] + "' to value '" + arguments[2] + "'"); { ObjectLock olock(user); @@ -2165,7 +2165,7 @@ void ExternalCommandProcessor::ChangeCustomCommandVarInternal(const Command::Ptr override_vars->Set(name, value); - Log(LogNotice, "icinga", "Changing custom var '" + name + "' for command '" + command->GetName() + "' to value '" + Convert::ToString(value) + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Changing custom var '" + name + "' for command '" + command->GetName() + "' to value '" + Convert::ToString(value) + "'"); { ObjectLock olock(command); @@ -2182,7 +2182,7 @@ void ExternalCommandProcessor::EnableHostgroupHostNotifications(double, const st BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot enable host notifications for non-existent hostgroup '" + arguments[0] + "'")); BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) { - Log(LogNotice, "icinga", "Enabling notifications for host '" + host->GetName() + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Enabling notifications for host '" + host->GetName() + "'"); { ObjectLock olock(host); @@ -2201,7 +2201,7 @@ void ExternalCommandProcessor::EnableHostgroupSvcNotifications(double, const std BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) { BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) { - Log(LogNotice, "icinga", "Enabling notifications for service '" + service->GetName() + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Enabling notifications for service '" + service->GetName() + "'"); { ObjectLock olock(service); @@ -2220,7 +2220,7 @@ void ExternalCommandProcessor::DisableHostgroupHostNotifications(double, const s BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot disable host notifications for non-existent hostgroup '" + arguments[0] + "'")); BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) { - Log(LogNotice, "icinga", "Disabling notifications for host '" + host->GetName() + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Disabling notifications for host '" + host->GetName() + "'"); { ObjectLock olock(host); @@ -2239,7 +2239,7 @@ void ExternalCommandProcessor::DisableHostgroupSvcNotifications(double, const st BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) { BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) { - Log(LogNotice, "icinga", "Disabling notifications for service '" + service->GetName() + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Disabling notifications for service '" + service->GetName() + "'"); { ObjectLock olock(service); @@ -2260,7 +2260,7 @@ void ExternalCommandProcessor::EnableServicegroupHostNotifications(double, const BOOST_FOREACH(const Service::Ptr& service, sg->GetMembers()) { Host::Ptr host = service->GetHost(); - Log(LogNotice, "icinga", "Enabling notifications for host '" + host->GetName() + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Enabling notifications for host '" + host->GetName() + "'"); { ObjectLock olock(host); @@ -2278,7 +2278,7 @@ void ExternalCommandProcessor::EnableServicegroupSvcNotifications(double, const BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot enable service notifications for non-existent servicegroup '" + arguments[0] + "'")); BOOST_FOREACH(const Service::Ptr& service, sg->GetMembers()) { - Log(LogNotice, "icinga", "Enabling notifications for service '" + service->GetName() + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Enabling notifications for service '" + service->GetName() + "'"); { ObjectLock olock(service); @@ -2298,7 +2298,7 @@ void ExternalCommandProcessor::DisableServicegroupHostNotifications(double, cons BOOST_FOREACH(const Service::Ptr& service, sg->GetMembers()) { Host::Ptr host = service->GetHost(); - Log(LogNotice, "icinga", "Disabling notifications for host '" + host->GetName() + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Disabling notifications for host '" + host->GetName() + "'"); { ObjectLock olock(host); @@ -2316,7 +2316,7 @@ void ExternalCommandProcessor::DisableServicegroupSvcNotifications(double, const BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot disable service notifications for non-existent servicegroup '" + arguments[0] + "'")); BOOST_FOREACH(const Service::Ptr& service, sg->GetMembers()) { - Log(LogNotice, "icinga", "Disabling notifications for service '" + service->GetName() + "'"); + Log(LogNotice, "ExternalCommandProcessor", "Disabling notifications for service '" + service->GetName() + "'"); { ObjectLock olock(service); diff --git a/lib/icinga/hostgroup.cpp b/lib/icinga/hostgroup.cpp index 0274998bc..144b9a986 100644 --- a/lib/icinga/hostgroup.cpp +++ b/lib/icinga/hostgroup.cpp @@ -53,13 +53,13 @@ bool HostGroup::EvaluateObjectRuleOne(const Host::Ptr host, const ObjectRule& ru std::ostringstream msgbuf2; msgbuf2 << "Assigning membership for group '" << rule.GetName() << "' to host '" << host->GetName() << "' for rule " << di; - Log(LogDebug, "icinga", msgbuf2.str()); + Log(LogDebug, "HostGroup", msgbuf2.str()); String group_name = rule.GetName(); HostGroup::Ptr group = HostGroup::GetByName(group_name); if (!group) { - Log(LogCritical, "icinga", "Invalid membership assignment. Group '" + group_name + "' does not exist."); + Log(LogCritical, "HostGroup", "Invalid membership assignment. Group '" + group_name + "' does not exist."); return false; } @@ -113,7 +113,7 @@ void HostGroup::RemoveMember(const Host::Ptr& host) bool HostGroup::ResolveGroupMembership(Host::Ptr const& host, bool add, int rstack) { if (add && rstack > 20) { - Log(LogWarning, "icinga", "Too many nested groups for group '" + GetName() + "': Host '" + + Log(LogWarning, "HostGroup", "Too many nested groups for group '" + GetName() + "': Host '" + host->GetName() + "' membership assignment failed."); return false; diff --git a/lib/icinga/icingaapplication.cpp b/lib/icinga/icingaapplication.cpp index 987720ed9..9d428cb09 100644 --- a/lib/icinga/icingaapplication.cpp +++ b/lib/icinga/icingaapplication.cpp @@ -82,7 +82,7 @@ Value IcingaApplication::StatsFunc(Dictionary::Ptr& status, Dictionary::Ptr& per */ int IcingaApplication::Main(void) { - Log(LogDebug, "icinga", "In IcingaApplication::Main()"); + Log(LogDebug, "IcingaApplication", "In IcingaApplication::Main()"); /* periodically dump the program state */ l_RetentionTimer = make_shared(); @@ -92,7 +92,7 @@ int IcingaApplication::Main(void) RunEventLoop(); - Log(LogInformation, "icinga", "Icinga has shut down."); + Log(LogInformation, "IcingaApplication", "Icinga has shut down."); return EXIT_SUCCESS; } diff --git a/lib/icinga/icingastatuswriter.cpp b/lib/icinga/icingastatuswriter.cpp index f238c08c7..807c3817e 100644 --- a/lib/icinga/icingastatuswriter.cpp +++ b/lib/icinga/icingastatuswriter.cpp @@ -141,7 +141,7 @@ Dictionary::Ptr IcingaStatusWriter::GetStatusData(void) void IcingaStatusWriter::StatusTimerHandler(void) { - Log(LogInformation, "icinga", "Writing status.json file"); + Log(LogNotice, "IcingaStatusWriter", "Writing status.json file"); String statuspath = GetStatusPath(); String statuspathtmp = statuspath + ".tmp"; /* XXX make this a global definition */ @@ -166,6 +166,6 @@ void IcingaStatusWriter::StatusTimerHandler(void) << boost::errinfo_file_name(statuspathtmp)); } - Log(LogInformation, "icinga", "Finished writing status.json file"); + Log(LogNotice, "IcingaStatusWriter", "Finished writing status.json file"); } diff --git a/lib/icinga/legacytimeperiod.cpp b/lib/icinga/legacytimeperiod.cpp index 469cbd09f..a1c70a655 100644 --- a/lib/icinga/legacytimeperiod.cpp +++ b/lib/icinga/legacytimeperiod.cpp @@ -323,7 +323,7 @@ bool LegacyTimePeriod::IsInDayDefinition(const String& daydef, tm *reference) ParseTimeRange(daydef, &begin, &end, &stride, reference); - Log(LogDebug, "icinga", "ParseTimeRange: '" + daydef + "' => " + Convert::ToString(static_cast(mktime(&begin))) + " -> " + Convert::ToString(static_cast(mktime(&end))) + ", stride: " + Convert::ToString(stride)); + Log(LogDebug, "LegacyTimePeriod", "ParseTimeRange: '" + daydef + "' => " + Convert::ToString(static_cast(mktime(&begin))) + " -> " + Convert::ToString(static_cast(mktime(&end))) + ", stride: " + Convert::ToString(stride)); return IsInTimeRange(&begin, &end, stride, reference); } @@ -451,20 +451,20 @@ Array::Ptr LegacyTimePeriod::ScriptFunc(const TimePeriod::Ptr& tp, double begin, tm reference = Utility::LocalTime(refts); #ifdef _DEBUG - Log(LogDebug, "icinga", "Checking reference time " + Convert::ToString(static_cast(refts))); + Log(LogDebug, "LegacyTimePeriod", "Checking reference time " + Convert::ToString(static_cast(refts))); #endif /* _DEBUG */ ObjectLock olock(ranges); BOOST_FOREACH(const Dictionary::Pair& kv, ranges) { if (!IsInDayDefinition(kv.first, &reference)) { #ifdef _DEBUG - Log(LogDebug, "icinga", "Not in day definition '" + kv.first + "'."); + Log(LogDebug, "LegacyTimePeriod", "Not in day definition '" + kv.first + "'."); #endif /* _DEBUG */ continue; } #ifdef _DEBUG - Log(LogDebug, "icinga", "In day definition '" + kv.first + "'."); + Log(LogDebug, "LegacyTimePeriod", "In day definition '" + kv.first + "'."); #endif /* _DEBUG */ ProcessTimeRanges(kv.second, &reference, segments); @@ -472,7 +472,7 @@ Array::Ptr LegacyTimePeriod::ScriptFunc(const TimePeriod::Ptr& tp, double begin, } } - Log(LogDebug, "icinga", "Legacy timeperiod update returned " + Convert::ToString(static_cast(segments->GetLength())) + " segments."); + Log(LogDebug, "LegacyTimePeriod", "Legacy timeperiod update returned " + Convert::ToString(static_cast(segments->GetLength())) + " segments."); return segments; } diff --git a/lib/icinga/macroprocessor.cpp b/lib/icinga/macroprocessor.cpp index 667e44b18..cd2d84562 100644 --- a/lib/icinga/macroprocessor.cpp +++ b/lib/icinga/macroprocessor.cpp @@ -183,7 +183,7 @@ String MacroProcessor::InternalResolveMacros(const String& str, const ResolverLi if (!found) { if (!missingMacro) - Log(LogWarning, "icinga", "Macro '" + name + "' is not defined."); + Log(LogWarning, "MacroProcessor", "Macro '" + name + "' is not defined."); else *missingMacro = name; } diff --git a/lib/icinga/notification-apply.cpp b/lib/icinga/notification-apply.cpp index ea04f9630..3af98fba9 100644 --- a/lib/icinga/notification-apply.cpp +++ b/lib/icinga/notification-apply.cpp @@ -62,7 +62,7 @@ bool Notification::EvaluateApplyRuleOne(const Checkable::Ptr& checkable, const A std::ostringstream msgbuf2; msgbuf2 << "Applying notification '" << rule.GetName() << "' to object '" << checkable->GetName() << "' for rule " << di; - Log(LogDebug, "icinga", msgbuf2.str()); + Log(LogDebug, "Notification", msgbuf2.str()); ConfigItemBuilder::Ptr builder = make_shared(di); builder->SetType("Notification"); @@ -115,7 +115,7 @@ void Notification::EvaluateApplyRule(const ApplyRule& rule) } if (apply_count == 0) - Log(LogWarning, "icinga", "Apply rule '" + rule.GetName() + "' for host does not match anywhere!"); + Log(LogWarning, "Notification", "Apply rule '" + rule.GetName() + "' for host does not match anywhere!"); } else if (rule.GetTargetType() == "Service") { apply_count = 0; @@ -128,10 +128,10 @@ void Notification::EvaluateApplyRule(const ApplyRule& rule) } if (apply_count == 0) - Log(LogWarning, "icinga", "Apply rule '" + rule.GetName() + "' for service does not match anywhere!"); + Log(LogWarning, "Notification", "Apply rule '" + rule.GetName() + "' for service does not match anywhere!"); } else { - Log(LogWarning, "icinga", "Wrong target type for apply rule '" + rule.GetName() + "'!"); + Log(LogWarning, "Notification", "Wrong target type for apply rule '" + rule.GetName() + "'!"); } } void Notification::EvaluateApplyRules(const std::vector& rules) diff --git a/lib/icinga/notification.cpp b/lib/icinga/notification.cpp index d3d1615d9..aed249350 100644 --- a/lib/icinga/notification.cpp +++ b/lib/icinga/notification.cpp @@ -231,7 +231,7 @@ void Notification::BeginExecuteNotification(NotificationType type, const CheckRe TimePeriod::Ptr tp = GetPeriod(); if (tp && !tp->IsInside(Utility::GetTime())) { - Log(LogNotice, "icinga", "Not sending notifications for notification object '" + GetName() + "': not in timeperiod"); + Log(LogNotice, "Notification", "Not sending notifications for notification object '" + GetName() + "': not in timeperiod"); return; } @@ -240,22 +240,22 @@ void Notification::BeginExecuteNotification(NotificationType type, const CheckRe if (type == NotificationProblem) { if (times && times->Contains("begin") && now < checkable->GetLastHardStateChange() + times->Get("begin")) { - Log(LogNotice, "icinga", "Not sending notifications for notification object '" + GetName() + "': before escalation range"); + Log(LogNotice, "Notification", "Not sending notifications for notification object '" + GetName() + "': before escalation range"); return; } if (times && times->Contains("end") && now > checkable->GetLastHardStateChange() + times->Get("end")) { - Log(LogNotice, "icinga", "Not sending notifications for notification object '" + GetName() + "': after escalation range"); + Log(LogNotice, "Notification", "Not sending notifications for notification object '" + GetName() + "': after escalation range"); return; } } unsigned long ftype = 1 << type; - Log(LogDebug, "icinga", "FType=" + Convert::ToString(ftype) + ", TypeFilter=" + Convert::ToString(GetTypeFilter())); + Log(LogDebug, "Notification", "FType=" + Convert::ToString(ftype) + ", TypeFilter=" + Convert::ToString(GetTypeFilter())); if (!(ftype & GetTypeFilter())) { - Log(LogNotice, "icinga", "Not sending notifications for notification object '" + GetName() + "': type filter does not match"); + Log(LogNotice, "Notification", "Not sending notifications for notification object '" + GetName() + "': type filter does not match"); return; } @@ -271,7 +271,7 @@ void Notification::BeginExecuteNotification(NotificationType type, const CheckRe fstate = HostStateToFilter(host->GetState()); if (!(fstate & GetStateFilter())) { - Log(LogNotice, "icinga", "Not sending notifications for notification object '" + GetName() + "': state filter does not match"); + Log(LogNotice, "Notification", "Not sending notifications for notification object '" + GetName() + "': state filter does not match"); return; } } @@ -303,7 +303,7 @@ void Notification::BeginExecuteNotification(NotificationType type, const CheckRe if (!CheckNotificationUserFilters(type, user, force)) continue; - Log(LogInformation, "icinga", "Sending notification for user '" + user->GetName() + "'"); + Log(LogInformation, "Notification", "Sending notification for user '" + user->GetName() + "'"); Utility::QueueAsyncCallback(boost::bind(&Notification::ExecuteNotificationHelper, this, type, user, cr, force, author, text)); /* collect all notified users */ @@ -322,7 +322,7 @@ bool Notification::CheckNotificationUserFilters(NotificationType type, const Use TimePeriod::Ptr tp = user->GetPeriod(); if (tp && !tp->IsInside(Utility::GetTime())) { - Log(LogNotice, "icinga", "Not sending notifications for notification object '" + + Log(LogNotice, "Notification", "Not sending notifications for notification object '" + GetName() + " and user '" + user->GetName() + "': user not in timeperiod"); return false; } @@ -330,7 +330,7 @@ bool Notification::CheckNotificationUserFilters(NotificationType type, const Use unsigned long ftype = 1 << type; if (!(ftype & user->GetTypeFilter())) { - Log(LogNotice, "icinga", "Not sending notifications for notification object '" + + Log(LogNotice, "Notification", "Not sending notifications for notification object '" + GetName() + " and user '" + user->GetName() + "': type filter does not match"); return false; } @@ -348,7 +348,7 @@ bool Notification::CheckNotificationUserFilters(NotificationType type, const Use fstate = HostStateToFilter(host->GetState()); if (!(fstate & user->GetStateFilter())) { - Log(LogNotice, "icinga", "Not sending notifications for notification object '" + + Log(LogNotice, "Notification", "Not sending notifications for notification object '" + GetName() + " and user '" + user->GetName() + "': state filter does not match"); return false; } @@ -365,7 +365,7 @@ void Notification::ExecuteNotificationHelper(NotificationType type, const User:: NotificationCommand::Ptr command = GetCommand(); if (!command) { - Log(LogDebug, "icinga", "No notification_command found for notification '" + GetName() + "'. Skipping execution."); + Log(LogDebug, "Notification", "No notification_command found for notification '" + GetName() + "'. Skipping execution."); return; } @@ -380,12 +380,12 @@ void Notification::ExecuteNotificationHelper(NotificationType type, const User:: /* required by compatlogger */ Service::OnNotificationSentToUser(GetSelf(), GetCheckable(), user, type, cr, author, text, command->GetName()); - Log(LogInformation, "icinga", "Completed sending notification for object '" + GetCheckable()->GetName() + "'"); + Log(LogInformation, "Notification", "Completed sending notification for object '" + GetCheckable()->GetName() + "'"); } catch (const std::exception& ex) { std::ostringstream msgbuf; msgbuf << "Exception occured during notification for object '" << GetCheckable()->GetName() << "': " << DiagnosticInformation(ex); - Log(LogWarning, "icinga", msgbuf.str()); + Log(LogWarning, "Notification", msgbuf.str()); } } diff --git a/lib/icinga/pluginutility.cpp b/lib/icinga/pluginutility.cpp index 11628c763..c651b60bd 100644 --- a/lib/icinga/pluginutility.cpp +++ b/lib/icinga/pluginutility.cpp @@ -122,7 +122,7 @@ void PluginUtility::ExecuteCommand(const Command::Ptr& commandObj, const Checkab String message = "Non-optional macro '" + missingMacro + "' used in argument '" + arg.Key + "' is missing while executing command '" + commandObj->GetName() + "' for object '" + checkable->GetName() + "'"; - Log(LogWarning, "methods", message); + Log(LogWarning, "PluginUtility", message); if (callback) { ProcessResult pr; diff --git a/lib/icinga/scheduleddowntime-apply.cpp b/lib/icinga/scheduleddowntime-apply.cpp index 8cc98ad54..7d2ecae79 100644 --- a/lib/icinga/scheduleddowntime-apply.cpp +++ b/lib/icinga/scheduleddowntime-apply.cpp @@ -61,7 +61,7 @@ bool ScheduledDowntime::EvaluateApplyRule(const Checkable::Ptr& checkable, const std::ostringstream msgbuf2; msgbuf2 << "Applying scheduled downtime '" << rule.GetName() << "' to object '" << checkable->GetName() << "' for rule " << di; - Log(LogDebug, "icinga", msgbuf2.str()); + Log(LogDebug, "ScheduledDowntime", msgbuf2.str()); ConfigItemBuilder::Ptr builder = make_shared(di); builder->SetType("ScheduledDowntime"); @@ -115,7 +115,7 @@ void ScheduledDowntime::EvaluateApplyRules(const std::vector& rules) } if (apply_count == 0) - Log(LogWarning, "icinga", "Apply rule '" + rule.GetName() + "' for host does not match anywhere!"); + Log(LogWarning, "ScheduledDowntime", "Apply rule '" + rule.GetName() + "' for host does not match anywhere!"); } else if (rule.GetTargetType() == "Service") { apply_count = 0; @@ -128,10 +128,10 @@ void ScheduledDowntime::EvaluateApplyRules(const std::vector& rules) } if (apply_count == 0) - Log(LogWarning, "icinga", "Apply rule '" + rule.GetName() + "' for service does not match anywhere!"); + Log(LogWarning, "ScheduledDowntime", "Apply rule '" + rule.GetName() + "' for service does not match anywhere!"); } else { - Log(LogWarning, "icinga", "Wrong target type for apply rule '" + rule.GetName() + "'!"); + Log(LogWarning, "ScheduledDowntime", "Wrong target type for apply rule '" + rule.GetName() + "'!"); } } } diff --git a/lib/icinga/scheduleddowntime.cpp b/lib/icinga/scheduleddowntime.cpp index db0746139..e71e9f6fc 100644 --- a/lib/icinga/scheduleddowntime.cpp +++ b/lib/icinga/scheduleddowntime.cpp @@ -91,7 +91,7 @@ std::pair ScheduledDowntime::FindNextSegment(void) time_t refts = Utility::GetTime(); tm reference = Utility::LocalTime(refts); - Log(LogDebug, "icinga", "Finding next scheduled downtime segment for time " + Convert::ToString(static_cast(refts))); + Log(LogDebug, "ScheduledDowntime", "Finding next scheduled downtime segment for time " + Convert::ToString(static_cast(refts))); Dictionary::Ptr ranges = GetRanges(); diff --git a/lib/icinga/service-apply.cpp b/lib/icinga/service-apply.cpp index 8a71e63df..3034b52d9 100644 --- a/lib/icinga/service-apply.cpp +++ b/lib/icinga/service-apply.cpp @@ -54,7 +54,7 @@ bool Service::EvaluateApplyRuleOne(const Host::Ptr& host, const ApplyRule& rule) std::ostringstream msgbuf2; msgbuf2 << "Applying service '" << rule.GetName() << "' to host '" << host->GetName() << "' for rule " << di; - Log(LogDebug, "icinga", msgbuf2.str()); + Log(LogDebug, "Service", msgbuf2.str()); ConfigItemBuilder::Ptr builder = make_shared(di); builder->SetType("Service"); @@ -102,7 +102,7 @@ void Service::EvaluateApplyRule(const ApplyRule& rule) } if (apply_count == 0) - Log(LogWarning, "icinga", "Apply rule '" + rule.GetName() + "' for host does not match anywhere!"); + Log(LogWarning, "Service", "Apply rule '" + rule.GetName() + "' for host does not match anywhere!"); } void Service::EvaluateApplyRules(const std::vector& rules) diff --git a/lib/icinga/servicegroup.cpp b/lib/icinga/servicegroup.cpp index ef44f4653..d02719c07 100644 --- a/lib/icinga/servicegroup.cpp +++ b/lib/icinga/servicegroup.cpp @@ -56,13 +56,13 @@ bool ServiceGroup::EvaluateObjectRuleOne(const Service::Ptr service, const Objec std::ostringstream msgbuf2; msgbuf2 << "Assigning membership for group '" << rule.GetName() << "' to service '" << service->GetName() << "' for rule " << di; - Log(LogDebug, "icinga", msgbuf2.str()); + Log(LogDebug, "ServiceGroup", msgbuf2.str()); String group_name = rule.GetName(); ServiceGroup::Ptr group = ServiceGroup::GetByName(group_name); if (!group) { - Log(LogCritical, "icinga", "Invalid membership assignment. Group '" + group_name + "' does not exist."); + Log(LogCritical, "ServiceGroup", "Invalid membership assignment. Group '" + group_name + "' does not exist."); return false; } @@ -116,7 +116,7 @@ void ServiceGroup::RemoveMember(const Service::Ptr& service) bool ServiceGroup::ResolveGroupMembership(Service::Ptr const& service, bool add, int rstack) { if (add && rstack > 20) { - Log(LogWarning, "icinga", "Too many nested groups for group '" + GetName() + "': Service '" + + Log(LogWarning, "ServiceGroup", "Too many nested groups for group '" + GetName() + "': Service '" + service->GetName() + "' membership assignment failed."); return false; diff --git a/lib/icinga/timeperiod.cpp b/lib/icinga/timeperiod.cpp index 53477b0e9..085910266 100644 --- a/lib/icinga/timeperiod.cpp +++ b/lib/icinga/timeperiod.cpp @@ -55,7 +55,7 @@ void TimePeriod::AddSegment(double begin, double end) { ASSERT(OwnsLock()); - Log(LogDebug, "icinga", "Adding segment '" + Utility::FormatDateTime("%c", begin) + "' <-> '" + Utility::FormatDateTime("%c", end) + "' to TimePeriod '" + GetName() + "'"); + Log(LogDebug, "TimePeriod", "Adding segment '" + Utility::FormatDateTime("%c", begin) + "' <-> '" + Utility::FormatDateTime("%c", end) + "' to TimePeriod '" + GetName() + "'"); if (GetValidBegin().IsEmpty() || begin < GetValidBegin()) SetValidBegin(begin); @@ -106,7 +106,7 @@ void TimePeriod::RemoveSegment(double begin, double end) { ASSERT(OwnsLock()); - Log(LogDebug, "icinga", "Removing segment '" + Utility::FormatDateTime("%c", begin) + "' <-> '" + Utility::FormatDateTime("%c", end) + "' from TimePeriod '" + GetName() + "'"); + Log(LogDebug, "TimePeriod", "Removing segment '" + Utility::FormatDateTime("%c", begin) + "' <-> '" + Utility::FormatDateTime("%c", end) + "' from TimePeriod '" + GetName() + "'"); if (GetValidBegin().IsEmpty() || begin < GetValidBegin()) SetValidBegin(begin); @@ -154,7 +154,7 @@ void TimePeriod::PurgeSegments(double end) { ASSERT(OwnsLock()); - Log(LogDebug, "icinga", "Purging segments older than '" + Utility::FormatDateTime("%c", end) + "' from TimePeriod '" + GetName() + "'"); + Log(LogDebug, "TimePeriod", "Purging segments older than '" + Utility::FormatDateTime("%c", end) + "' from TimePeriod '" + GetName() + "'"); if (GetValidBegin().IsEmpty() || end < GetValidBegin()) return; @@ -275,17 +275,17 @@ void TimePeriod::Dump(void) { Array::Ptr segments = GetSegments(); - Log(LogDebug, "icinga", "Dumping TimePeriod '" + GetName() + "'"); - Log(LogDebug, "icinga", "Valid from '" + Utility::FormatDateTime("%c", GetValidBegin()) + "' until '" + Utility::FormatDateTime("%c", GetValidEnd())); + Log(LogDebug, "TimePeriod", "Dumping TimePeriod '" + GetName() + "'"); + Log(LogDebug, "TimePeriod", "Valid from '" + Utility::FormatDateTime("%c", GetValidBegin()) + "' until '" + Utility::FormatDateTime("%c", GetValidEnd())); if (segments) { ObjectLock dlock(segments); BOOST_FOREACH(const Dictionary::Ptr& segment, segments) { - Log(LogDebug, "icinga", "Segment: " + + Log(LogDebug, "TimePeriod", "Segment: " + Utility::FormatDateTime("%c", segment->Get("begin")) + " <-> " + Utility::FormatDateTime("%c", segment->Get("end"))); } } - Log(LogDebug, "icinga", "---"); + Log(LogDebug, "TimePeriod", "---"); } diff --git a/lib/icinga/usergroup.cpp b/lib/icinga/usergroup.cpp index fa085f597..6b8da4dcf 100644 --- a/lib/icinga/usergroup.cpp +++ b/lib/icinga/usergroup.cpp @@ -53,13 +53,13 @@ bool UserGroup::EvaluateObjectRuleOne(const User::Ptr user, const ObjectRule& ru std::ostringstream msgbuf2; msgbuf2 << "Assigning membership for group '" << rule.GetName() << "' to user '" << user->GetName() << "' for rule " << di; - Log(LogDebug, "icinga", msgbuf2.str()); + Log(LogDebug, "UserGroup", msgbuf2.str()); String group_name = rule.GetName(); UserGroup::Ptr group = UserGroup::GetByName(group_name); if (!group) { - Log(LogCritical, "icinga", "Invalid membership assignment. Group '" + group_name + "' does not exist."); + Log(LogCritical, "UserGroup", "Invalid membership assignment. Group '" + group_name + "' does not exist."); return false; } @@ -113,7 +113,7 @@ void UserGroup::RemoveMember(const User::Ptr& user) bool UserGroup::ResolveGroupMembership(User::Ptr const& user, bool add, int rstack) { if (add && rstack > 20) { - Log(LogWarning, "icinga", "Too many nested groups for group '" + GetName() + "': User '" + + Log(LogWarning, "UserGroup", "Too many nested groups for group '" + GetName() + "': User '" + user->GetName() + "' membership assignment failed."); return false;