static int l_ExternalCommands = 0;
static boost::mutex l_QueryMutex;
-Query::Query(const std::vector<String>& lines, const String& log_path)
+Query::Query(const std::vector<String>& lines, const String& compat_log_path)
: m_KeepAlive(false), m_OutputFormat("csv"), m_ColumnHeaders(true), m_Limit(-1),
m_LogTimeFrom(0), m_LogTimeUntil(static_cast<long>(Utility::GetTime()))
{
}
Log(LogDebug, "livestatus", msg);
- m_CompatLogPath = log_path;
+ m_CompatLogPath = compat_log_path;
/* default separators */
m_Separators.push_back("\n");
public:
DECLARE_PTR_TYPEDEFS(Query);
- Query(const std::vector<String>& lines, const String& log_path);
+ Query(const std::vector<String>& lines, const String& compat_log_path);
bool Execute(const Stream::Ptr& stream);
table->AddColumn(prefix + "connections", Column(&StatusTable::ConnectionsAccessor, objectAccessor));
table->AddColumn(prefix + "connections_rate", Column(&StatusTable::ConnectionsRateAccessor, objectAccessor));
- table->AddColumn(prefix + "service_checks", Column(&Table::ZeroAccessor, objectAccessor));
- table->AddColumn(prefix + "service_checks_rate", Column(&Table::ZeroAccessor, objectAccessor));
+ table->AddColumn(prefix + "service_checks", Column(&StatusTable::ServiceChecksAccessor, objectAccessor));
+ table->AddColumn(prefix + "service_checks_rate", Column(&StatusTable::ServiceChecksRateAccessor, objectAccessor));
table->AddColumn(prefix + "host_checks", Column(&Table::ZeroAccessor, objectAccessor));
table->AddColumn(prefix + "host_checks_rate", Column(&Table::ZeroAccessor, objectAccessor));
return (LivestatusListener::GetConnections() / (Utility::GetTime() - Application::GetStartTime()));
}
+Value StatusTable::ServiceChecksAccessor(const Value& row)
+{
+ long timespan = static_cast<long>(Utility::GetTime() - Application::GetStartTime());
+ return CIB::GetActiveChecksStatistics(timespan);
+}
+
+Value StatusTable::ServiceChecksRateAccessor(const Value& row)
+{
+ long timespan = static_cast<long>(Utility::GetTime() - Application::GetStartTime());
+ return (CIB::GetActiveChecksStatistics(timespan) / (Utility::GetTime() - Application::GetStartTime()));
+}
+
Value StatusTable::ExternalCommandsAccessor(const Value& row)
{
return Query::GetExternalCommands();
static Value ConnectionsAccessor(const Value& row);
static Value ConnectionsRateAccessor(const Value& row);
+ static Value ServiceChecksAccessor(const Value& row);
+ static Value ServiceChecksRateAccessor(const Value& row);
static Value ExternalCommandsAccessor(const Value& row);
static Value ExternalCommandsRateAccessor(const Value& row);
static Value NagiosPidAccessor(const Value& row);