Make check_source a check result attribute.

This commit is contained in:
Gunnar Beutner 2013-09-27 07:34:08 +02:00
parent 22dccac2b0
commit 93cd1b811e
4 changed files with 7 additions and 24 deletions

View File

@ -178,6 +178,7 @@ Dictionary::Ptr CompatUtility::GetServiceStatusAttributes(const Service::Ptr& se
String output;
String long_output;
String perfdata;
String check_source;
double schedule_end = -1;
String check_period_str;
@ -194,6 +195,8 @@ Dictionary::Ptr CompatUtility::GetServiceStatusAttributes(const Service::Ptr& se
output = output_bag->Get("output");
long_output = output_bag->Get("long_output");
check_source = cr->Get("check_source");
perfdata = GetCheckResultPerfdata(cr);
schedule_end = cr->Get("schedule_end");
}
@ -260,6 +263,7 @@ Dictionary::Ptr CompatUtility::GetServiceStatusAttributes(const Service::Ptr& se
attr->Set("plugin_output", output);
attr->Set("long_plugin_output", long_output);
attr->Set("performance_data", perfdata);
attr->Set("check_source", check_source);
attr->Set("check_type", (service->GetEnableActiveChecks() ? 1 : 0));
attr->Set("last_check", schedule_end);
attr->Set("next_check", service->GetNextCheck());
@ -285,10 +289,6 @@ Dictionary::Ptr CompatUtility::GetServiceStatusAttributes(const Service::Ptr& se
attr->Set("next_notification", next_notification);
attr->Set("current_notification_number", notification_number);
String authority = service->GetCheckResultAuthority();
if (!authority.IsEmpty())
attr->Set("check_source", authority);
return attr;
}

View File

@ -456,6 +456,9 @@ void Service::ProcessCheckResult(const Dictionary::Ptr& cr, const String& author
if (!cr->Contains("execution_end"))
cr->Set("execution_end", now);
if (!cr->Contains("check_source"))
cr->Set("check_source", authority);
bool reachable = IsReachable();
Host::Ptr host = GetHost();
@ -603,9 +606,6 @@ void Service::ProcessCheckResult(const Dictionary::Ptr& cr, const String& author
olock.Lock();
SetLastCheckResult(cr);
if (!authority.IsEmpty())
SetCheckResultAuthority(authority);
bool was_flapping, is_flapping;
was_flapping = IsFlapping();

View File

@ -328,19 +328,6 @@ std::set<Service::Ptr> Service::GetParentServices(void) const
return parents;
}
void Service::SetCheckResultAuthority(const String& authority)
{
m_CheckResultAuthority = authority;
}
String Service::GetCheckResultAuthority(void) const
{
if (m_CheckResultAuthority.IsEmpty())
return "(i2 local)";
else
return m_CheckResultAuthority;
}
bool Service::ResolveMacro(const String& macro, const Dictionary::Ptr& cr, String *result) const
{
if (macro == "SERVICEDESC") {

View File

@ -142,9 +142,6 @@ public:
void AcknowledgeProblem(const String& author, const String& comment, AcknowledgementType type, double expiry = 0, const String& authority = String());
void ClearAcknowledgement(const String& authority = String());
void SetCheckResultAuthority(const String& authority);
String GetCheckResultAuthority(void) const;
/* Checks */
shared_ptr<CheckCommand> GetCheckCommand(void) const;
long GetMaxCheckAttempts(void) const;
@ -355,7 +352,6 @@ private:
Value m_AcknowledgementExpiry;
String m_HostName;
Value m_Volatile;
String m_CheckResultAuthority;
/* Checks */
String m_CheckCommand;