/******************************************************************************
* Icinga 2 *
- * Copyright (C) 2012-2015 Icinga Development Team (http://www.icinga.org) *
+ * 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 *
#include "base/logger.hpp"
#include "base/application.hpp"
#include "base/objectlock.hpp"
-#include <boost/foreach.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>
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 */
/* determine service notifications notification_period and compare against current timestamp */
bool in_notification_period = true;
String notification_period_name;
- BOOST_FOREACH(const Notification::Ptr& notification, checkable->GetNotifications()) {
+ for (const Notification::Ptr& notification : checkable->GetNotifications()) {
TimePeriod::Ptr notification_period = notification->GetPeriod();
if (notification_period) {
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:
}
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));
table->AddColumn(prefix + "duration_unmonitored", Column(&StateHistTable::DurationUnmonitoredAccessor, objectAccessor));
table->AddColumn(prefix + "duration_part_unmonitored", Column(&StateHistTable::DurationPartUnmonitoredAccessor, objectAccessor));
- HostsTable::AddColumns(table, "current_host_", boost::bind(&StateHistTable::HostAccessor, _1, objectAccessor));
- ServicesTable::AddColumns(table, "current_service_", boost::bind(&StateHistTable::ServiceAccessor, _1, objectAccessor));
+ HostsTable::AddColumns(table, "current_host_", std::bind(&StateHistTable::HostAccessor, _1, objectAccessor));
+ 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";
}
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);
Checkable::Ptr checkable;
- BOOST_FOREACH(boost::tie(checkable, boost::tuples::ignore), m_CheckablesCache) {
- BOOST_FOREACH(const Dictionary::Ptr& state_hist_bag, m_CheckablesCache[checkable]) {
+ for (const auto& kv : m_CheckablesCache) {
+ for (const Dictionary::Ptr& state_hist_bag : kv.second) {
/* pass a dictionary from state history array */
- addRowFn(state_hist_bag, LivestatusGroupByNone, Empty);
+ if (!addRowFn(state_hist_bag, LivestatusGroupByNone, Empty))
+ return;
}
}
}
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);
}
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);
}