From f55d48cfb3b2f1aec12a3589901678a5bfa8269f Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Thu, 3 Oct 2013 18:58:48 +0200 Subject: [PATCH] Fix compiler warnings (wip) refs #4756 --- components/livestatus/commentstable.cpp | 16 +- components/livestatus/commentstable.h | 2 - components/livestatus/contactstable.cpp | 8 +- components/livestatus/contactstable.h | 1 - components/livestatus/hostgroupstable.cpp | 4 +- components/livestatus/hoststable.cpp | 116 ++------ components/livestatus/hoststable.h | 14 +- components/livestatus/query.cpp | 6 +- components/livestatus/servicestable.cpp | 56 +--- components/livestatus/servicestable.h | 6 - components/livestatus/statustable.cpp | 311 +++------------------- components/livestatus/statustable.h | 38 --- 12 files changed, 83 insertions(+), 495 deletions(-) diff --git a/components/livestatus/commentstable.cpp b/components/livestatus/commentstable.cpp index e6b059a94..b95e8aac8 100644 --- a/components/livestatus/commentstable.cpp +++ b/components/livestatus/commentstable.cpp @@ -42,8 +42,8 @@ void CommentsTable::AddColumns(Table *table, const String& prefix, table->AddColumn(prefix + "entry_time", Column(&CommentsTable::EntryTimeAccessor, objectAccessor)); table->AddColumn(prefix + "type", Column(&CommentsTable::TypeAccessor, objectAccessor)); table->AddColumn(prefix + "is_service", Column(&CommentsTable::IsServiceAccessor, objectAccessor)); - table->AddColumn(prefix + "persistent", Column(&CommentsTable::PersistentAccessor, objectAccessor)); - table->AddColumn(prefix + "source", Column(&CommentsTable::SourceAccessor, objectAccessor)); + table->AddColumn(prefix + "persistent", Column(&Table::OneAccessor, objectAccessor)); + table->AddColumn(prefix + "source", Column(&Table::OneAccessor, objectAccessor)); table->AddColumn(prefix + "entry_type", Column(&CommentsTable::EntryTypeAccessor, objectAccessor)); table->AddColumn(prefix + "expires", Column(&CommentsTable::ExpiresAccessor, objectAccessor)); table->AddColumn(prefix + "expire_time", Column(&CommentsTable::ExpireTimeAccessor, objectAccessor)); @@ -139,18 +139,6 @@ Value CommentsTable::IsServiceAccessor(const Value& row) return (svc->IsHostCheck() ? 0 : 1); } -Value CommentsTable::PersistentAccessor(const Value& row) -{ - /* always 1 */ - return 1; -} - -Value CommentsTable::SourceAccessor(const Value& row) -{ - /* always external */ - return 1; -} - Value CommentsTable::EntryTypeAccessor(const Value& row) { Dictionary::Ptr comment = Service::GetCommentByID(row); diff --git a/components/livestatus/commentstable.h b/components/livestatus/commentstable.h index a4bbb081b..e5fef61dc 100644 --- a/components/livestatus/commentstable.h +++ b/components/livestatus/commentstable.h @@ -54,8 +54,6 @@ private: static Value EntryTimeAccessor(const Value& row); static Value TypeAccessor(const Value& row); static Value IsServiceAccessor(const Value& row); - static Value PersistentAccessor(const Value& row); - static Value SourceAccessor(const Value& row); static Value EntryTypeAccessor(const Value& row); static Value ExpiresAccessor(const Value& row); static Value ExpireTimeAccessor(const Value& row); diff --git a/components/livestatus/contactstable.cpp b/components/livestatus/contactstable.cpp index 9789ef560..9d4277aa8 100644 --- a/components/livestatus/contactstable.cpp +++ b/components/livestatus/contactstable.cpp @@ -44,7 +44,7 @@ void ContactsTable::AddColumns(Table *table, const String& prefix, table->AddColumn(prefix + "pager", Column(&ContactsTable::PagerAccessor, objectAccessor)); table->AddColumn(prefix + "host_notification_period", Column(&ContactsTable::HostNotificationPeriodAccessor, objectAccessor)); table->AddColumn(prefix + "service_notification_period", Column(&ContactsTable::ServiceNotificationPeriodAccessor, objectAccessor)); - table->AddColumn(prefix + "can_submit_commands", Column(&ContactsTable::CanSubmitCommandsAccessor, objectAccessor)); + table->AddColumn(prefix + "can_submit_commands", Column(&Table::OneAccessor, objectAccessor)); table->AddColumn(prefix + "host_notifications_enabled", Column(&ContactsTable::HostNotificationsEnabledAccessor, objectAccessor)); table->AddColumn(prefix + "service_notifications_enabled", Column(&ContactsTable::ServiceNotificationsEnabledAccessor, objectAccessor)); table->AddColumn(prefix + "in_host_notification_period", Column(&ContactsTable::InHostNotificationPeriodAccessor, objectAccessor)); @@ -119,12 +119,6 @@ Value ContactsTable::ServiceNotificationPeriodAccessor(const Value& row) return timeperiod->GetName(); } -Value ContactsTable::CanSubmitCommandsAccessor(const Value& row) -{ - /* default enabled */ - return 1; -} - Value ContactsTable::HostNotificationsEnabledAccessor(const Value& row) { return (static_cast(row)->GetEnableNotifications() ? 1 : 0); diff --git a/components/livestatus/contactstable.h b/components/livestatus/contactstable.h index e580ecbc7..57081331e 100644 --- a/components/livestatus/contactstable.h +++ b/components/livestatus/contactstable.h @@ -51,7 +51,6 @@ protected: static Value PagerAccessor(const Value& row); static Value HostNotificationPeriodAccessor(const Value& row); static Value ServiceNotificationPeriodAccessor(const Value& row); - static Value CanSubmitCommandsAccessor(const Value& row); static Value HostNotificationsEnabledAccessor(const Value& row); static Value ServiceNotificationsEnabledAccessor(const Value& row); static Value InHostNotificationPeriodAccessor(const Value& row); diff --git a/components/livestatus/hostgroupstable.cpp b/components/livestatus/hostgroupstable.cpp index 95f9f65a7..676ce1530 100644 --- a/components/livestatus/hostgroupstable.cpp +++ b/components/livestatus/hostgroupstable.cpp @@ -216,9 +216,7 @@ Value HostGroupsTable::NumServicesAccessor(const Value& row) return 0; BOOST_FOREACH(const Host::Ptr& host, hg->GetMembers()) { - BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) { - num_services++; - } + num_services += host->GetServices().size(); } return num_services; diff --git a/components/livestatus/hoststable.cpp b/components/livestatus/hoststable.cpp index 85b3c56af..e7cd2e51d 100644 --- a/components/livestatus/hoststable.cpp +++ b/components/livestatus/hoststable.cpp @@ -71,11 +71,11 @@ void HostsTable::AddColumns(Table *table, const String& prefix, table->AddColumn(prefix + "icon_image_alt", Column(&HostsTable::IconImageAltAccessor, objectAccessor)); table->AddColumn(prefix + "statusmap_image", Column(&HostsTable::StatusmapImageAccessor, objectAccessor)); table->AddColumn(prefix + "long_plugin_output", Column(&HostsTable::LongPluginOutputAccessor, objectAccessor)); - table->AddColumn(prefix + "initial_state", Column(&HostsTable::InitialStateAccessor, objectAccessor)); + table->AddColumn(prefix + "initial_state", Column(&Table::EmptyStringAccessor, objectAccessor)); table->AddColumn(prefix + "max_check_attempts", Column(&HostsTable::MaxCheckAttemptsAccessor, objectAccessor)); table->AddColumn(prefix + "flap_detection_enabled", Column(&HostsTable::FlapDetectionEnabledAccessor, objectAccessor)); - table->AddColumn(prefix + "check_freshness", Column(&HostsTable::CheckFreshnessAccessor, objectAccessor)); - table->AddColumn(prefix + "process_performance_data", Column(&HostsTable::ProcessPerformanceDataAccessor, objectAccessor)); + table->AddColumn(prefix + "check_freshness", Column(&Table::OneAccessor, objectAccessor)); + table->AddColumn(prefix + "process_performance_data", Column(&Table::OneAccessor, objectAccessor)); table->AddColumn(prefix + "accept_passive_checks", Column(&HostsTable::AcceptPassiveChecksAccessor, objectAccessor)); table->AddColumn(prefix + "event_handler_enabled", Column(&HostsTable::EventHandlerEnabledAccessor, objectAccessor)); table->AddColumn(prefix + "acknowledgement_type", Column(&HostsTable::AcknowledgementTypeAccessor, objectAccessor)); @@ -89,7 +89,7 @@ void HostsTable::AddColumns(Table *table, const String& prefix, table->AddColumn(prefix + "last_hard_state_change", Column(&HostsTable::LastHardStateChangeAccessor, objectAccessor)); table->AddColumn(prefix + "has_been_checked", Column(&HostsTable::HasBeenCheckedAccessor, objectAccessor)); table->AddColumn(prefix + "current_notification_number", Column(&HostsTable::CurrentNotificationNumberAccessor, objectAccessor)); - table->AddColumn(prefix + "pending_flex_downtime", Column(&HostsTable::PendingFlexDowntimeAccessor, objectAccessor)); + table->AddColumn(prefix + "pending_flex_downtime", Column(&Table::ZeroAccessor, objectAccessor)); table->AddColumn(prefix + "total_services", Column(&HostsTable::TotalServicesAccessor, objectAccessor)); table->AddColumn(prefix + "checks_enabled", Column(&HostsTable::ChecksEnabledAccessor, objectAccessor)); table->AddColumn(prefix + "notifications_enabled", Column(&HostsTable::NotificationsEnabledAccessor, objectAccessor)); @@ -97,7 +97,7 @@ void HostsTable::AddColumns(Table *table, const String& prefix, table->AddColumn(prefix + "state", Column(&HostsTable::StateAccessor, objectAccessor)); table->AddColumn(prefix + "state_type", Column(&HostsTable::StateTypeAccessor, objectAccessor)); table->AddColumn(prefix + "no_more_notifications", Column(&HostsTable::NoMoreNotificationsAccessor, objectAccessor)); - table->AddColumn(prefix + "check_flapping_recovery_notification", Column(&HostsTable::CheckFlappingRecoveryNotificationAccessor, objectAccessor)); + table->AddColumn(prefix + "check_flapping_recovery_notification", Column(&Table::ZeroAccessor, objectAccessor)); table->AddColumn(prefix + "last_check", Column(&HostsTable::LastCheckAccessor, objectAccessor)); table->AddColumn(prefix + "last_state_change", Column(&HostsTable::LastStateChangeAccessor, objectAccessor)); table->AddColumn(prefix + "last_time_up", Column(&HostsTable::LastTimeUpAccessor, objectAccessor)); @@ -105,21 +105,21 @@ void HostsTable::AddColumns(Table *table, const String& prefix, table->AddColumn(prefix + "last_time_unreachable", Column(&HostsTable::LastTimeUnreachableAccessor, objectAccessor)); table->AddColumn(prefix + "is_flapping", Column(&HostsTable::IsFlappingAccessor, objectAccessor)); table->AddColumn(prefix + "scheduled_downtime_depth", Column(&HostsTable::ScheduledDowntimeDepthAccessor, objectAccessor)); - table->AddColumn(prefix + "is_executing", Column(&HostsTable::IsExecutingAccessor, objectAccessor)); + table->AddColumn(prefix + "is_executing", Column(&Table::ZeroAccessor, objectAccessor)); table->AddColumn(prefix + "active_checks_enabled", Column(&HostsTable::ActiveChecksEnabledAccessor, objectAccessor)); table->AddColumn(prefix + "check_options", Column(&HostsTable::CheckOptionsAccessor, objectAccessor)); - table->AddColumn(prefix + "obsess_over_host", Column(&HostsTable::ObsessOverHostAccessor, objectAccessor)); + table->AddColumn(prefix + "obsess_over_host", Column(&Table::ZeroAccessor, objectAccessor)); table->AddColumn(prefix + "modified_attributes", Column(&HostsTable::ModifiedAttributesAccessor, objectAccessor)); table->AddColumn(prefix + "modified_attributes_list", Column(&HostsTable::ModifiedAttributesListAccessor, objectAccessor)); table->AddColumn(prefix + "check_interval", Column(&HostsTable::CheckIntervalAccessor, objectAccessor)); table->AddColumn(prefix + "retry_interval", Column(&HostsTable::RetryIntervalAccessor, objectAccessor)); table->AddColumn(prefix + "notification_interval", Column(&HostsTable::NotificationIntervalAccessor, objectAccessor)); - table->AddColumn(prefix + "first_notification_delay", Column(&HostsTable::FirstNotificationDelayAccessor, objectAccessor)); + table->AddColumn(prefix + "first_notification_delay", Column(&Table::EmptyStringAccessor, objectAccessor)); table->AddColumn(prefix + "low_flap_threshold", Column(&HostsTable::LowFlapThresholdAccessor, objectAccessor)); table->AddColumn(prefix + "high_flap_threshold", Column(&HostsTable::HighFlapThresholdAccessor, objectAccessor)); - table->AddColumn(prefix + "x_3d", Column(&HostsTable::X3dAccessor, objectAccessor)); - table->AddColumn(prefix + "y_3d", Column(&HostsTable::Y3dAccessor, objectAccessor)); - table->AddColumn(prefix + "z_3d", Column(&HostsTable::Z3dAccessor, objectAccessor)); + table->AddColumn(prefix + "x_3d", Column(&EmptyStringAccessor, objectAccessor)); + table->AddColumn(prefix + "y_3d", Column(&EmptyStringAccessor, objectAccessor)); + table->AddColumn(prefix + "z_3d", Column(&EmptyStringAccessor, objectAccessor)); table->AddColumn(prefix + "x_2d", Column(&HostsTable::X2dAccessor, objectAccessor)); table->AddColumn(prefix + "y_2d", Column(&HostsTable::Y2dAccessor, objectAccessor)); table->AddColumn(prefix + "latency", Column(&HostsTable::LatencyAccessor, objectAccessor)); @@ -136,7 +136,7 @@ void HostsTable::AddColumns(Table *table, const String& prefix, table->AddColumn(prefix + "custom_variable_names", Column(&HostsTable::CustomVariableNamesAccessor, objectAccessor)); table->AddColumn(prefix + "custom_variable_values", Column(&HostsTable::CustomVariableValuesAccessor, objectAccessor)); table->AddColumn(prefix + "custom_variables", Column(&HostsTable::CustomVariablesAccessor, objectAccessor)); - table->AddColumn(prefix + "filename", Column(&HostsTable::FilenameAccessor, objectAccessor)); + table->AddColumn(prefix + "filename", Column(&Table::EmptyStringAccessor, objectAccessor)); table->AddColumn(prefix + "parents", Column(&HostsTable::ParentsAccessor, objectAccessor)); table->AddColumn(prefix + "childs", Column(&HostsTable::ChildsAccessor, objectAccessor)); table->AddColumn(prefix + "num_services", Column(&HostsTable::NumServicesAccessor, objectAccessor)); @@ -152,7 +152,7 @@ void HostsTable::AddColumns(Table *table, const String& prefix, table->AddColumn(prefix + "num_services_hard_crit", Column(&HostsTable::NumServicesHardCritAccessor, objectAccessor)); table->AddColumn(prefix + "num_services_hard_unknown", Column(&HostsTable::NumServicesHardUnknownAccessor, objectAccessor)); table->AddColumn(prefix + "hard_state", Column(&HostsTable::HardStateAccessor, objectAccessor)); - table->AddColumn(prefix + "pnpgraph_present", Column(&HostsTable::PnpgraphPresentAccessor, objectAccessor)); + table->AddColumn(prefix + "pnpgraph_present", Column(&Table::ZeroAccessor, objectAccessor)); table->AddColumn(prefix + "staleness", Column(&HostsTable::StalenessAccessor, objectAccessor)); table->AddColumn(prefix + "groups", Column(&HostsTable::GroupsAccessor, objectAccessor)); table->AddColumn(prefix + "contact_groups", Column(&HostsTable::ContactGroupsAccessor, objectAccessor)); @@ -513,12 +513,6 @@ Value HostsTable::LongPluginOutputAccessor(const Value& row) return long_output; } -Value HostsTable::InitialStateAccessor(const Value& row) -{ - /* not supported */ - return Empty; -} - Value HostsTable::MaxCheckAttemptsAccessor(const Value& row) { /* use hostcheck service */ @@ -541,18 +535,6 @@ Value HostsTable::FlapDetectionEnabledAccessor(const Value& row) return (hc->GetEnableFlapping() ? 1 : 0); } -Value HostsTable::CheckFreshnessAccessor(const Value& row) -{ - /* always enabled */ - return 1; -} - -Value HostsTable::ProcessPerformanceDataAccessor(const Value& row) -{ - /* always enabled */ - return 1; -} - Value HostsTable::AcceptPassiveChecksAccessor(const Value& row) { /* use hostcheck service */ @@ -566,8 +548,17 @@ Value HostsTable::AcceptPassiveChecksAccessor(const Value& row) Value HostsTable::EventHandlerEnabledAccessor(const Value& row) { - /* always enabled */ - return 1; + /* use hostcheck service */ + Service::Ptr hc = static_cast(row)->GetCheckService(); + + if (!hc) + return Empty; + + EventCommand::Ptr eventcommand = hc->GetEventCommand(); + if (eventcommand) + return 1; + + return 0; } Value HostsTable::AcknowledgementTypeAccessor(const Value& row) @@ -704,12 +695,6 @@ Value HostsTable::CurrentNotificationNumberAccessor(const Value& row) } -Value HostsTable::PendingFlexDowntimeAccessor(const Value& row) -{ - /* not supported */ - return Empty; -} - Value HostsTable::TotalServicesAccessor(const Value& row) { return static_cast(row)->GetTotalServices(); @@ -782,12 +767,6 @@ Value HostsTable::NoMoreNotificationsAccessor(const Value& row) return 0; } -Value HostsTable::CheckFlappingRecoveryNotificationAccessor(const Value& row) -{ - /* not supported */ - return Empty; -} - Value HostsTable::LastCheckAccessor(const Value& row) { /* use hostcheck service */ @@ -841,12 +820,6 @@ Value HostsTable::ScheduledDowntimeDepthAccessor(const Value& row) return hc->GetDowntimeDepth(); } -Value HostsTable::IsExecutingAccessor(const Value& row) -{ - /* does that make sense with Icinga2? */ - return Empty; -} - Value HostsTable::ActiveChecksEnabledAccessor(const Value& row) { /* duplicate of ChecksEnableAccessor */ @@ -865,12 +838,6 @@ Value HostsTable::CheckOptionsAccessor(const Value& row) return Empty; } -Value HostsTable::ObsessOverHostAccessor(const Value& row) -{ - /* not supported */ - return Empty; -} - Value HostsTable::ModifiedAttributesAccessor(const Value& row) { /* not supported */ @@ -926,12 +893,6 @@ Value HostsTable::NotificationIntervalAccessor(const Value& row) return (notification_interval / 60.0); } -Value HostsTable::FirstNotificationDelayAccessor(const Value& row) -{ - /* not supported */ - return Empty; -} - Value HostsTable::LowFlapThresholdAccessor(const Value& row) { /* use hostcheck service */ @@ -954,24 +915,6 @@ Value HostsTable::HighFlapThresholdAccessor(const Value& row) return hc->GetFlappingThreshold(); } -Value HostsTable::X3dAccessor(const Value& row) -{ - /* not supported - removed in Icinga 1.x */ - return Empty; -} - -Value HostsTable::Y3dAccessor(const Value& row) -{ - /* not supported - removed in Icinga 1.x */ - return Empty; -} - -Value HostsTable::Z3dAccessor(const Value& row) -{ - /* not supported - removed in Icinga 1.x */ - return Empty; -} - Value HostsTable::X2dAccessor(const Value& row) { Dictionary::Ptr custom = static_cast(row)->GetCustom(); @@ -1365,11 +1308,6 @@ Value HostsTable::CustomVariablesAccessor(const Value& row) return cv; } -Value HostsTable::FilenameAccessor(const Value& row) -{ - /* not supported */ - return Empty; -} Value HostsTable::ParentsAccessor(const Value& row) { @@ -1549,12 +1487,6 @@ Value HostsTable::HardStateAccessor(const Value& row) return hc->GetLastHardState(); } -Value HostsTable::PnpgraphPresentAccessor(const Value& row) -{ - /* wtf. not supported */ - return Empty; -} - Value HostsTable::StalenessAccessor(const Value& row) { /* use hostcheck service */ diff --git a/components/livestatus/hoststable.h b/components/livestatus/hoststable.h index 27bd1b1d5..fac11aad2 100644 --- a/components/livestatus/hoststable.h +++ b/components/livestatus/hoststable.h @@ -61,16 +61,14 @@ protected: static Value ActionUrlAccessor(const Value& row); static Value ActionUrlExpandedAccessor(const Value& row); static Value PluginOutputAccessor(const Value& row); - static Value PerfDataAccessor(const Value& row); + static Value PerfDataAccessor(const Value& row); static Value IconImageAccessor(const Value& row); static Value IconImageExpandedAccessor(const Value& row); static Value IconImageAltAccessor(const Value& row); static Value StatusmapImageAccessor(const Value& row); static Value LongPluginOutputAccessor(const Value& row); - static Value InitialStateAccessor(const Value& row); static Value MaxCheckAttemptsAccessor(const Value& row); static Value FlapDetectionEnabledAccessor(const Value& row); - static Value CheckFreshnessAccessor(const Value& row); static Value ProcessPerformanceDataAccessor(const Value& row); static Value AcceptPassiveChecksAccessor(const Value& row); static Value EventHandlerEnabledAccessor(const Value& row); @@ -85,7 +83,6 @@ protected: static Value LastHardStateChangeAccessor(const Value& row); static Value HasBeenCheckedAccessor(const Value& row); static Value CurrentNotificationNumberAccessor(const Value& row); - static Value PendingFlexDowntimeAccessor(const Value& row); static Value TotalServicesAccessor(const Value& row); static Value ChecksEnabledAccessor(const Value& row); static Value NotificationsEnabledAccessor(const Value& row); @@ -93,7 +90,6 @@ protected: static Value StateAccessor(const Value& row); static Value StateTypeAccessor(const Value& row); static Value NoMoreNotificationsAccessor(const Value& row); - static Value CheckFlappingRecoveryNotificationAccessor(const Value& row); static Value LastCheckAccessor(const Value& row); static Value LastStateChangeAccessor(const Value& row); static Value LastTimeUpAccessor(const Value& row); @@ -101,21 +97,15 @@ protected: static Value LastTimeUnreachableAccessor(const Value& row); static Value IsFlappingAccessor(const Value& row); static Value ScheduledDowntimeDepthAccessor(const Value& row); - static Value IsExecutingAccessor(const Value& row); static Value ActiveChecksEnabledAccessor(const Value& row); static Value CheckOptionsAccessor(const Value& row); - static Value ObsessOverHostAccessor(const Value& row); static Value ModifiedAttributesAccessor(const Value& row); static Value ModifiedAttributesListAccessor(const Value& row); static Value CheckIntervalAccessor(const Value& row); static Value RetryIntervalAccessor(const Value& row); static Value NotificationIntervalAccessor(const Value& row); - static Value FirstNotificationDelayAccessor(const Value& row); static Value LowFlapThresholdAccessor(const Value& row); static Value HighFlapThresholdAccessor(const Value& row); - static Value X3dAccessor(const Value& row); - static Value Y3dAccessor(const Value& row); - static Value Z3dAccessor(const Value& row); static Value X2dAccessor(const Value& row); static Value Y2dAccessor(const Value& row); static Value LatencyAccessor(const Value& row); @@ -132,7 +122,6 @@ protected: static Value CustomVariableNamesAccessor(const Value& row); static Value CustomVariableValuesAccessor(const Value& row); static Value CustomVariablesAccessor(const Value& row); - static Value FilenameAccessor(const Value& row); static Value ParentsAccessor(const Value& row); static Value ChildsAccessor(const Value& row); static Value NumServicesAccessor(const Value& row); @@ -148,7 +137,6 @@ protected: static Value NumServicesHardCritAccessor(const Value& row); static Value NumServicesHardUnknownAccessor(const Value& row); static Value HardStateAccessor(const Value& row); - static Value PnpgraphPresentAccessor(const Value& row); static Value StalenessAccessor(const Value& row); static Value GroupsAccessor(const Value& row); static Value ContactGroupsAccessor(const Value& row); diff --git a/components/livestatus/query.cpp b/components/livestatus/query.cpp index ed3c674e4..7181ac400 100644 --- a/components/livestatus/query.cpp +++ b/components/livestatus/query.cpp @@ -181,7 +181,7 @@ Query::Query(const std::vector& lines) } else if (header == "Or" || header == "And") { std::deque& deq = (header == "Or" || header == "And") ? filters : stats; - int num = Convert::ToLong(params); + unsigned int num = Convert::ToLong(params); CombinerFilter::Ptr filter; if (header == "Or" || header == "StatsOr") @@ -196,7 +196,7 @@ Query::Query(const std::vector& lines) return; } - while (num--) { + while (num-- && num > 0) { filter->AddSubFilter(deq.back()); deq.pop_back(); } @@ -394,7 +394,7 @@ void Query::ExecuteGetHelper(const Stream::Ptr& stream) } Array::Ptr row = boost::make_shared(); - for (int i = 0; i < m_Aggregators.size(); i++) + for (size_t i = 0; i < m_Aggregators.size(); i++) row->Add(stats[i]); rs->Add(row); diff --git a/components/livestatus/servicestable.cpp b/components/livestatus/servicestable.cpp index ec1dba88c..d07ed5543 100644 --- a/components/livestatus/servicestable.cpp +++ b/components/livestatus/servicestable.cpp @@ -64,7 +64,7 @@ void ServicesTable::AddColumns(Table *table, const String& prefix, table->AddColumn(prefix + "icon_image", Column(&ServicesTable::IconImageAccessor, objectAccessor)); table->AddColumn(prefix + "icon_image_expanded", Column(&ServicesTable::IconImageExpandedAccessor, objectAccessor)); table->AddColumn(prefix + "icon_image_alt", Column(&ServicesTable::IconImageAltAccessor, objectAccessor)); - table->AddColumn(prefix + "initial_state", Column(&ServicesTable::InitialStateAccessor, objectAccessor)); + table->AddColumn(prefix + "initial_state", Column(&Table::EmptyStringAccessor, objectAccessor)); table->AddColumn(prefix + "max_check_attempts", Column(&ServicesTable::MaxCheckAttemptsAccessor, objectAccessor)); table->AddColumn(prefix + "current_attempt", Column(&ServicesTable::CurrentAttemptAccessor, objectAccessor)); table->AddColumn(prefix + "state", Column(&ServicesTable::StateAccessor, objectAccessor)); @@ -93,21 +93,21 @@ void ServicesTable::AddColumns(Table *table, const String& prefix, table->AddColumn(prefix + "accept_passive_checks", Column(&ServicesTable::AcceptPassiveChecksAccessor, objectAccessor)); table->AddColumn(prefix + "event_handler_enabled", Column(&ServicesTable::EventHandlerEnabledAccessor, objectAccessor)); table->AddColumn(prefix + "notifications_enabled", Column(&ServicesTable::NotificationsEnabledAccessor, objectAccessor)); - table->AddColumn(prefix + "process_performance_data", Column(&ServicesTable::ProcessPerformanceDataAccessor, objectAccessor)); - table->AddColumn(prefix + "is_executing", Column(&ServicesTable::IsExecutingAccessor, objectAccessor)); + table->AddColumn(prefix + "process_performance_data", Column(&Table::OneAccessor, objectAccessor)); + table->AddColumn(prefix + "is_executing", Column(&Table::ZeroAccessor, objectAccessor)); table->AddColumn(prefix + "active_checks_enabled", Column(&ServicesTable::ActiveChecksEnabledAccessor, objectAccessor)); table->AddColumn(prefix + "check_options", Column(&ServicesTable::CheckOptionsAccessor, objectAccessor)); table->AddColumn(prefix + "flap_detection_enabled", Column(&ServicesTable::FlapDetectionEnabledAccessor, objectAccessor)); table->AddColumn(prefix + "check_freshness", Column(&ServicesTable::CheckFreshnessAccessor, objectAccessor)); - table->AddColumn(prefix + "obsess_over_service", Column(&ServicesTable::ObsessOverServiceAccessor, objectAccessor)); + table->AddColumn(prefix + "obsess_over_service", Column(&Table::ZeroAccessor, objectAccessor)); table->AddColumn(prefix + "modified_attributes", Column(&ServicesTable::ModifiedAttributesAccessor, objectAccessor)); table->AddColumn(prefix + "modified_attributes_list", Column(&ServicesTable::ModifiedAttributesListAccessor, objectAccessor)); - table->AddColumn(prefix + "pnpgraph_present", Column(&ServicesTable::PnpgraphPresentAccessor, objectAccessor)); + table->AddColumn(prefix + "pnpgraph_present", Column(&Table::ZeroAccessor, objectAccessor)); table->AddColumn(prefix + "staleness", Column(&ServicesTable::StalenessAccessor, objectAccessor)); table->AddColumn(prefix + "check_interval", Column(&ServicesTable::CheckIntervalAccessor, objectAccessor)); table->AddColumn(prefix + "retry_interval", Column(&ServicesTable::RetryIntervalAccessor, objectAccessor)); table->AddColumn(prefix + "notification_interval", Column(&ServicesTable::NotificationIntervalAccessor, objectAccessor)); - table->AddColumn(prefix + "first_notification_delay", Column(&ServicesTable::FirstNotificationDelayAccessor, objectAccessor)); + table->AddColumn(prefix + "first_notification_delay", Column(&Table::EmptyStringAccessor, objectAccessor)); table->AddColumn(prefix + "low_flap_threshold", Column(&ServicesTable::LowFlapThresholdAccessor, objectAccessor)); table->AddColumn(prefix + "high_flap_threshold", Column(&ServicesTable::HighFlapThresholdAccessor, objectAccessor)); table->AddColumn(prefix + "latency", Column(&ServicesTable::LatencyAccessor, objectAccessor)); @@ -400,12 +400,6 @@ Value ServicesTable::IconImageAltAccessor(const Value& row) return custom->Get("icon_image_alt"); } -Value ServicesTable::InitialStateAccessor(const Value& row) -{ - /* not supported */ - return Empty; -} - Value ServicesTable::MaxCheckAttemptsAccessor(const Value& row) { return static_cast(row)->GetMaxCheckAttempts(); @@ -587,8 +581,12 @@ Value ServicesTable::AcceptPassiveChecksAccessor(const Value& row) Value ServicesTable::EventHandlerEnabledAccessor(const Value& row) { - /* always enabled */ - return 1; + EventCommand::Ptr eventcommand = static_cast(row)->GetEventCommand(); + + if (eventcommand) + return 1; + + return 0; } Value ServicesTable::NotificationsEnabledAccessor(const Value& row) @@ -596,18 +594,6 @@ Value ServicesTable::NotificationsEnabledAccessor(const Value& row) return (static_cast(row)->GetEnableNotifications() ? 1 : 0); } -Value ServicesTable::ProcessPerformanceDataAccessor(const Value& row) -{ - /* always enabled */ - return 1; -} - -Value ServicesTable::IsExecutingAccessor(const Value& row) -{ - /* not supported */ - return Empty; -} - Value ServicesTable::ActiveChecksEnabledAccessor(const Value& row) { return (static_cast(row)->GetEnableActiveChecks() ? 1 : 0); @@ -630,12 +616,6 @@ Value ServicesTable::CheckFreshnessAccessor(const Value& row) return 1; } -Value ServicesTable::ObsessOverServiceAccessor(const Value& row) -{ - /* not supported */ - return Empty; -} - Value ServicesTable::ModifiedAttributesAccessor(const Value& row) { /* not supported */ @@ -648,12 +628,6 @@ Value ServicesTable::ModifiedAttributesListAccessor(const Value& row) return Empty; } -Value ServicesTable::PnpgraphPresentAccessor(const Value& row) -{ - /* not supported */ - return Empty; -} - Value ServicesTable::StalenessAccessor(const Value& row) { Service::Ptr service = static_cast(row); @@ -691,12 +665,6 @@ Value ServicesTable::NotificationIntervalAccessor(const Value& row) return (notification_interval / 60.0); } -Value ServicesTable::FirstNotificationDelayAccessor(const Value& row) -{ - /* not supported */ - return Empty; -} - Value ServicesTable::LowFlapThresholdAccessor(const Value& row) { return static_cast(row)->GetFlappingThreshold(); diff --git a/components/livestatus/servicestable.h b/components/livestatus/servicestable.h index f27477764..9aa9198bb 100644 --- a/components/livestatus/servicestable.h +++ b/components/livestatus/servicestable.h @@ -66,7 +66,6 @@ protected: static Value IconImageAccessor(const Value& row); static Value IconImageExpandedAccessor(const Value& row); static Value IconImageAltAccessor(const Value& row); - static Value InitialStateAccessor(const Value& row); static Value MaxCheckAttemptsAccessor(const Value& row); static Value CurrentAttemptAccessor(const Value& row); static Value StateAccessor(const Value& row); @@ -95,21 +94,16 @@ protected: static Value AcceptPassiveChecksAccessor(const Value& row); static Value EventHandlerEnabledAccessor(const Value& row); static Value NotificationsEnabledAccessor(const Value& row); - static Value ProcessPerformanceDataAccessor(const Value& row); - static Value IsExecutingAccessor(const Value& row); static Value ActiveChecksEnabledAccessor(const Value& row); static Value CheckOptionsAccessor(const Value& row); static Value FlapDetectionEnabledAccessor(const Value& row); static Value CheckFreshnessAccessor(const Value& row); - static Value ObsessOverServiceAccessor(const Value& row); static Value ModifiedAttributesAccessor(const Value& row); static Value ModifiedAttributesListAccessor(const Value& row); - static Value PnpgraphPresentAccessor(const Value& row); static Value StalenessAccessor(const Value& row); static Value CheckIntervalAccessor(const Value& row); static Value RetryIntervalAccessor(const Value& row); static Value NotificationIntervalAccessor(const Value& row); - static Value FirstNotificationDelayAccessor(const Value& row); static Value LowFlapThresholdAccessor(const Value& row); static Value HighFlapThresholdAccessor(const Value& row); static Value LatencyAccessor(const Value& row); diff --git a/components/livestatus/statustable.cpp b/components/livestatus/statustable.cpp index 847d69121..b348db7fd 100644 --- a/components/livestatus/statustable.cpp +++ b/components/livestatus/statustable.cpp @@ -38,65 +38,65 @@ StatusTable::StatusTable(void) void StatusTable::AddColumns(Table *table, const String& prefix, const Column::ObjectAccessor& objectAccessor) { - table->AddColumn(prefix + "neb_callbacks", Column(&StatusTable::NebCallbacksAccessor, objectAccessor)); - table->AddColumn(prefix + "neb_callbacks_rate", Column(&StatusTable::NebCallbacksRateAccessor, objectAccessor)); + table->AddColumn(prefix + "neb_callbacks", Column(&Table::ZeroAccessor, objectAccessor)); + table->AddColumn(prefix + "neb_callbacks_rate", Column(&Table::ZeroAccessor, objectAccessor)); - table->AddColumn(prefix + "requests", Column(&StatusTable::RequestsAccessor, objectAccessor)); - table->AddColumn(prefix + "requests_rate", Column(&StatusTable::RequestsRateAccessor, objectAccessor)); + table->AddColumn(prefix + "requests", Column(&Table::ZeroAccessor, objectAccessor)); + table->AddColumn(prefix + "requests_rate", Column(&Table::ZeroAccessor, objectAccessor)); table->AddColumn(prefix + "connections", Column(&StatusTable::ConnectionsAccessor, objectAccessor)); table->AddColumn(prefix + "connections_rate", Column(&StatusTable::ConnectionsRateAccessor, objectAccessor)); - table->AddColumn(prefix + "service_checks", Column(&StatusTable::ServiceChecksAccessor, objectAccessor)); - table->AddColumn(prefix + "service_checks_rate", Column(&StatusTable::ServiceChecksRateAccessor, objectAccessor)); + table->AddColumn(prefix + "service_checks", Column(&Table::ZeroAccessor, objectAccessor)); + table->AddColumn(prefix + "service_checks_rate", Column(&Table::ZeroAccessor, objectAccessor)); - table->AddColumn(prefix + "host_checks", Column(&StatusTable::HostChecksAccessor, objectAccessor)); - table->AddColumn(prefix + "host_checks_rate", Column(&StatusTable::HostChecksRateAccessor, objectAccessor)); + table->AddColumn(prefix + "host_checks", Column(&Table::ZeroAccessor, objectAccessor)); + table->AddColumn(prefix + "host_checks_rate", Column(&Table::ZeroAccessor, objectAccessor)); - table->AddColumn(prefix + "forks", Column(&StatusTable::ForksAccessor, objectAccessor)); - table->AddColumn(prefix + "forks_rate", Column(&StatusTable::ForksRateAccessor, objectAccessor)); + table->AddColumn(prefix + "forks", Column(&Table::ZeroAccessor, objectAccessor)); + table->AddColumn(prefix + "forks_rate", Column(&Table::ZeroAccessor, objectAccessor)); - table->AddColumn(prefix + "log_messages", Column(&StatusTable::LogMessagesAccessor, objectAccessor)); - table->AddColumn(prefix + "log_messages_rate", Column(&StatusTable::LogMessagesRateAccessor, objectAccessor)); + table->AddColumn(prefix + "log_messages", Column(&Table::ZeroAccessor, objectAccessor)); + table->AddColumn(prefix + "log_messages_rate", Column(&Table::ZeroAccessor, objectAccessor)); table->AddColumn(prefix + "external_commands", Column(&StatusTable::ExternalCommandsAccessor, objectAccessor)); table->AddColumn(prefix + "external_commands_rate", Column(&StatusTable::ExternalCommandsRateAccessor, objectAccessor)); - table->AddColumn(prefix + "livechecks", Column(&StatusTable::LivechecksAccessor, objectAccessor)); - table->AddColumn(prefix + "livechecks_rate", Column(&StatusTable::LivechecksRateAccessor, objectAccessor)); + table->AddColumn(prefix + "livechecks", Column(&Table::ZeroAccessor, objectAccessor)); + table->AddColumn(prefix + "livechecks_rate", Column(&Table::ZeroAccessor, objectAccessor)); - table->AddColumn(prefix + "livecheck_overflows", Column(&StatusTable::LivecheckOverflowsAccessor, objectAccessor)); - table->AddColumn(prefix + "livecheck_overflows_rate", Column(&StatusTable::LivecheckOverflowsRateAccessor, objectAccessor)); + table->AddColumn(prefix + "livecheck_overflows", Column(&Table::ZeroAccessor, objectAccessor)); + table->AddColumn(prefix + "livecheck_overflows_rate", Column(&Table::ZeroAccessor, objectAccessor)); table->AddColumn(prefix + "nagios_pid", Column(&StatusTable::NagiosPidAccessor, objectAccessor)); - table->AddColumn(prefix + "enable_notifications", Column(&StatusTable::EnableNotificationsAccessor, objectAccessor)); - table->AddColumn(prefix + "execute_service_checks", Column(&StatusTable::ExecuteServiceChecksAccessor, objectAccessor)); - table->AddColumn(prefix + "accept_passive_service_checks", Column(&StatusTable::AcceptPassiveServiceChecksAccessor, objectAccessor)); - table->AddColumn(prefix + "execute_host_checks", Column(&StatusTable::ExecuteHostChecksAccessor, objectAccessor)); - table->AddColumn(prefix + "accept_passive_host_checks", Column(&StatusTable::AcceptPassiveHostChecksAccessor, objectAccessor)); - table->AddColumn(prefix + "enable_event_handlers", Column(&StatusTable::EnableEventHandlersAccessor, objectAccessor)); - table->AddColumn(prefix + "obsess_over_services", Column(&StatusTable::ObsessOverHostsAccessor, objectAccessor)); - table->AddColumn(prefix + "obsess_over_hosts", Column(&StatusTable::ObsessOverServicesAccessor, objectAccessor)); - table->AddColumn(prefix + "check_service_freshness", Column(&StatusTable::CheckServiceFreshnessAccessor, objectAccessor)); - table->AddColumn(prefix + "check_host_freshness", Column(&StatusTable::CheckHostFreshnessAccessor, objectAccessor)); - table->AddColumn(prefix + "enable_flap_detection", Column(&StatusTable::EnableFlapDetectionAccessor, objectAccessor)); - table->AddColumn(prefix + "process_performance_data", Column(&StatusTable::ProcessPerformanceDataAccessor, objectAccessor)); - table->AddColumn(prefix + "check_external_commands", Column(&StatusTable::CheckExternalCommandsAccessor, objectAccessor)); + table->AddColumn(prefix + "enable_notifications", Column(&Table::OneAccessor, objectAccessor)); + table->AddColumn(prefix + "execute_service_checks", Column(&Table::OneAccessor, objectAccessor)); + table->AddColumn(prefix + "accept_passive_service_checks", Column(&Table::OneAccessor, objectAccessor)); + table->AddColumn(prefix + "execute_host_checks", Column(&Table::ZeroAccessor, objectAccessor)); + table->AddColumn(prefix + "accept_passive_host_checks", Column(&Table::OneAccessor, objectAccessor)); + table->AddColumn(prefix + "enable_event_handlers", Column(&Table::OneAccessor, objectAccessor)); + table->AddColumn(prefix + "obsess_over_services", Column(&Table::ZeroAccessor, objectAccessor)); + table->AddColumn(prefix + "obsess_over_hosts", Column(&Table::ZeroAccessor, objectAccessor)); + table->AddColumn(prefix + "check_service_freshness", Column(&Table::OneAccessor, objectAccessor)); + table->AddColumn(prefix + "check_host_freshness", Column(&Table::ZeroAccessor, objectAccessor)); + table->AddColumn(prefix + "enable_flap_detection", Column(&Table::OneAccessor, objectAccessor)); + table->AddColumn(prefix + "process_performance_data", Column(&Table::OneAccessor, objectAccessor)); + table->AddColumn(prefix + "check_external_commands", Column(&Table::OneAccessor, objectAccessor)); table->AddColumn(prefix + "program_start", Column(&StatusTable::ProgramStartAccessor, objectAccessor)); - table->AddColumn(prefix + "last_command_check", Column(&StatusTable::LastCommandCheckAccessor, objectAccessor)); - table->AddColumn(prefix + "last_log_rotation", Column(&StatusTable::LastLogRotationAccessor, objectAccessor)); - table->AddColumn(prefix + "interval_length", Column(&StatusTable::IntervalLengthAccessor, objectAccessor)); + table->AddColumn(prefix + "last_command_check", Column(&Table::ZeroAccessor, objectAccessor)); + table->AddColumn(prefix + "last_log_rotation", Column(&Table::ZeroAccessor, objectAccessor)); + table->AddColumn(prefix + "interval_length", Column(&Table::ZeroAccessor, objectAccessor)); table->AddColumn(prefix + "num_hosts", Column(&StatusTable::NumHostsAccessor, objectAccessor)); table->AddColumn(prefix + "num_services", Column(&StatusTable::NumServicesAccessor, objectAccessor)); table->AddColumn(prefix + "program_version", Column(&StatusTable::ProgramVersionAccessor, objectAccessor)); - table->AddColumn(prefix + "external_command_buffer_slots", Column(&StatusTable::ExternalCommandBufferSlotsAccessor, objectAccessor)); - table->AddColumn(prefix + "external_command_buffer_usage", Column(&StatusTable::ExternalCommandBufferUsageAccessor, objectAccessor)); - table->AddColumn(prefix + "external_command_buffer_max", Column(&StatusTable::ExternalCommandBufferMaxAccessor, objectAccessor)); - table->AddColumn(prefix + "cached_log_messages", Column(&StatusTable::CachedLogMessagesAccessor, objectAccessor)); + table->AddColumn(prefix + "external_command_buffer_slots", Column(&Table::ZeroAccessor, objectAccessor)); + table->AddColumn(prefix + "external_command_buffer_usage", Column(&Table::ZeroAccessor, objectAccessor)); + table->AddColumn(prefix + "external_command_buffer_max", Column(&Table::ZeroAccessor, objectAccessor)); + table->AddColumn(prefix + "cached_log_messages", Column(&Table::ZeroAccessor, objectAccessor)); table->AddColumn(prefix + "livestatus_version", Column(&StatusTable::LivestatusVersionAccessor, objectAccessor)); - table->AddColumn(prefix + "livestatus_active_connections", Column(&StatusTable::LivestatusActiveConnectionsAccessor, objectAccessor)); - table->AddColumn(prefix + "livestatus_queued_connections", Column(&StatusTable::LivestatusQueuedConnectionsAccessor, objectAccessor)); - table->AddColumn(prefix + "livestatus_threads", Column(&StatusTable::LivestatusThreadsAccessor, objectAccessor)); + table->AddColumn(prefix + "livestatus_active_connections", Column(&Table::ZeroAccessor, objectAccessor)); + table->AddColumn(prefix + "livestatus_queued_connections", Column(&Table::ZeroAccessor, objectAccessor)); + table->AddColumn(prefix + "livestatus_threads", Column(&Table::ZeroAccessor, objectAccessor)); } String StatusTable::GetName(void) const @@ -112,30 +112,6 @@ void StatusTable::FetchRows(const AddRowFunction& addRowFn) addRowFn(obj); } -Value StatusTable::NebCallbacksAccessor(const Value& row) -{ - /* not supported */ - return Empty; -} - -Value StatusTable::NebCallbacksRateAccessor(const Value& row) -{ - /* not supported */ - return Empty; -} - -Value StatusTable::RequestsAccessor(const Value& row) -{ - /* not supported */ - return Empty; -} - -Value StatusTable::RequestsRateAccessor(const Value& row) -{ - /* not supported */ - return Empty; -} - Value StatusTable::ConnectionsAccessor(const Value& row) { return LivestatusListener::GetConnections(); @@ -146,54 +122,6 @@ Value StatusTable::ConnectionsRateAccessor(const Value& row) return (LivestatusListener::GetConnections() / (Utility::GetTime() - IcingaApplication::GetInstance()->GetStartTime())); } -Value StatusTable::ServiceChecksAccessor(const Value& row) -{ - /* not supported */ - return Empty; -} - -Value StatusTable::ServiceChecksRateAccessor(const Value& row) -{ - /* not supported */ - return Empty; -} - -Value StatusTable::HostChecksAccessor(const Value& row) -{ - /* not supported */ - return Empty; -} - -Value StatusTable::HostChecksRateAccessor(const Value& row) -{ - /* not supported */ - return Empty; -} - -Value StatusTable::ForksAccessor(const Value& row) -{ - /* not supported */ - return Empty; -} - -Value StatusTable::ForksRateAccessor(const Value& row) -{ - /* not supported */ - return Empty; -} - -Value StatusTable::LogMessagesAccessor(const Value& row) -{ - /* not supported */ - return Empty; -} - -Value StatusTable::LogMessagesRateAccessor(const Value& row) -{ - /* not supported */ - return Empty; -} - Value StatusTable::ExternalCommandsAccessor(const Value& row) { return Query::GetExternalCommands(); @@ -204,136 +132,16 @@ Value StatusTable::ExternalCommandsRateAccessor(const Value& row) return (Query::GetExternalCommands() / (Utility::GetTime() - IcingaApplication::GetInstance()->GetStartTime())); } -Value StatusTable::LivechecksAccessor(const Value& row) -{ - /* not supported */ - return Empty; -} - -Value StatusTable::LivechecksRateAccessor(const Value& row) -{ - /* not supported */ - return Empty; -} - -Value StatusTable::LivecheckOverflowsAccessor(const Value& row) -{ - /* not supported */ - return Empty; -} - -Value StatusTable::LivecheckOverflowsRateAccessor(const Value& row) -{ - /* not supported */ - return Empty; -} - Value StatusTable::NagiosPidAccessor(const Value& row) { return Utility::GetPid(); } -Value StatusTable::EnableNotificationsAccessor(const Value& row) -{ - /* enabled by default*/ - return 1; -} - -Value StatusTable::ExecuteServiceChecksAccessor(const Value& row) -{ - /* enabled by default*/ - return 1; -} - -Value StatusTable::AcceptPassiveServiceChecksAccessor(const Value& row) -{ - /* enabled by default*/ - return 1; -} - -Value StatusTable::ExecuteHostChecksAccessor(const Value& row) -{ - /* enabled by default*/ - return 1; -} - -Value StatusTable::AcceptPassiveHostChecksAccessor(const Value& row) -{ - /* enabled by default*/ - return 1; -} - -Value StatusTable::EnableEventHandlersAccessor(const Value& row) -{ - /* enabled by default*/ - return 1; -} - -Value StatusTable::ObsessOverServicesAccessor(const Value& row) -{ - /* not supported */ - return Empty; -} - -Value StatusTable::ObsessOverHostsAccessor(const Value& row) -{ - /* not supported */ - return Empty; -} - -Value StatusTable::CheckServiceFreshnessAccessor(const Value& row) -{ - /* enable by default */ - return 1; -} - -Value StatusTable::CheckHostFreshnessAccessor(const Value& row) -{ - /* TODO */ - return Empty; -} - -Value StatusTable::EnableFlapDetectionAccessor(const Value& row) -{ - /* enabled by default*/ - return 1; -} - -Value StatusTable::ProcessPerformanceDataAccessor(const Value& row) -{ - /* enabled by default*/ - return 1; -} - -Value StatusTable::CheckExternalCommandsAccessor(const Value& row) -{ - /* enabled by default*/ - return 1; -} - Value StatusTable::ProgramStartAccessor(const Value& row) { return static_cast(IcingaApplication::GetInstance()->GetStartTime()); } -Value StatusTable::LastCommandCheckAccessor(const Value& row) -{ - /* always == now */ - return static_cast(Utility::GetTime()); -} - -Value StatusTable::LastLogRotationAccessor(const Value& row) -{ - /* TODO */ - return Empty; -} - -Value StatusTable::IntervalLengthAccessor(const Value& row) -{ - /* hardcoded 60s */ - return 60; -} - Value StatusTable::NumHostsAccessor(const Value& row) { return DynamicType::GetObjects().size(); @@ -349,48 +157,7 @@ Value StatusTable::ProgramVersionAccessor(const Value& row) return "2.0"; } -Value StatusTable::ExternalCommandBufferSlotsAccessor(const Value& row) -{ - /* infinite */ - return Empty; -} - -Value StatusTable::ExternalCommandBufferUsageAccessor(const Value& row) -{ - /* not supported */ - return Empty; -} - -Value StatusTable::ExternalCommandBufferMaxAccessor(const Value& row) -{ - /* not supported */ - return Empty; -} - -Value StatusTable::CachedLogMessagesAccessor(const Value& row) -{ - /* not supported */ - return Empty; -} - -Value StatusTable::LivestatusVersionAccessor(const Value& row) -{ - return "2.0"; -} - Value StatusTable::LivestatusActiveConnectionsAccessor(const Value& row) { return LivestatusListener::GetClientsConnected(); } - -Value StatusTable::LivestatusQueuedConnectionsAccessor(const Value& row) -{ - /* not supported */ - return Empty; -} - -Value StatusTable::LivestatusThreadsAccessor(const Value& row) -{ - /* TODO */ - return Empty; -} diff --git a/components/livestatus/statustable.h b/components/livestatus/statustable.h index b7adcaf33..b8584df55 100644 --- a/components/livestatus/statustable.h +++ b/components/livestatus/statustable.h @@ -45,55 +45,17 @@ public: protected: virtual void FetchRows(const AddRowFunction& addRowFn); - static Value NebCallbacksAccessor(const Value& row); - static Value NebCallbacksRateAccessor(const Value& row); - static Value RequestsAccessor(const Value& row); - static Value RequestsRateAccessor(const Value& row); 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 HostChecksAccessor(const Value& row); - static Value HostChecksRateAccessor(const Value& row); - static Value ForksAccessor(const Value& row); - static Value ForksRateAccessor(const Value& row); - static Value LogMessagesAccessor(const Value& row); - static Value LogMessagesRateAccessor(const Value& row); static Value ExternalCommandsAccessor(const Value& row); static Value ExternalCommandsRateAccessor(const Value& row); - static Value LivechecksAccessor(const Value& row); - static Value LivechecksRateAccessor(const Value& row); - static Value LivecheckOverflowsAccessor(const Value& row); - static Value LivecheckOverflowsRateAccessor(const Value& row); static Value NagiosPidAccessor(const Value& row); - static Value EnableNotificationsAccessor(const Value& row); - static Value ExecuteServiceChecksAccessor(const Value& row); - static Value AcceptPassiveServiceChecksAccessor(const Value& row); - static Value ExecuteHostChecksAccessor(const Value& row); - static Value AcceptPassiveHostChecksAccessor(const Value& row); - static Value EnableEventHandlersAccessor(const Value& row); - static Value ObsessOverServicesAccessor(const Value& row); - static Value ObsessOverHostsAccessor(const Value& row); - static Value CheckServiceFreshnessAccessor(const Value& row); - static Value CheckHostFreshnessAccessor(const Value& row); - static Value EnableFlapDetectionAccessor(const Value& row); - static Value ProcessPerformanceDataAccessor(const Value& row); - static Value CheckExternalCommandsAccessor(const Value& row); static Value ProgramStartAccessor(const Value& row); - static Value LastCommandCheckAccessor(const Value& row); - static Value LastLogRotationAccessor(const Value& row); - static Value IntervalLengthAccessor(const Value& row); static Value NumHostsAccessor(const Value& row); static Value NumServicesAccessor(const Value& row); static Value ProgramVersionAccessor(const Value& row); - static Value ExternalCommandBufferSlotsAccessor(const Value& row); - static Value ExternalCommandBufferUsageAccessor(const Value& row); - static Value ExternalCommandBufferMaxAccessor(const Value& row); - static Value CachedLogMessagesAccessor(const Value& row); static Value LivestatusVersionAccessor(const Value& row); static Value LivestatusActiveConnectionsAccessor(const Value& row); - static Value LivestatusQueuedConnectionsAccessor(const Value& row); - static Value LivestatusThreadsAccessor(const Value& row); }; }