]> granicus.if.org Git - icinga2/commitdiff
Set check source to node name as authority, if empty.
authorMichael Friedrich <michael.friedrich@netways.de>
Thu, 20 Mar 2014 09:32:52 +0000 (10:32 +0100)
committerMichael Friedrich <michael.friedrich@netways.de>
Thu, 20 Mar 2014 09:32:52 +0000 (10:32 +0100)
Fixes #5805

components/cluster/clusterchecktask.cpp
components/compat/checkresultreader.cpp
lib/icinga/externalcommandprocessor.cpp
lib/icinga/service-check.cpp
lib/methods/icingachecktask.cpp
lib/methods/pluginchecktask.cpp
lib/methods/randomchecktask.cpp

index 32b2e9915be516eead588e925fb428de037b5d38..0404cc00f8893ca384db9ebcaf43c771d0a1c508 100644 (file)
@@ -66,7 +66,6 @@ void ClusterCheckTask::ScriptFunc(const Service::Ptr& service, const CheckResult
        cr->SetOutput(output);
        cr->SetPerformanceData(perfdata);
        cr->SetState(state);
-       cr->SetCheckSource(IcingaApplication::GetInstance()->GetNodeName());
        service->ProcessCheckResult(cr);
 }
 
index 16088cb9dc947657d7b4298063544c08985d2694..03f8c82462042c7d255e7f46896334875c286a2c 100644 (file)
@@ -140,7 +140,6 @@ void CheckResultReader::ProcessCheckResultFile(const String& path) const
        result->SetState(PluginUtility::ExitStatusToState(Convert::ToLong(attrs["return_code"])));
        result->SetExecutionStart(Convert::ToDouble(attrs["start_time"]));
        result->SetExecutionEnd(Convert::ToDouble(attrs["finish_time"]));
-       result->SetCheckSource(IcingaApplication::GetInstance()->GetNodeName());
 
        service->ProcessCheckResult(result);
 
index 764b32f122b5db07acb10b9036193c61f8ef1617..c363b4f05e6a7c970389f520af880a2191820924 100644 (file)
@@ -255,7 +255,6 @@ void ExternalCommandProcessor::ProcessHostCheckResult(double time, const std::ve
        result->SetExecutionStart(time);
        result->SetExecutionEnd(time);
        result->SetActive(false);
-       result->SetCheckSource(IcingaApplication::GetInstance()->GetNodeName());
 
        Log(LogInformation, "icinga", "Processing passive check result for host '" + arguments[0] + "'");
        hc->ProcessCheckResult(result);
@@ -295,7 +294,6 @@ void ExternalCommandProcessor::ProcessServiceCheckResult(double time, const std:
        result->SetExecutionStart(time);
        result->SetExecutionEnd(time);
        result->SetActive(false);
-       result->SetCheckSource(IcingaApplication::GetInstance()->GetNodeName());
 
        Log(LogInformation, "icinga", "Processing passive check result for service '" + arguments[1] + "'");
        service->ProcessCheckResult(result);
index 67a1b512fc84aad3ab673e5871d1b469fafd7a03..6fb654d395aea9a6b88ebe2150a9485f275683c6 100644 (file)
@@ -241,8 +241,12 @@ void Service::ProcessCheckResult(const CheckResult::Ptr& cr, const String& autho
 
        String check_source = cr->GetCheckSource();
 
-       if (check_source.IsEmpty())
-               cr->SetCheckSource(authority);
+       if (check_source.IsEmpty()) {
+               if (authority.IsEmpty())
+                       cr->SetCheckSource(IcingaApplication::GetInstance()->GetNodeName());
+               else
+                       cr->SetCheckSource(authority);
+       }
 
        bool reachable = IsReachable();
        bool notification_reachable = IsReachable(DependencyNotification);
index a7fa3b63bfcb1fd16cd7477592bbe814c6a6c9a8..a83afde0a0dad8621e2108b11cfe3031253e54c1 100644 (file)
@@ -82,7 +82,6 @@ void IcingaCheckTask::ScriptFunc(const Service::Ptr& service, const CheckResult:
        cr->SetOutput("Icinga 2 is running.");
        cr->SetPerformanceData(perfdata);
        cr->SetState(StateOK);
-       cr->SetCheckSource(IcingaApplication::GetInstance()->GetNodeName());
 
        service->ProcessCheckResult(cr);
 }
index 7f0301886793861a76de8c989e89ec2bf11b496d..b598e7924b81b3bdf3f2b8491a5e90e461981525 100644 (file)
@@ -86,7 +86,6 @@ void PluginCheckTask::ProcessFinishedHandler(const Service::Ptr& service, const
        cr->SetExitStatus(pr.ExitStatus);
        cr->SetExecutionStart(pr.ExecutionStart);
        cr->SetExecutionEnd(pr.ExecutionEnd);
-       cr->SetCheckSource(IcingaApplication::GetInstance()->GetNodeName());
 
        service->ProcessCheckResult(cr);
 }
index b0c63e114394d42be52fa8a301abfbd21a10351a..02c7db63df4658af624d2a12d1240ab9e9c1fc8a 100644 (file)
@@ -42,7 +42,6 @@ void RandomCheckTask::ScriptFunc(const Service::Ptr& service, const CheckResult:
        cr->SetOutput(output);
        cr->SetPerformanceData(perfdata);
        cr->SetState(static_cast<ServiceState>(Utility::Random() % 4));
-       cr->SetCheckSource(IcingaApplication::GetInstance()->GetNodeName());
 
        service->ProcessCheckResult(cr);
 }