mirror of https://github.com/Icinga/icinga2.git
Make check_source a check result attribute.
This commit is contained in:
parent
22dccac2b0
commit
93cd1b811e
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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") {
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue