]> granicus.if.org Git - icinga2/commitdiff
Drop CompatUtility::GetCheckResultPerfdata()
authorMichael Friedrich <michael.friedrich@icinga.com>
Wed, 6 Dec 2017 16:03:56 +0000 (17:03 +0100)
committerMichael Friedrich <michael.friedrich@icinga.com>
Mon, 15 Jan 2018 12:39:34 +0000 (13:39 +0100)
lib/compat/statusdatawriter.cpp
lib/db_ido/dbevents.cpp
lib/db_ido/hostdbobject.cpp
lib/db_ido/servicedbobject.cpp
lib/icinga/compatutility.cpp
lib/icinga/compatutility.hpp
lib/livestatus/hoststable.cpp
lib/livestatus/servicestable.cpp

index bbc55991823288473136f760e149490cb0f03e26..bbb5469cafc2de23a038995202442701915e762c 100644 (file)
@@ -28,6 +28,7 @@
 #include "icinga/timeperiod.hpp"
 #include "icinga/notificationcommand.hpp"
 #include "icinga/compatutility.hpp"
+#include "icinga/pluginutility.hpp"
 #include "icinga/dependency.hpp"
 #include "base/configtype.hpp"
 #include "base/objectlock.hpp"
@@ -366,13 +367,12 @@ void StatusDataWriter::DumpCheckableStatusAttrs(std::ostream& fp, const Checkabl
        }
 
        fp << "\t" "state_type=" << checkable->GetStateType() << "\n"
-               "\t" "plugin_output=" << CompatUtility::GetCheckResultOutput(cr) << "\n"
-               "\t" "long_plugin_output=" << CompatUtility::GetCheckResultLongOutput(cr) << "\n"
-               "\t" "performance_data=" << CompatUtility::GetCheckResultPerfdata(cr) << "\n";
+               "\t" "last_check=" << static_cast<long>(host->GetLastCheck()) << "\n";
 
        if (cr) {
-               fp << "\t" << "check_source=" << cr->GetCheckSource() << "\n"
-                       "\t" "last_check=" << static_cast<long>(cr->GetScheduleEnd()) << "\n";
+               fp << "\t" "plugin_output=" << CompatUtility::GetCheckResultOutput(cr) << "\n"
+                       "\t" "long_plugin_output=" << CompatUtility::GetCheckResultLongOutput(cr) << "\n"
+                       "\t" "performance_data=" << PluginUtility::FormatPerfdata(cr->GetPerformanceData()) << "\n"
        }
 
        fp << "\t" << "next_check=" << static_cast<long>(checkable->GetNextCheck()) << "\n"
index 9663a9a7720a211fd07c48f3f201fdfd891967fb..7c9598e87f83a36ea4d6c0a3abdf721f4027db96 100644 (file)
@@ -32,6 +32,7 @@
 #include "icinga/eventcommand.hpp"
 #include "icinga/externalcommandprocessor.hpp"
 #include "icinga/compatutility.hpp"
+#include "icinga/pluginutility.hpp"
 #include "icinga/icingaapplication.hpp"
 #include <boost/algorithm/string/join.hpp>
 
@@ -1411,7 +1412,7 @@ void DbEvents::AddCheckableCheckHistory(const Checkable::Ptr& checkable, const C
        fields1->Set("return_code", cr->GetExitStatus());
        fields1->Set("output", CompatUtility::GetCheckResultOutput(cr));
        fields1->Set("long_output", CompatUtility::GetCheckResultLongOutput(cr));
-       fields1->Set("perfdata", CompatUtility::GetCheckResultPerfdata(cr));
+       fields1->Set("perfdata", PluginUtility::FormatPerfdata(cr->GetPerformanceData()));
 
        fields1->Set("instance_id", 0); /* DbConnection class fills in real ID */
 
index 0cdfbc5203997809cfcae34546ffed1803a11dfc..c7eb4c89e695d05751f44ec42565f5def3338ade 100644 (file)
@@ -29,6 +29,7 @@
 #include "icinga/checkcommand.hpp"
 #include "icinga/eventcommand.hpp"
 #include "icinga/compatutility.hpp"
+#include "icinga/pluginutility.hpp"
 #include "base/convert.hpp"
 #include "base/objectlock.hpp"
 #include "base/logger.hpp"
@@ -127,7 +128,7 @@ Dictionary::Ptr HostDbObject::GetStatusFields() const
        if (cr) {
                fields->Set("output", CompatUtility::GetCheckResultOutput(cr));
                fields->Set("long_output", CompatUtility::GetCheckResultLongOutput(cr));
-               fields->Set("perfdata", CompatUtility::GetCheckResultPerfdata(cr));
+               fields->Set("perfdata", PluginUtility::FormatPerfdata(cr->GetPerformanceData()));
                fields->Set("check_source", cr->GetCheckSource());
        }
 
index ae9032a008f7b0b2a7726980e305dd4eb6e520db..b39e600dacfc7a6c2fb2b1cc54b067a8240f4140 100644 (file)
@@ -28,6 +28,7 @@
 #include "icinga/eventcommand.hpp"
 #include "icinga/externalcommandprocessor.hpp"
 #include "icinga/compatutility.hpp"
+#include "icinga/pluginutility.hpp"
 #include "icinga/icingaapplication.hpp"
 #include "remote/endpoint.hpp"
 #include "base/convert.hpp"
@@ -114,7 +115,7 @@ Dictionary::Ptr ServiceDbObject::GetStatusFields() const
        if (cr) {
                fields->Set("output", CompatUtility::GetCheckResultOutput(cr));
                fields->Set("long_output", CompatUtility::GetCheckResultLongOutput(cr));
-               fields->Set("perfdata", CompatUtility::GetCheckResultPerfdata(cr));
+               fields->Set("perfdata", PluginUtility::FormatPerfdata(cr->GetPerformanceData()));
                fields->Set("check_source", cr->GetCheckSource());
        }
 
index 5d83a52bf04cb8266846dee8be58c56dee8713d0..154fcc4db765a8c8c11ac62efa91b7a85b9bb7cc 100644 (file)
@@ -485,14 +485,6 @@ String CompatUtility::GetCheckResultLongOutput(const CheckResult::Ptr& cr)
        return Empty;
 }
 
-String CompatUtility::GetCheckResultPerfdata(const CheckResult::Ptr& cr)
-{
-       if (!cr)
-               return String();
-
-       return PluginUtility::FormatPerfdata(cr->GetPerformanceData());
-}
-
 String CompatUtility::EscapeString(const String& str)
 {
        String result = str;
index 601510b29a1acf30df81e621746ce615f5c81c89..55a08d082606635ac79a448fc6568052ead6317a 100644 (file)
@@ -81,7 +81,6 @@ public:
        /* check result */
        static String GetCheckResultOutput(const CheckResult::Ptr& cr);
        static String GetCheckResultLongOutput(const CheckResult::Ptr& cr);
-       static String GetCheckResultPerfdata(const CheckResult::Ptr& cr);
 
        /* misc */
        static String EscapeString(const String& str);
index 5cbaf986c2a0a90ae0687c244304a08ef5884690..17ea108b42217e3415e2db92c8a1c01fe5d70902 100644 (file)
@@ -29,6 +29,7 @@
 #include "icinga/macroprocessor.hpp"
 #include "icinga/icingaapplication.hpp"
 #include "icinga/compatutility.hpp"
+#include "icinga/pluginutility.hpp"
 #include "base/configtype.hpp"
 #include "base/objectlock.hpp"
 #include "base/json.hpp"
@@ -407,10 +408,10 @@ Value HostsTable::PerfDataAccessor(const Value& row)
        String perfdata;
        CheckResult::Ptr cr = host->GetLastCheckResult();
 
-       if (cr)
-               perfdata = CompatUtility::GetCheckResultPerfdata(cr);
+       if (!cr)
+               return Empty;
 
-       return perfdata;
+       return PluginUtility::FormatPerfdata(cr->GetPerformanceData());
 }
 
 Value HostsTable::IconImageAccessor(const Value& row)
index 492317328b734ed5566fb2555be269b323210d88..1a7d3847daa70ce1da17051e7f4fd62e51cc08ca 100644 (file)
@@ -31,6 +31,7 @@
 #include "icinga/macroprocessor.hpp"
 #include "icinga/icingaapplication.hpp"
 #include "icinga/compatutility.hpp"
+#include "icinga/pluginutility.hpp"
 #include "base/configtype.hpp"
 #include "base/objectlock.hpp"
 #include "base/json.hpp"
@@ -342,10 +343,10 @@ Value ServicesTable::PerfDataAccessor(const Value& row)
        String perfdata;
        CheckResult::Ptr cr = service->GetLastCheckResult();
 
-       if (cr)
-               perfdata = CompatUtility::GetCheckResultPerfdata(cr);
+       if (!cr)
+               return Empty;
 
-       return perfdata;
+       return PluginUtility::FormatPerfdata(cr->GetPerformanceData());
 }
 
 Value ServicesTable::CheckPeriodAccessor(const Value& row)