]> granicus.if.org Git - icinga2/commitdiff
compatlog: fix checkcommand name
authorMichael Friedrich <michael.friedrich@netways.de>
Mon, 1 Jul 2013 08:03:00 +0000 (10:03 +0200)
committerMichael Friedrich <michael.friedrich@netways.de>
Mon, 1 Jul 2013 08:03:00 +0000 (10:03 +0200)
refs #4361

components/compat/compatlog.cpp
lib/icinga/service.cpp
lib/icinga/service.h

index 2f21b3a5783c7cacb5b92a0dad251aa0d0dd7ec2..89a3c65e4bae1bf53be23fad45aecba6133fa333 100644 (file)
@@ -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(&params))
                 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
                         << "";
 
index a89e6c41fa01e3ab05b61ac175acfc720ed6ab6f..8f5251653efb32275ea5b5bf4affebdb1b429cf4 100644 (file)
@@ -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());
index cf3bd9e5bd5b6dcd0ab60a42f579579c58fdf994..0bea4742fef8d39a8206d59fb7143337a535472c 100644 (file)
@@ -102,7 +102,6 @@ public:
        Array::Ptr GetGroups(void) const;
        String GetHostName(void) const;
        String GetShortName(void) const;
-       String GetCheckCommandName(void) const;
 
        std::set<Host::Ptr> GetParentHosts(void) const;
        std::set<Service::Ptr> GetParentServices(void) const;