]> granicus.if.org Git - icinga2/blobdiff - lib/livestatus/statehisttable.cpp
Merge pull request #6531 from Icinga/feature/zone-all_parents
[icinga2] / lib / livestatus / statehisttable.cpp
index b8728472a5fcc5b5e6371a0cbf95e99003274f4f..bb402580ce77047ec2948d2b3becbe21e750d718 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************************
  * Icinga 2                                                                   *
- * Copyright (C) 2012-2017 Icinga Development Team (https://www.icinga.com/)  *
+ * Copyright (C) 2012-2018 Icinga Development Team (https://www.icinga.com/)  *
  *                                                                            *
  * This program is free software; you can redistribute it and/or              *
  * modify it under the terms of the GNU General Public License                *
@@ -38,8 +38,6 @@
 #include "base/objectlock.hpp"
 #include <boost/tuple/tuple.hpp>
 #include <boost/algorithm/string.hpp>
-#include <boost/algorithm/string/split.hpp>
-#include <boost/algorithm/string/classification.hpp>
 #include <boost/algorithm/string/replace.hpp>
 #include <boost/algorithm/string/predicate.hpp>
 #include <fstream>
@@ -116,7 +114,7 @@ void StateHistTable::UpdateLogEntries(const Dictionary::Ptr& log_entry_attrs, in
                state_hist_service_states->Add(state_hist_bag);
 
                Log(LogDebug, "StateHistTable")
-                   << "statehist: Adding new object '" << checkable->GetName() << "' to services cache.";
+                       << "statehist: Adding new object '" << checkable->GetName() << "' to services cache.";
        } else {
                state_hist_service_states = m_CheckablesCache[checkable];
                state_hist_bag = state_hist_service_states->Get(state_hist_service_states->GetLength()-1); /* fetch latest state from history */
@@ -173,7 +171,7 @@ void StateHistTable::UpdateLogEntries(const Dictionary::Ptr& log_entry_attrs, in
                                        state_hist_service_states->Add(state_hist_bag_new);
 
                                        Log(LogDebug, "StateHistTable")
-                                           << "statehist: State change detected for object '" << checkable->GetName() << "' in '" << log_line << "'.";
+                                               << "statehist: State change detected for object '" << checkable->GetName() << "' in '" << log_line << "'.";
                                }
                                break;
                        case LogEntryTypeHostFlapping:
@@ -210,7 +208,7 @@ void StateHistTable::UpdateLogEntries(const Dictionary::Ptr& log_entry_attrs, in
 }
 
 void StateHistTable::AddColumns(Table *table, const String& prefix,
-    const Column::ObjectAccessor& objectAccessor)
+       const Column::ObjectAccessor& objectAccessor)
 {
        table->AddColumn(prefix + "time", Column(&StateHistTable::TimeAccessor, objectAccessor));
        table->AddColumn(prefix + "lineno", Column(&StateHistTable::LinenoAccessor, objectAccessor));
@@ -244,12 +242,12 @@ void StateHistTable::AddColumns(Table *table, const String& prefix,
        ServicesTable::AddColumns(table, "current_service_", std::bind(&StateHistTable::ServiceAccessor, _1, objectAccessor));
 }
 
-String StateHistTable::GetName(void) const
+String StateHistTable::GetName() const
 {
        return "log";
 }
 
-String StateHistTable::GetPrefix(void) const
+String StateHistTable::GetPrefix() const
 {
        return "log";
 }
@@ -257,7 +255,7 @@ String StateHistTable::GetPrefix(void) const
 void StateHistTable::FetchRows(const AddRowFunction& addRowFn)
 {
        Log(LogDebug, "StateHistTable")
-           << "Pre-selecting log file from " << m_TimeFrom << " until " << m_TimeUntil;
+               << "Pre-selecting log file from " << m_TimeFrom << " until " << m_TimeUntil;
 
        /* create log file index */
        LivestatusLogUtility::CreateLogIndex(m_CompatLogPath, m_LogFileIndex);
@@ -281,7 +279,7 @@ Object::Ptr StateHistTable::HostAccessor(const Value& row, const Column::ObjectA
        String host_name = static_cast<Dictionary::Ptr>(row)->Get("host_name");
 
        if (host_name.IsEmpty())
-               return Object::Ptr();
+               return nullptr;
 
        return Host::GetByName(host_name);
 }
@@ -292,7 +290,7 @@ Object::Ptr StateHistTable::ServiceAccessor(const Value& row, const Column::Obje
        String service_description = static_cast<Dictionary::Ptr>(row)->Get("service_description");
 
        if (service_description.IsEmpty() || host_name.IsEmpty())
-               return Object::Ptr();
+               return nullptr;
 
        return Service::GetByNamePair(host_name, service_description);
 }