Rename livestatus classes.

Refs #6346
This commit is contained in:
Michael Friedrich 2014-05-28 14:25:12 +02:00
parent 340693fb34
commit 4c8d7eea14
11 changed files with 67 additions and 66 deletions

View File

@ -15,7 +15,7 @@
# along with this program; if not, write to the Free Software Foundation # along with this program; if not, write to the Free Software Foundation
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
mkclass_target(listener.ti listener.thpp) mkclass_target(livestatuslistener.ti livestatuslistener.thpp)
mkembedconfig_target(livestatus-type.conf livestatus-type.cpp) mkembedconfig_target(livestatus-type.conf livestatus-type.cpp)
@ -24,8 +24,9 @@ add_library(livestatus SHARED aggregator.cpp andfilter.cpp attributefilter.cpp
commentstable.cpp contactgroupstable.cpp contactstable.cpp countaggregator.cpp commentstable.cpp contactgroupstable.cpp contactstable.cpp countaggregator.cpp
downtimestable.cpp endpointstable.cpp filter.cpp historytable.cpp downtimestable.cpp endpointstable.cpp filter.cpp historytable.cpp
hostgroupstable.cpp hoststable.cpp invavgaggregator.cpp invsumaggregator.cpp hostgroupstable.cpp hoststable.cpp invavgaggregator.cpp invsumaggregator.cpp
listener.cpp listener.thpp logutility.cpp logtable.cpp maxaggregator.cpp livestatuslistener.cpp livestatuslistener.thpp livestatusquery.cpp
minaggregator.cpp negatefilter.cpp orfilter.cpp query.cpp livestatuslogutility.cpp logtable.cpp maxaggregator.cpp
minaggregator.cpp negatefilter.cpp orfilter.cpp
servicegroupstable.cpp servicestable.cpp statehisttable.cpp servicegroupstable.cpp servicestable.cpp statehisttable.cpp
statustable.cpp stdaggregator.cpp sumaggregator.cpp table.cpp statustable.cpp stdaggregator.cpp sumaggregator.cpp table.cpp
timeperiodstable.cpp livestatus-type.cpp) timeperiodstable.cpp livestatus-type.cpp)

View File

@ -17,7 +17,7 @@
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
******************************************************************************/ ******************************************************************************/
#include "livestatus/listener.hpp" #include "livestatus/livestatuslistener.hpp"
#include "config/configcompilercontext.hpp" #include "config/configcompilercontext.hpp"
#include "base/utility.hpp" #include "base/utility.hpp"
#include "base/objectlock.hpp" #include "base/objectlock.hpp"
@ -155,7 +155,7 @@ void LivestatusListener::ClientHandler(const Socket::Ptr& client)
if (lines.empty()) if (lines.empty())
break; break;
Query::Ptr query = make_shared<Query>(lines, GetCompatLogPath()); LivestatusQuery::Ptr query = make_shared<LivestatusQuery>(lines, GetCompatLogPath());
if (!query->Execute(stream)) if (!query->Execute(stream))
break; break;
} }

View File

@ -20,8 +20,8 @@
#ifndef LIVESTATUSLISTENER_H #ifndef LIVESTATUSLISTENER_H
#define LIVESTATUSLISTENER_H #define LIVESTATUSLISTENER_H
#include "livestatus/listener.thpp" #include "livestatus/livestatuslistener.thpp"
#include "livestatus/query.hpp" #include "livestatus/livestatusquery.hpp"
#include "base/socket.hpp" #include "base/socket.hpp"
#include <boost/thread/thread.hpp> #include <boost/thread/thread.hpp>

View File

@ -17,7 +17,7 @@
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
******************************************************************************/ ******************************************************************************/
#include "livestatus/logutility.hpp" #include "livestatus/livestatuslogutility.hpp"
#include "icinga/service.hpp" #include "icinga/service.hpp"
#include "icinga/host.hpp" #include "icinga/host.hpp"
#include "icinga/user.hpp" #include "icinga/user.hpp"
@ -38,13 +38,13 @@
using namespace icinga; using namespace icinga;
void LogUtility::CreateLogIndex(const String& path, std::map<time_t, String>& index) void LivestatusLogUtility::CreateLogIndex(const String& path, std::map<time_t, String>& index)
{ {
Utility::Glob(path + "/icinga.log", boost::bind(&LogUtility::CreateLogIndexFileHandler, _1, boost::ref(index)), GlobFile); Utility::Glob(path + "/icinga.log", boost::bind(&LivestatusLogUtility::CreateLogIndexFileHandler, _1, boost::ref(index)), GlobFile);
Utility::Glob(path + "/archives/*.log", boost::bind(&LogUtility::CreateLogIndexFileHandler, _1, boost::ref(index)), GlobFile); Utility::Glob(path + "/archives/*.log", boost::bind(&LivestatusLogUtility::CreateLogIndexFileHandler, _1, boost::ref(index)), GlobFile);
} }
void LogUtility::CreateLogIndexFileHandler(const String& path, std::map<time_t, String>& index) void LivestatusLogUtility::CreateLogIndexFileHandler(const String& path, std::map<time_t, String>& index)
{ {
std::ifstream stream; std::ifstream stream;
stream.open(path.CStr(), std::ifstream::in); stream.open(path.CStr(), std::ifstream::in);
@ -68,12 +68,12 @@ void LogUtility::CreateLogIndexFileHandler(const String& path, std::map<time_t,
stream.close(); stream.close();
Log(LogDebug, "LivestatusListener/LogUtility", "Indexing log file: '" + path + "' with timestamp start: '" + Convert::ToString(ts_start) + "'."); Log(LogDebug, "LivestatusLogUtility", "Indexing log file: '" + path + "' with timestamp start: '" + Convert::ToString(ts_start) + "'.");
index[ts_start] = path; index[ts_start] = path;
} }
void LogUtility::CreateLogCache(std::map<time_t, String> index, HistoryTable *table, void LivestatusLogUtility::CreateLogCache(std::map<time_t, String> index, HistoryTable *table,
time_t from, time_t until, const AddRowFunction& addRowFn) time_t from, time_t until, const AddRowFunction& addRowFn)
{ {
ASSERT(table); ASSERT(table);
@ -100,11 +100,11 @@ void LogUtility::CreateLogCache(std::map<time_t, String> index, HistoryTable *ta
if (line.empty()) if (line.empty())
continue; /* Ignore empty lines */ continue; /* Ignore empty lines */
Dictionary::Ptr log_entry_attrs = LogUtility::GetAttributes(line); Dictionary::Ptr log_entry_attrs = LivestatusLogUtility::GetAttributes(line);
/* no attributes available - invalid log line */ /* no attributes available - invalid log line */
if (!log_entry_attrs) { if (!log_entry_attrs) {
Log(LogDebug, "LivestatusListener/LogUtility", "Skipping invalid log line: '" + line + "'."); Log(LogDebug, "LivestatusLogUtility", "Skipping invalid log line: '" + line + "'.");
continue; continue;
} }
@ -118,7 +118,7 @@ void LogUtility::CreateLogCache(std::map<time_t, String> index, HistoryTable *ta
} }
} }
Dictionary::Ptr LogUtility::GetAttributes(const String& text) Dictionary::Ptr LivestatusLogUtility::GetAttributes(const String& text)
{ {
Dictionary::Ptr bag = make_shared<Dictionary>(); Dictionary::Ptr bag = make_shared<Dictionary>();
@ -127,7 +127,7 @@ Dictionary::Ptr LogUtility::GetAttributes(const String& text)
*/ */
unsigned long time = atoi(text.SubStr(1, 11).CStr()); unsigned long time = atoi(text.SubStr(1, 11).CStr());
Log(LogDebug, "LivestatusListener/LogUtility", "Processing log line: '" + text + "'."); Log(LogDebug, "LivestatusLogUtility", "Processing log line: '" + text + "'.");
bag->Set("time", time); bag->Set("time", time);
size_t colon = text.FindFirstOf(':'); size_t colon = text.FindFirstOf(':');

View File

@ -17,8 +17,8 @@
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
******************************************************************************/ ******************************************************************************/
#ifndef LOGUTILITY_H #ifndef LIVESTATUSLOGUTILITY_H
#define LOGUTILITY_H #define LIVESTATUSLOGUTILITY_H
#include "livestatus/historytable.hpp" #include "livestatus/historytable.hpp"
@ -60,7 +60,7 @@ enum LogEntryClass {
/** /**
* @ingroup livestatus * @ingroup livestatus
*/ */
class LogUtility class LivestatusLogUtility
{ {
public: public:
@ -70,9 +70,9 @@ public:
static Dictionary::Ptr GetAttributes(const String& text); static Dictionary::Ptr GetAttributes(const String& text);
private: private:
LogUtility(void); LivestatusLogUtility(void);
}; };
} }
#endif /* LOGUTILITY_H */ #endif /* LIVESTATUSLOGUTILITY_H */

View File

@ -17,7 +17,7 @@
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
******************************************************************************/ ******************************************************************************/
#include "livestatus/query.hpp" #include "livestatus/livestatusquery.hpp"
#include "livestatus/countaggregator.hpp" #include "livestatus/countaggregator.hpp"
#include "livestatus/sumaggregator.hpp" #include "livestatus/sumaggregator.hpp"
#include "livestatus/minaggregator.hpp" #include "livestatus/minaggregator.hpp"
@ -47,7 +47,7 @@ using namespace icinga;
static int l_ExternalCommands = 0; static int l_ExternalCommands = 0;
static boost::mutex l_QueryMutex; static boost::mutex l_QueryMutex;
Query::Query(const std::vector<String>& lines, const String& compat_log_path) LivestatusQuery::LivestatusQuery(const std::vector<String>& lines, const String& compat_log_path)
: m_KeepAlive(false), m_OutputFormat("csv"), m_ColumnHeaders(true), : m_KeepAlive(false), m_OutputFormat("csv"), m_ColumnHeaders(true),
m_LogTimeFrom(0), m_LogTimeUntil(static_cast<long>(Utility::GetTime())) m_LogTimeFrom(0), m_LogTimeUntil(static_cast<long>(Utility::GetTime()))
{ {
@ -62,7 +62,7 @@ Query::Query(const std::vector<String>& lines, const String& compat_log_path)
BOOST_FOREACH(const String& line, lines) { BOOST_FOREACH(const String& line, lines) {
msg += line + "\n"; msg += line + "\n";
} }
Log(LogDebug, "LivestatusListener/Query", msg); Log(LogDebug, "LivestatusQuery", msg);
m_CompatLogPath = compat_log_path; m_CompatLogPath = compat_log_path;
@ -202,10 +202,10 @@ Query::Query(const std::vector<String>& lines, const String& compat_log_path)
if (header == "Or" || header == "StatsOr") { if (header == "Or" || header == "StatsOr") {
filter = make_shared<OrFilter>(); filter = make_shared<OrFilter>();
Log(LogDebug, "LivestatusListener/Query", "Add OR filter for " + params + " column(s). " + Convert::ToString(deq.size()) + " filters available."); Log(LogDebug, "LivestatusQuery", "Add OR filter for " + params + " column(s). " + Convert::ToString(deq.size()) + " filters available.");
} else { } else {
filter = make_shared<AndFilter>(); filter = make_shared<AndFilter>();
Log(LogDebug, "LivestatusListener/Query", "Add AND filter for " + params + " column(s). " + Convert::ToString(deq.size()) + " filters available."); Log(LogDebug, "LivestatusQuery", "Add AND filter for " + params + " column(s). " + Convert::ToString(deq.size()) + " filters available.");
} }
if (num > deq.size()) { if (num > deq.size()) {
@ -217,7 +217,7 @@ Query::Query(const std::vector<String>& lines, const String& compat_log_path)
while (num > 0 && num--) { while (num > 0 && num--) {
filter->AddSubFilter(deq.back()); filter->AddSubFilter(deq.back());
Log(LogDebug, "LivestatusListener/Query", "Add " + Convert::ToString(num) + " filter."); Log(LogDebug, "LivestatusQuery", "Add " + Convert::ToString(num) + " filter.");
deq.pop_back(); deq.pop_back();
if (&deq == &stats) if (&deq == &stats)
aggregators.pop_back(); aggregators.pop_back();
@ -269,14 +269,14 @@ Query::Query(const std::vector<String>& lines, const String& compat_log_path)
m_Aggregators.swap(aggregators); m_Aggregators.swap(aggregators);
} }
int Query::GetExternalCommands(void) int LivestatusQuery::GetExternalCommands(void)
{ {
boost::mutex::scoped_lock lock(l_QueryMutex); boost::mutex::scoped_lock lock(l_QueryMutex);
return l_ExternalCommands; return l_ExternalCommands;
} }
Filter::Ptr Query::ParseFilter(const String& params, unsigned long& from, unsigned long& until) Filter::Ptr LivestatusQuery::ParseFilter(const String& params, unsigned long& from, unsigned long& until)
{ {
/* /*
* time >= 1382696656 * time >= 1382696656
@ -340,12 +340,12 @@ Filter::Ptr Query::ParseFilter(const String& params, unsigned long& from, unsign
} }
} }
Log(LogDebug, "LivestatusListener/Query", "Parsed filter with attr: '" + attr + "' op: '" + op + "' val: '" + val + "'."); Log(LogDebug, "LivestatusQuery", "Parsed filter with attr: '" + attr + "' op: '" + op + "' val: '" + val + "'.");
return filter; return filter;
} }
void Query::PrintResultSet(std::ostream& fp, const Array::Ptr& rs) void LivestatusQuery::PrintResultSet(std::ostream& fp, const Array::Ptr& rs)
{ {
if (m_OutputFormat == "csv") { if (m_OutputFormat == "csv") {
ObjectLock olock(rs); ObjectLock olock(rs);
@ -373,7 +373,7 @@ void Query::PrintResultSet(std::ostream& fp, const Array::Ptr& rs)
} }
} }
void Query::PrintCsvArray(std::ostream& fp, const Array::Ptr& array, int level) void LivestatusQuery::PrintCsvArray(std::ostream& fp, const Array::Ptr& array, int level)
{ {
bool first = true; bool first = true;
@ -391,9 +391,9 @@ void Query::PrintCsvArray(std::ostream& fp, const Array::Ptr& array, int level)
} }
} }
void Query::ExecuteGetHelper(const Stream::Ptr& stream) void LivestatusQuery::ExecuteGetHelper(const Stream::Ptr& stream)
{ {
Log(LogInformation, "LivestatusListener/Query", "Table: " + m_Table); Log(LogInformation, "LivestatusQuery", "Table: " + m_Table);
Table::Ptr table = Table::GetByName(m_Table, m_CompatLogPath, m_LogTimeFrom, m_LogTimeUntil); Table::Ptr table = Table::GetByName(m_Table, m_CompatLogPath, m_LogTimeFrom, m_LogTimeUntil);
@ -490,7 +490,7 @@ void Query::ExecuteGetHelper(const Stream::Ptr& stream)
SendResponse(stream, LivestatusErrorOK, result.str()); SendResponse(stream, LivestatusErrorOK, result.str());
} }
void Query::ExecuteCommandHelper(const Stream::Ptr& stream) void LivestatusQuery::ExecuteCommandHelper(const Stream::Ptr& stream)
{ {
{ {
boost::mutex::scoped_lock lock(l_QueryMutex); boost::mutex::scoped_lock lock(l_QueryMutex);
@ -498,18 +498,18 @@ void Query::ExecuteCommandHelper(const Stream::Ptr& stream)
l_ExternalCommands++; l_ExternalCommands++;
} }
Log(LogInformation, "LivestatusListener/Query", "Executing command: " + m_Command); Log(LogInformation, "LivestatusQuery", "Executing command: " + m_Command);
ExternalCommandProcessor::Execute(m_Command); ExternalCommandProcessor::Execute(m_Command);
SendResponse(stream, LivestatusErrorOK, ""); SendResponse(stream, LivestatusErrorOK, "");
} }
void Query::ExecuteErrorHelper(const Stream::Ptr& stream) void LivestatusQuery::ExecuteErrorHelper(const Stream::Ptr& stream)
{ {
Log(LogDebug, "LivestatusListener/Query", "ERROR: Code: '" + Convert::ToString(m_ErrorCode) + "' Message: '" + m_ErrorMessage + "'."); Log(LogDebug, "LivestatusQuery", "ERROR: Code: '" + Convert::ToString(m_ErrorCode) + "' Message: '" + m_ErrorMessage + "'.");
SendResponse(stream, m_ErrorCode, m_ErrorMessage); SendResponse(stream, m_ErrorCode, m_ErrorMessage);
} }
void Query::SendResponse(const Stream::Ptr& stream, int code, const String& data) void LivestatusQuery::SendResponse(const Stream::Ptr& stream, int code, const String& data)
{ {
if (m_ResponseHeader == "fixed16") if (m_ResponseHeader == "fixed16")
PrintFixed16(stream, code, data); PrintFixed16(stream, code, data);
@ -521,12 +521,12 @@ void Query::SendResponse(const Stream::Ptr& stream, int code, const String& data
std::ostringstream info; std::ostringstream info;
info << "Exception thrown while writing to the livestatus socket: " << std::endl info << "Exception thrown while writing to the livestatus socket: " << std::endl
<< DiagnosticInformation(ex); << DiagnosticInformation(ex);
Log(LogCritical, "LivestatusListener/Query", info.str()); Log(LogCritical, "LivestatusQuery", info.str());
} }
} }
} }
void Query::PrintFixed16(const Stream::Ptr& stream, int code, const String& data) void LivestatusQuery::PrintFixed16(const Stream::Ptr& stream, int code, const String& data)
{ {
ASSERT(code >= 100 && code <= 999); ASSERT(code >= 100 && code <= 999);
@ -541,14 +541,14 @@ void Query::PrintFixed16(const Stream::Ptr& stream, int code, const String& data
std::ostringstream info; std::ostringstream info;
info << "Exception thrown while writing to the livestatus socket: " << std::endl info << "Exception thrown while writing to the livestatus socket: " << std::endl
<< DiagnosticInformation(ex); << DiagnosticInformation(ex);
Log(LogCritical, "LivestatusListener/Query", info.str()); Log(LogCritical, "LivestatusQuery", info.str());
} }
} }
bool Query::Execute(const Stream::Ptr& stream) bool LivestatusQuery::Execute(const Stream::Ptr& stream)
{ {
try { try {
Log(LogInformation, "LivestatusListener/Query", "Executing livestatus query: " + m_Verb); Log(LogInformation, "LivestatusQuery", "Executing livestatus query: " + m_Verb);
if (m_Verb == "GET") if (m_Verb == "GET")
ExecuteGetHelper(stream); ExecuteGetHelper(stream);

View File

@ -17,8 +17,8 @@
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
******************************************************************************/ ******************************************************************************/
#ifndef QUERY_H #ifndef LIVESTATUSQUERY_H
#define QUERY_H #define LIVESTATUSQUERY_H
#include "livestatus/filter.hpp" #include "livestatus/filter.hpp"
#include "livestatus/aggregator.hpp" #include "livestatus/aggregator.hpp"
@ -42,12 +42,12 @@ enum LivestatusError
/** /**
* @ingroup livestatus * @ingroup livestatus
*/ */
class Query : public Object class LivestatusQuery : public Object
{ {
public: public:
DECLARE_PTR_TYPEDEFS(Query); DECLARE_PTR_TYPEDEFS(LivestatusQuery);
Query(const std::vector<String>& lines, const String& compat_log_path); LivestatusQuery(const std::vector<String>& lines, const String& compat_log_path);
bool Execute(const Stream::Ptr& stream); bool Execute(const Stream::Ptr& stream);
@ -97,4 +97,4 @@ private:
} }
#endif /* QUERY_H */ #endif /* LIVESTATUSQUERY_H */

View File

@ -18,7 +18,7 @@
******************************************************************************/ ******************************************************************************/
#include "livestatus/logtable.hpp" #include "livestatus/logtable.hpp"
#include "livestatus/logutility.hpp" #include "livestatus/livestatuslogutility.hpp"
#include "livestatus/hoststable.hpp" #include "livestatus/hoststable.hpp"
#include "livestatus/servicestable.hpp" #include "livestatus/servicestable.hpp"
#include "livestatus/contactstable.hpp" #include "livestatus/contactstable.hpp"
@ -91,16 +91,16 @@ String LogTable::GetName(void) const
void LogTable::FetchRows(const AddRowFunction& addRowFn) void LogTable::FetchRows(const AddRowFunction& addRowFn)
{ {
Log(LogNotice, "LivestatusListener/LogTable", "Pre-selecting log file from " + Convert::ToString(m_TimeFrom) + " until " + Convert::ToString(m_TimeUntil)); Log(LogDebug, "LogTable", "Pre-selecting log file from " + Convert::ToString(m_TimeFrom) + " until " + Convert::ToString(m_TimeUntil));
/* create log file index */ /* create log file index */
LogUtility::CreateLogIndex(m_CompatLogPath, m_LogFileIndex); LivestatusLogUtility::CreateLogIndex(m_CompatLogPath, m_LogFileIndex);
/* generate log cache */ /* generate log cache */
LogUtility::CreateLogCache(m_LogFileIndex, this, m_TimeFrom, m_TimeUntil, addRowFn); LivestatusLogUtility::CreateLogCache(m_LogFileIndex, this, m_TimeFrom, m_TimeUntil, addRowFn);
} }
/* gets called in LogUtility::CreateLogCache */ /* gets called in LivestatusLogUtility::CreateLogCache */
void LogTable::UpdateLogEntries(const Dictionary::Ptr& log_entry_attrs, int line_count, int lineno, const AddRowFunction& addRowFn) void LogTable::UpdateLogEntries(const Dictionary::Ptr& log_entry_attrs, int line_count, int lineno, const AddRowFunction& addRowFn)
{ {
/* additional attributes only for log table */ /* additional attributes only for log table */

View File

@ -18,7 +18,7 @@
******************************************************************************/ ******************************************************************************/
#include "livestatus/statehisttable.hpp" #include "livestatus/statehisttable.hpp"
#include "livestatus/logutility.hpp" #include "livestatus/livestatuslogutility.hpp"
#include "livestatus/hoststable.hpp" #include "livestatus/hoststable.hpp"
#include "livestatus/servicestable.hpp" #include "livestatus/servicestable.hpp"
#include "livestatus/contactstable.hpp" #include "livestatus/contactstable.hpp"
@ -117,7 +117,7 @@ void StateHistTable::UpdateLogEntries(const Dictionary::Ptr& log_entry_attrs, in
state_hist_service_states->Add(state_hist_bag); state_hist_service_states->Add(state_hist_bag);
Log(LogDebug, "LivestatusListener/StateHistTable", "statehist: Adding new object '" + checkable->GetName() + "' to services cache."); Log(LogDebug, "StateHistTable", "statehist: Adding new object '" + checkable->GetName() + "' to services cache.");
} else { } else {
state_hist_service_states = m_CheckablesCache[checkable]; 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 */ state_hist_bag = state_hist_service_states->Get(state_hist_service_states->GetLength()-1); /* fetch latest state from history */
@ -173,7 +173,7 @@ void StateHistTable::UpdateLogEntries(const Dictionary::Ptr& log_entry_attrs, in
state_hist_service_states->Add(state_hist_bag_new); state_hist_service_states->Add(state_hist_bag_new);
Log(LogDebug, "LivestatusListener/StateHistTable", "statehist: State change detected for object '" + Log(LogDebug, "StateHistTable", "statehist: State change detected for object '" +
checkable->GetName() + "' in '" + log_line + "'."); checkable->GetName() + "' in '" + log_line + "'.");
} }
break; break;
@ -252,13 +252,13 @@ String StateHistTable::GetName(void) const
void StateHistTable::FetchRows(const AddRowFunction& addRowFn) void StateHistTable::FetchRows(const AddRowFunction& addRowFn)
{ {
Log(LogNotice, "LivestatusListener/StateHistTable", "Pre-selecting log file from " + Convert::ToString(m_TimeFrom) + " until " + Convert::ToString(m_TimeUntil)); Log(LogDebug, "StateHistTable", "Pre-selecting log file from " + Convert::ToString(m_TimeFrom) + " until " + Convert::ToString(m_TimeUntil));
/* create log file index */ /* create log file index */
LogUtility::CreateLogIndex(m_CompatLogPath, m_LogFileIndex); LivestatusLogUtility::CreateLogIndex(m_CompatLogPath, m_LogFileIndex);
/* generate log cache */ /* generate log cache */
LogUtility::CreateLogCache(m_LogFileIndex, this, m_TimeFrom, m_TimeUntil, addRowFn); LivestatusLogUtility::CreateLogCache(m_LogFileIndex, this, m_TimeFrom, m_TimeUntil, addRowFn);
Checkable::Ptr checkable; Checkable::Ptr checkable;

View File

@ -18,7 +18,7 @@
******************************************************************************/ ******************************************************************************/
#include "livestatus/statustable.hpp" #include "livestatus/statustable.hpp"
#include "livestatus/listener.hpp" #include "livestatus/livestatuslistener.hpp"
#include "icinga/icingaapplication.hpp" #include "icinga/icingaapplication.hpp"
#include "icinga/cib.hpp" #include "icinga/cib.hpp"
#include "icinga/host.hpp" #include "icinga/host.hpp"
@ -152,12 +152,12 @@ Value StatusTable::ServiceChecksRateAccessor(const Value&)
Value StatusTable::ExternalCommandsAccessor(const Value&) Value StatusTable::ExternalCommandsAccessor(const Value&)
{ {
return Query::GetExternalCommands(); return LivestatusQuery::GetExternalCommands();
} }
Value StatusTable::ExternalCommandsRateAccessor(const Value&) Value StatusTable::ExternalCommandsRateAccessor(const Value&)
{ {
return (Query::GetExternalCommands() / (Utility::GetTime() - Application::GetStartTime())); return (LivestatusQuery::GetExternalCommands() / (Utility::GetTime() - Application::GetStartTime()));
} }
Value StatusTable::NagiosPidAccessor(const Value&) Value StatusTable::NagiosPidAccessor(const Value&)