From: Michael Friedrich Date: Mon, 1 Jul 2013 08:03:00 +0000 (+0200) Subject: compatlog: fix checkcommand name X-Git-Tag: v0.0.2~31 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cd48a4946a6bc97ed00626e2e24ff6d9134c010d;p=icinga2 compatlog: fix checkcommand name refs #4361 --- diff --git a/components/compat/compatlog.cpp b/components/compat/compatlog.cpp index 2f21b3a57..89a3c65e4 100644 --- a/components/compat/compatlog.cpp +++ b/components/compat/compatlog.cpp @@ -21,6 +21,7 @@ #include "icinga/checkresultmessage.h" #include "icinga/downtimemessage.h" #include "icinga/service.h" +#include "icinga/checkcommand.h" #include "icinga/notification.h" #include "icinga/notificationmessage.h" #include "icinga/macroprocessor.h" @@ -281,8 +282,6 @@ void CompatLog::DowntimeRequestHandler(const RequestMessage& request) */ void CompatLog::NotificationSentRequestHandler(const RequestMessage& request) { - Log(LogWarning, "compat", "Got notification"); - NotificationMessage params; if (!request.GetParams(¶ms)) return; @@ -290,8 +289,6 @@ void CompatLog::NotificationSentRequestHandler(const RequestMessage& request) String svcname = params.GetService(); Service::Ptr service = Service::GetByName(svcname); - Log(LogWarning, "compat", "Got notification for service" + svcname); - Host::Ptr host = service->GetHost(); if (!host) @@ -301,6 +298,12 @@ void CompatLog::NotificationSentRequestHandler(const RequestMessage& request) String author = params.GetAuthor(); String comment_text = params.GetCommentText(); + CheckCommand::Ptr commandObj = service->GetCheckCommand(); + + String check_command = ""; + if (commandObj) + check_command = commandObj->GetName(); + NotificationType notification_type = params.GetType(); String notification_type_str = Notification::NotificationTypeToString(notification_type); @@ -330,7 +333,7 @@ void CompatLog::NotificationSentRequestHandler(const RequestMessage& request) << service->GetShortName() << ";" << notification_type_str << " " << "(" << Service::StateToString(service->GetState()) << ");" - << service->GetCheckCommandName() << ";" + << check_command << ";" << raw_output << author_comment << ""; @@ -346,7 +349,7 @@ void CompatLog::NotificationSentRequestHandler(const RequestMessage& request) << host->GetName() << ";" << notification_type_str << " " << "(" << Service::StateToString(service->GetState()) << ");" - << service->GetCheckCommandName() << ";" + << check_command << ";" << raw_output << author_comment << ""; diff --git a/lib/icinga/service.cpp b/lib/icinga/service.cpp index a89e6c41f..8f5251653 100644 --- a/lib/icinga/service.cpp +++ b/lib/icinga/service.cpp @@ -176,11 +176,6 @@ String Service::GetShortName(void) const return m_ShortName; } -String Service::GetCheckCommandName(void) const -{ - return m_CheckCommand; -} - bool Service::IsReachable(void) const { ASSERT(!OwnsLock()); diff --git a/lib/icinga/service.h b/lib/icinga/service.h index cf3bd9e5b..0bea4742f 100644 --- a/lib/icinga/service.h +++ b/lib/icinga/service.h @@ -102,7 +102,6 @@ public: Array::Ptr GetGroups(void) const; String GetHostName(void) const; String GetShortName(void) const; - String GetCheckCommandName(void) const; std::set GetParentHosts(void) const; std::set GetParentServices(void) const;