compatlog: fix checkcommand name

refs #4361
This commit is contained in:
Michael Friedrich 2013-07-01 10:03:00 +02:00
parent 3af0559b4a
commit cd48a4946a
3 changed files with 9 additions and 12 deletions

View 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
<< "";

View 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());

View 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;