mirror of https://github.com/Icinga/icinga2.git
ido: add missing host/service config/status attributes
refs #4380 refs #4378
This commit is contained in:
parent
78b10102c1
commit
260b5f174f
|
@ -28,6 +28,7 @@
|
||||||
#include <boost/algorithm/string/replace.hpp>
|
#include <boost/algorithm/string/replace.hpp>
|
||||||
#include <boost/algorithm/string/classification.hpp>
|
#include <boost/algorithm/string/classification.hpp>
|
||||||
#include <boost/algorithm/string/split.hpp>
|
#include <boost/algorithm/string/split.hpp>
|
||||||
|
#include <boost/algorithm/string/join.hpp>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
|
@ -140,7 +141,10 @@ Dictionary::Ptr CompatUtility::GetServiceStatusAttributes(const Service::Ptr& se
|
||||||
attr->Set("last_state_change", service->GetLastStateChange());
|
attr->Set("last_state_change", service->GetLastStateChange());
|
||||||
attr->Set("last_hard_state_change", service->GetLastHardStateChange());
|
attr->Set("last_hard_state_change", service->GetLastHardStateChange());
|
||||||
attr->Set("last_update", time(NULL));
|
attr->Set("last_update", time(NULL));
|
||||||
|
attr->Set("process_performance_data", 1); /* always enabled */
|
||||||
|
attr->Set("freshness_checks_enabled", 1); /* always enabled */
|
||||||
attr->Set("notifications_enabled", (service->GetEnableNotifications() ? 1 : 0));
|
attr->Set("notifications_enabled", (service->GetEnableNotifications() ? 1 : 0));
|
||||||
|
attr->Set("event_handler_enabled", 1); /* always enabled */
|
||||||
attr->Set("active_checks_enabled", (service->GetEnableActiveChecks() ? 1 : 0));
|
attr->Set("active_checks_enabled", (service->GetEnableActiveChecks() ? 1 : 0));
|
||||||
attr->Set("passive_checks_enabled", (service->GetEnablePassiveChecks() ? 1 : 0));
|
attr->Set("passive_checks_enabled", (service->GetEnablePassiveChecks() ? 1 : 0));
|
||||||
attr->Set("flap_detection_enabled", (service->GetEnableFlapping() ? 1 : 0));
|
attr->Set("flap_detection_enabled", (service->GetEnableFlapping() ? 1 : 0));
|
||||||
|
@ -176,9 +180,22 @@ Dictionary::Ptr CompatUtility::GetServiceConfigAttributes(const Service::Ptr& se
|
||||||
check_period_str = "24x7";
|
check_period_str = "24x7";
|
||||||
|
|
||||||
double notification_interval = -1;
|
double notification_interval = -1;
|
||||||
|
String notification_period;
|
||||||
|
unsigned long notification_type_filter;
|
||||||
|
unsigned long notification_state_filter;
|
||||||
|
|
||||||
BOOST_FOREACH(const Notification::Ptr& notification, service->GetNotifications()) {
|
BOOST_FOREACH(const Notification::Ptr& notification, service->GetNotifications()) {
|
||||||
if (notification_interval == -1 || notification->GetNotificationInterval() < notification_interval)
|
if (notification_interval == -1 || notification->GetNotificationInterval() < notification_interval)
|
||||||
notification_interval = notification->GetNotificationInterval();
|
notification_interval = notification->GetNotificationInterval();
|
||||||
|
|
||||||
|
if (notification->GetNotificationPeriod())
|
||||||
|
notification_period = notification->GetNotificationPeriod()->GetName();
|
||||||
|
|
||||||
|
if (notification->GetNotificationTypeFilter())
|
||||||
|
notification_type_filter = notification->GetNotificationTypeFilter();
|
||||||
|
|
||||||
|
if (notification->GetNotificationStateFilter())
|
||||||
|
notification_state_filter = notification->GetNotificationStateFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (notification_interval == -1)
|
if (notification_interval == -1)
|
||||||
|
@ -197,20 +214,66 @@ Dictionary::Ptr CompatUtility::GetServiceConfigAttributes(const Service::Ptr& se
|
||||||
|
|
||||||
Dictionary::Ptr custom;
|
Dictionary::Ptr custom;
|
||||||
Dictionary::Ptr macros;
|
Dictionary::Ptr macros;
|
||||||
if (type == CompatTypeHost) {
|
std::vector<String> notification_options;
|
||||||
custom = host->GetCustom();
|
|
||||||
macros = host->GetMacros();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
custom = service->GetCustom();
|
|
||||||
macros = service->GetMacros();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (type == CompatTypeHost) {
|
if (type == CompatTypeHost) {
|
||||||
|
|
||||||
|
/* dicts */
|
||||||
|
custom = host->GetCustom();
|
||||||
|
macros = host->GetMacros();
|
||||||
|
|
||||||
|
/* alias */
|
||||||
if (!host->GetDisplayName().IsEmpty())
|
if (!host->GetDisplayName().IsEmpty())
|
||||||
attr->Set("alias", host->GetName());
|
attr->Set("alias", host->GetName());
|
||||||
else
|
else
|
||||||
attr->Set("alias", host->GetDisplayName());
|
attr->Set("alias", host->GetDisplayName());
|
||||||
|
|
||||||
|
/* notification filters */
|
||||||
|
if (notification_state_filter & (1<<StateWarning) ||
|
||||||
|
notification_state_filter & (1<<StateCritical)) {
|
||||||
|
attr->Set("notify_on_down", 1);
|
||||||
|
notification_options.push_back("d");
|
||||||
|
}
|
||||||
|
if (notification_state_filter & (1<<StateUncheckable)) {
|
||||||
|
attr->Set("notify_on_unreachable", 1);
|
||||||
|
notification_options.push_back("u");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
/* dicts */
|
||||||
|
custom = service->GetCustom();
|
||||||
|
macros = service->GetMacros();
|
||||||
|
|
||||||
|
/* notification filters */
|
||||||
|
if (notification_state_filter & (1<<StateWarning)) {
|
||||||
|
attr->Set("notify_on_warning", 1);
|
||||||
|
notification_options.push_back("w");
|
||||||
|
}
|
||||||
|
if (notification_state_filter & (1<<StateUnknown)) {
|
||||||
|
attr->Set("notify_on_unknown", 1);
|
||||||
|
notification_options.push_back("u");
|
||||||
|
}
|
||||||
|
if (notification_state_filter & (1<<StateCritical)) {
|
||||||
|
attr->Set("notify_on_critical", 1);
|
||||||
|
notification_options.push_back("c");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* notification type filters */
|
||||||
|
if (notification_type_filter & (1<<NotificationRecovery)) {
|
||||||
|
attr->Set("notify_on_recovery", 1);
|
||||||
|
notification_options.push_back("r");
|
||||||
|
}
|
||||||
|
if (notification_type_filter & (1<<NotificationFlappingStart) ||
|
||||||
|
notification_type_filter & (1<<NotificationFlappingEnd)) {
|
||||||
|
attr->Set("notify_on_flapping", 1);
|
||||||
|
notification_options.push_back("f");
|
||||||
|
}
|
||||||
|
if (notification_type_filter & (1<<NotificationDowntimeStart) ||
|
||||||
|
notification_type_filter & (1<<NotificationDowntimeEnd) ||
|
||||||
|
notification_type_filter & (1<<NotificationDowntimeRemoved)) {
|
||||||
|
attr->Set("notify_on_downtime", 1);
|
||||||
|
notification_options.push_back("s");
|
||||||
}
|
}
|
||||||
|
|
||||||
attr->Set("check_period", check_period_str);
|
attr->Set("check_period", check_period_str);
|
||||||
|
@ -226,9 +289,10 @@ Dictionary::Ptr CompatUtility::GetServiceConfigAttributes(const Service::Ptr& se
|
||||||
attr->Set("eventhandler_enabled", 1); /* always 1 */
|
attr->Set("eventhandler_enabled", 1); /* always 1 */
|
||||||
attr->Set("is_volatile", (service->IsVolatile() ? 1 : 0));
|
attr->Set("is_volatile", (service->IsVolatile() ? 1 : 0));
|
||||||
attr->Set("notifications_enabled", (service->GetEnableNotifications() ? 1 : 0));
|
attr->Set("notifications_enabled", (service->GetEnableNotifications() ? 1 : 0));
|
||||||
attr->Set("notification_options", "u,w,c,r");
|
attr->Set("notification_options", boost::algorithm::join(notification_options, ","));
|
||||||
attr->Set("notification_interval", notification_interval / 60.0);
|
attr->Set("notification_interval", notification_interval / 60.0);
|
||||||
attr->Set("process_performance_data", 1); /* always 1 */
|
attr->Set("process_performance_data", 1); /* always 1 */
|
||||||
|
attr->Set("notification_period", notification_period);
|
||||||
attr->Set("check_freshness", 1); /* always 1 */
|
attr->Set("check_freshness", 1); /* always 1 */
|
||||||
attr->Set("check_command", check_command_str);
|
attr->Set("check_command", check_command_str);
|
||||||
attr->Set("event_handler", event_command_str);
|
attr->Set("event_handler", event_command_str);
|
||||||
|
|
|
@ -22,7 +22,9 @@
|
||||||
#include "ido/dbvalue.h"
|
#include "ido/dbvalue.h"
|
||||||
#include "icinga/host.h"
|
#include "icinga/host.h"
|
||||||
#include "icinga/service.h"
|
#include "icinga/service.h"
|
||||||
|
#include "icinga/notification.h"
|
||||||
#include "icinga/checkcommand.h"
|
#include "icinga/checkcommand.h"
|
||||||
|
#include "icinga/eventcommand.h"
|
||||||
#include "icinga/compatutility.h"
|
#include "icinga/compatutility.h"
|
||||||
#include "base/objectlock.h"
|
#include "base/objectlock.h"
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
|
@ -55,19 +57,21 @@ Dictionary::Ptr HostDbObject::GetConfigFields(void) const
|
||||||
fields->Set("alias", attrs->Get("alias"));
|
fields->Set("alias", attrs->Get("alias"));
|
||||||
fields->Set("display_name", attrs->Get("display_name"));
|
fields->Set("display_name", attrs->Get("display_name"));
|
||||||
|
|
||||||
|
fields->Set("address", attrs->Get("address"));
|
||||||
|
fields->Set("address6", attrs->Get("address6"));
|
||||||
|
|
||||||
fields->Set("check_command_object_id", service->GetCheckCommand());
|
fields->Set("check_command_object_id", service->GetCheckCommand());
|
||||||
fields->Set("check_command_args", Empty);
|
fields->Set("check_command_args", Empty);
|
||||||
|
fields->Set("eventhandler_command_object_id", service->GetEventCommand());
|
||||||
|
fields->Set("eventhandler_command_args", Empty);
|
||||||
|
fields->Set("notification_timeperiod_object_id", Notification::GetByName(attrs->Get("notification_period")));
|
||||||
|
fields->Set("check_timeperiod_object_id", service->GetCheckPeriod());
|
||||||
|
fields->Set("failure_prediction_options", Empty);
|
||||||
|
|
||||||
fields->Set("check_interval", attrs->Get("check_interval"));
|
fields->Set("check_interval", attrs->Get("check_interval"));
|
||||||
fields->Set("retry_interval", attrs->Get("retry_interval"));
|
fields->Set("retry_interval", attrs->Get("retry_interval"));
|
||||||
fields->Set("max_check_attempts", attrs->Get("max_check_attempts"));
|
fields->Set("max_check_attempts", attrs->Get("max_check_attempts"));
|
||||||
|
|
||||||
fields->Set("address", attrs->Get("address"));
|
|
||||||
fields->Set("address6", attrs->Get("address6"));
|
|
||||||
fields->Set("eventhandler_command_object_id", Empty);
|
|
||||||
fields->Set("eventhandler_command_args", Empty);
|
|
||||||
fields->Set("notification_timeperiod_object_id", Empty);
|
|
||||||
fields->Set("check_timeperiod_object_id", Empty);
|
|
||||||
fields->Set("failure_prediction_options", Empty);
|
|
||||||
fields->Set("first_notification_delay", Empty);
|
fields->Set("first_notification_delay", Empty);
|
||||||
fields->Set("notification_interval", attrs->Get("notification_interval"));
|
fields->Set("notification_interval", attrs->Get("notification_interval"));
|
||||||
fields->Set("notify_on_down", Empty);
|
fields->Set("notify_on_down", Empty);
|
||||||
|
@ -75,40 +79,40 @@ Dictionary::Ptr HostDbObject::GetConfigFields(void) const
|
||||||
fields->Set("notify_on_recovery", Empty);
|
fields->Set("notify_on_recovery", Empty);
|
||||||
fields->Set("notify_on_flapping", Empty);
|
fields->Set("notify_on_flapping", Empty);
|
||||||
fields->Set("notify_on_downtime", Empty);
|
fields->Set("notify_on_downtime", Empty);
|
||||||
|
|
||||||
fields->Set("stalk_on_up", Empty);
|
fields->Set("stalk_on_up", Empty);
|
||||||
fields->Set("stalk_on_down", Empty);
|
fields->Set("stalk_on_down", Empty);
|
||||||
fields->Set("stalk_on_unreachable", Empty);
|
fields->Set("stalk_on_unreachable", Empty);
|
||||||
|
|
||||||
fields->Set("flap_detection_enabled", attrs->Get("flap_detection_enabled"));
|
fields->Set("flap_detection_enabled", attrs->Get("flap_detection_enabled"));
|
||||||
fields->Set("flap_detection_on_up", Empty);
|
fields->Set("flap_detection_on_up", Empty);
|
||||||
fields->Set("flap_detection_on_down", Empty);
|
fields->Set("flap_detection_on_down", Empty);
|
||||||
fields->Set("flap_detection_on_unreachable", Empty);
|
fields->Set("flap_detection_on_unreachable", Empty);
|
||||||
fields->Set("low_flap_threshold", attrs->Get("low_flap_threshold"));
|
fields->Set("low_flap_threshold", attrs->Get("low_flap_threshold"));
|
||||||
fields->Set("high_flap_threshold", attrs->Get("high_flap_threshold"));
|
fields->Set("high_flap_threshold", attrs->Get("high_flap_threshold"));
|
||||||
fields->Set("process_performance_data", 1);
|
fields->Set("process_performance_data", attrs->Get("process_performance_data"));
|
||||||
fields->Set("freshness_checks_enabled", 1);
|
fields->Set("freshness_checks_enabled", attrs->Get("check_freshness"));
|
||||||
fields->Set("freshness_threshold", Empty);
|
fields->Set("freshness_threshold", Empty);
|
||||||
fields->Set("passive_checks_enabled", attrs->Get("passive_checks_enabled"));
|
fields->Set("passive_checks_enabled", attrs->Get("passive_checks_enabled"));
|
||||||
fields->Set("event_handler_enabled", 1);
|
fields->Set("event_handler_enabled", attrs->Get("event_handler_enabled"));
|
||||||
fields->Set("active_checks_enabled", attrs->Get("active_checks_enabled"));
|
fields->Set("active_checks_enabled", attrs->Get("active_checks_enabled"));
|
||||||
fields->Set("retain_status_information", 1);
|
fields->Set("retain_status_information", 1);
|
||||||
fields->Set("retain_nonstatus_information", 1);
|
fields->Set("retain_nonstatus_information", 1);
|
||||||
fields->Set("notifications_enabled", 1);
|
fields->Set("notifications_enabled", attrs->Get("notifications_enabled"));
|
||||||
fields->Set("obsess_over_host", 0);
|
fields->Set("obsess_over_host", 0);
|
||||||
fields->Set("failure_prediction_enabled", 0);
|
fields->Set("failure_prediction_enabled", 0);
|
||||||
|
|
||||||
fields->Set("notes", attrs->Get("notes"));
|
fields->Set("notes", attrs->Get("notes"));
|
||||||
fields->Set("notes_url", attrs->Get("notes_url"));
|
fields->Set("notes_url", attrs->Get("notes_url"));
|
||||||
fields->Set("action_url", attrs->Get("action_url"));
|
fields->Set("action_url", attrs->Get("action_url"));
|
||||||
fields->Set("icon_image", attrs->Get("icon_image"));
|
fields->Set("icon_image", attrs->Get("icon_image"));
|
||||||
fields->Set("icon_image_alt", attrs->Get("icon_image_alt"));
|
fields->Set("icon_image_alt", attrs->Get("icon_image_alt"));
|
||||||
fields->Set("vrml_image", attrs->Get("vrml_image"));
|
|
||||||
fields->Set("statusmap_image", attrs->Get("statusmap_image"));
|
fields->Set("statusmap_image", attrs->Get("statusmap_image"));
|
||||||
fields->Set("have_2d_coords", attrs->Get("have_2d_coords"));
|
fields->Set("have_2d_coords", attrs->Get("have_2d_coords"));
|
||||||
fields->Set("x_2d", attrs->Get("x_2d"));
|
fields->Set("x_2d", attrs->Get("x_2d"));
|
||||||
fields->Set("y_2d", attrs->Get("y_2d"));
|
fields->Set("y_2d", attrs->Get("y_2d"));
|
||||||
fields->Set("have_3d_coords", attrs->Get("have_3d_coords"));
|
/* deprecated in 1.x */
|
||||||
fields->Set("x_3d", attrs->Get("y_3d"));
|
fields->Set("have_3d_coords", 0);
|
||||||
fields->Set("y_3d", attrs->Get("y_3d"));
|
|
||||||
fields->Set("z_3d", attrs->Get("z_3d"));
|
|
||||||
|
|
||||||
return fields;
|
return fields;
|
||||||
}
|
}
|
||||||
|
@ -126,45 +130,51 @@ Dictionary::Ptr HostDbObject::GetStatusFields(void) const
|
||||||
|
|
||||||
{
|
{
|
||||||
ObjectLock olock(service);
|
ObjectLock olock(service);
|
||||||
attrs = CompatUtility::GetServiceStatusAttributes(service, CompatTypeService);
|
attrs = CompatUtility::GetServiceStatusAttributes(service, CompatTypeHost);
|
||||||
}
|
}
|
||||||
|
|
||||||
//fields->Set("check_period", attrs->Get("check_period"));
|
|
||||||
fields->Set("normal_check_interval", attrs->Get("check_interval"));
|
|
||||||
fields->Set("retry_check_interval", attrs->Get("retry_interval"));
|
|
||||||
fields->Set("has_been_checked", attrs->Get("has_been_checked"));
|
|
||||||
fields->Set("should_be_scheduled", attrs->Get("should_be_scheduled"));
|
|
||||||
//fields->Set("execution_time", attrs->Get("check_execution_time"));
|
|
||||||
//fields->Set("latency", attrs->Get("check_latency"));
|
|
||||||
fields->Set("current_state", attrs->Get("current_state"));
|
|
||||||
fields->Set("state_type", attrs->Get("state_type"));
|
|
||||||
fields->Set("output", attrs->Get("plugin_output"));
|
fields->Set("output", attrs->Get("plugin_output"));
|
||||||
fields->Set("long_output", attrs->Get("long_plugin_output"));
|
fields->Set("long_output", attrs->Get("long_plugin_output"));
|
||||||
fields->Set("perfdata", attrs->Get("performance_data"));
|
fields->Set("perfdata", attrs->Get("performance_data"));
|
||||||
fields->Set("last_check", DbValue::FromTimestamp(attrs->Get("last_check")));
|
fields->Set("current_state", attrs->Get("current_state"));
|
||||||
fields->Set("next_check", DbValue::FromTimestamp(attrs->Get("next_check")));
|
fields->Set("has_been_checked", attrs->Get("has_been_checked"));
|
||||||
|
fields->Set("should_be_scheduled", attrs->Get("should_be_scheduled"));
|
||||||
fields->Set("current_check_attempt", attrs->Get("current_attempt"));
|
fields->Set("current_check_attempt", attrs->Get("current_attempt"));
|
||||||
fields->Set("max_check_attempts", attrs->Get("max_attempts"));
|
fields->Set("max_check_attempts", attrs->Get("max_attempts"));
|
||||||
|
fields->Set("last_check", DbValue::FromTimestamp(attrs->Get("last_check")));
|
||||||
|
fields->Set("next_check", DbValue::FromTimestamp(attrs->Get("next_check")));
|
||||||
|
fields->Set("check_type", Empty);
|
||||||
fields->Set("last_state_change", DbValue::FromTimestamp(attrs->Get("last_state_change")));
|
fields->Set("last_state_change", DbValue::FromTimestamp(attrs->Get("last_state_change")));
|
||||||
fields->Set("last_hard_state_change", DbValue::FromTimestamp(attrs->Get("last_hard_state_change")));
|
fields->Set("last_hard_state_change", DbValue::FromTimestamp(attrs->Get("last_hard_state_change")));
|
||||||
fields->Set("last_time_up", DbValue::FromTimestamp(attrs->Get("last_time_up")));
|
fields->Set("last_time_up", DbValue::FromTimestamp(attrs->Get("last_time_up")));
|
||||||
fields->Set("last_time_down", DbValue::FromTimestamp(attrs->Get("last_time_down")));
|
fields->Set("last_time_down", DbValue::FromTimestamp(attrs->Get("last_time_down")));
|
||||||
fields->Set("last_time_unreachable", DbValue::FromTimestamp(attrs->Get("last_time_unreachable")));
|
fields->Set("last_time_unreachable", DbValue::FromTimestamp(attrs->Get("last_time_unreachable")));
|
||||||
//fields->Set("last_update", attrs->Get("last_update"));
|
fields->Set("state_type", attrs->Get("state_type"));
|
||||||
|
fields->Set("last_notification", DbValue::FromTimestamp(attrs->Get("last_notification")));
|
||||||
|
fields->Set("next_notification", DbValue::FromTimestamp(attrs->Get("next_notification")));
|
||||||
|
fields->Set("no_more_notifications", Empty);
|
||||||
fields->Set("notifications_enabled", attrs->Get("notifications_enabled"));
|
fields->Set("notifications_enabled", attrs->Get("notifications_enabled"));
|
||||||
fields->Set("active_checks_enabled", attrs->Get("active_checks_enabled"));
|
fields->Set("problem_has_been_acknowledged", attrs->Get("problem_has_been_acknowledged"));
|
||||||
|
fields->Set("acknowledgement_type", attrs->Get("acknowledgement_type"));
|
||||||
|
fields->Set("current_notification_number", attrs->Get("current_notification_number"));
|
||||||
fields->Set("passive_checks_enabled", attrs->Get("passive_checks_enabled"));
|
fields->Set("passive_checks_enabled", attrs->Get("passive_checks_enabled"));
|
||||||
|
fields->Set("active_checks_enabled", attrs->Get("active_checks_enabled"));
|
||||||
|
fields->Set("eventhandler_enabled", attrs->Get("eventhandler_enabled"));
|
||||||
fields->Set("flap_detection_enabled", attrs->Get("flap_detection_enabled"));
|
fields->Set("flap_detection_enabled", attrs->Get("flap_detection_enabled"));
|
||||||
fields->Set("is_flapping", attrs->Get("is_flapping"));
|
fields->Set("is_flapping", attrs->Get("is_flapping"));
|
||||||
fields->Set("percent_state_change", attrs->Get("percent_state_change"));
|
fields->Set("percent_state_change", attrs->Get("percent_state_change"));
|
||||||
fields->Set("problem_has_been_acknowledged", attrs->Get("problem_has_been_acknowledged"));
|
fields->Set("latency", attrs->Get("check_latency"));
|
||||||
fields->Set("acknowledgement_type", attrs->Get("acknowledgement_type"));
|
fields->Set("execution_time", attrs->Get("check_execution_time"));
|
||||||
//fields->Set("acknowledgement_end_time", attrs->Get("acknowledgement_end_time"));
|
|
||||||
fields->Set("scheduled_downtime_depth", attrs->Get("scheduled_downtime_depth"));
|
fields->Set("scheduled_downtime_depth", attrs->Get("scheduled_downtime_depth"));
|
||||||
fields->Set("last_notification", DbValue::FromTimestamp(attrs->Get("last_notification")));
|
fields->Set("failure_prediction_enabled", Empty);
|
||||||
fields->Set("next_notification", DbValue::FromTimestamp(attrs->Get("next_notification")));
|
fields->Set("process_performance_data", attrs->Get("process_performance_data"));
|
||||||
fields->Set("current_notification_number", attrs->Get("current_notification_number"));
|
fields->Set("obsess_over_host", Empty);
|
||||||
|
fields->Set("modified_host_attributes", Empty);
|
||||||
|
fields->Set("event_handler", attrs->Get("event_handler"));
|
||||||
|
fields->Set("check_command", attrs->Get("check_command"));
|
||||||
|
fields->Set("normal_check_interval", attrs->Get("check_interval"));
|
||||||
|
fields->Set("retry_check_interval", attrs->Get("retry_interval"));
|
||||||
|
fields->Set("check_timeperiod_object_id", service->GetCheckPeriod());
|
||||||
|
|
||||||
return fields;
|
return fields;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,9 @@
|
||||||
#include "ido/dbvalue.h"
|
#include "ido/dbvalue.h"
|
||||||
#include "base/objectlock.h"
|
#include "base/objectlock.h"
|
||||||
#include "icinga/service.h"
|
#include "icinga/service.h"
|
||||||
|
#include "icinga/notification.h"
|
||||||
#include "icinga/checkcommand.h"
|
#include "icinga/checkcommand.h"
|
||||||
|
#include "icinga/eventcommand.h"
|
||||||
#include "icinga/compatutility.h"
|
#include "icinga/compatutility.h"
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
@ -54,10 +56,10 @@ Dictionary::Ptr ServiceDbObject::GetConfigFields(void) const
|
||||||
fields->Set("display_name", service->GetDisplayName());
|
fields->Set("display_name", service->GetDisplayName());
|
||||||
fields->Set("check_command_object_id", service->GetCheckCommand());
|
fields->Set("check_command_object_id", service->GetCheckCommand());
|
||||||
fields->Set("check_command_args", Empty);
|
fields->Set("check_command_args", Empty);
|
||||||
fields->Set("eventhandler_command_object_id", Empty);
|
fields->Set("eventhandler_command_object_id", service->GetEventCommand());
|
||||||
fields->Set("eventhandler_command_args", Empty);
|
fields->Set("eventhandler_command_args", Empty);
|
||||||
fields->Set("notification_timeperiod_object_id", Empty);
|
fields->Set("notification_timeperiod_object_id", Notification::GetByName(attrs->Get("notification_period")));
|
||||||
fields->Set("check_timeperiod_object_id", Empty);
|
fields->Set("check_timeperiod_object_id", service->GetCheckPeriod());
|
||||||
fields->Set("failure_prediction_options", Empty);
|
fields->Set("failure_prediction_options", Empty);
|
||||||
fields->Set("check_interval", attrs->Get("check_interval"));
|
fields->Set("check_interval", attrs->Get("check_interval"));
|
||||||
fields->Set("retry_interval", attrs->Get("retry_interval"));
|
fields->Set("retry_interval", attrs->Get("retry_interval"));
|
||||||
|
@ -113,43 +115,46 @@ Dictionary::Ptr ServiceDbObject::GetStatusFields(void) const
|
||||||
attrs = CompatUtility::GetServiceStatusAttributes(service, CompatTypeService);
|
attrs = CompatUtility::GetServiceStatusAttributes(service, CompatTypeService);
|
||||||
}
|
}
|
||||||
|
|
||||||
//fields->Set("check_period", attrs->Get("check_period"));
|
|
||||||
fields->Set("normal_check_interval", attrs->Get("check_interval"));
|
|
||||||
fields->Set("retry_check_interval", attrs->Get("retry_interval"));
|
|
||||||
fields->Set("has_been_checked", attrs->Get("has_been_checked"));
|
|
||||||
fields->Set("should_be_scheduled", attrs->Get("should_be_scheduled"));
|
|
||||||
//fields->Set("execution_time", attrs->Get("check_execution_time"));
|
|
||||||
//fields->Set("latency", attrs->Get("check_latency"));
|
|
||||||
fields->Set("current_state", attrs->Get("current_state"));
|
|
||||||
fields->Set("state_type", attrs->Get("state_type"));
|
|
||||||
fields->Set("output", attrs->Get("plugin_output"));
|
fields->Set("output", attrs->Get("plugin_output"));
|
||||||
fields->Set("long_output", attrs->Get("long_plugin_output"));
|
fields->Set("long_output", attrs->Get("long_plugin_output"));
|
||||||
fields->Set("perfdata", attrs->Get("performance_data"));
|
fields->Set("perfdata", attrs->Get("performance_data"));
|
||||||
fields->Set("last_check", DbValue::FromTimestamp(attrs->Get("last_check")));
|
fields->Set("current_state", attrs->Get("current_state"));
|
||||||
fields->Set("next_check", DbValue::FromTimestamp(attrs->Get("next_check")));
|
fields->Set("has_been_checked", attrs->Get("has_been_checked"));
|
||||||
|
fields->Set("should_be_scheduled", attrs->Get("should_be_scheduled"));
|
||||||
fields->Set("current_check_attempt", attrs->Get("current_attempt"));
|
fields->Set("current_check_attempt", attrs->Get("current_attempt"));
|
||||||
fields->Set("max_check_attempts", attrs->Get("max_attempts"));
|
fields->Set("max_check_attempts", attrs->Get("max_attempts"));
|
||||||
|
fields->Set("last_check", DbValue::FromTimestamp(attrs->Get("last_check")));
|
||||||
|
fields->Set("next_check", DbValue::FromTimestamp(attrs->Get("next_check")));
|
||||||
|
fields->Set("check_type", Empty);
|
||||||
fields->Set("last_state_change", DbValue::FromTimestamp(attrs->Get("last_state_change")));
|
fields->Set("last_state_change", DbValue::FromTimestamp(attrs->Get("last_state_change")));
|
||||||
fields->Set("last_hard_state_change", DbValue::FromTimestamp(attrs->Get("last_hard_state_change")));
|
fields->Set("last_hard_state_change", DbValue::FromTimestamp(attrs->Get("last_hard_state_change")));
|
||||||
fields->Set("last_time_ok", DbValue::FromTimestamp(attrs->Get("last_time_ok")));
|
fields->Set("last_time_ok", DbValue::FromTimestamp(attrs->Get("last_time_ok")));
|
||||||
fields->Set("last_time_warning", DbValue::FromTimestamp(attrs->Get("last_time_warn")));
|
fields->Set("last_time_warning", DbValue::FromTimestamp(attrs->Get("last_time_warn")));
|
||||||
fields->Set("last_time_critical", DbValue::FromTimestamp(attrs->Get("last_time_critical")));
|
fields->Set("last_time_critical", DbValue::FromTimestamp(attrs->Get("last_time_critical")));
|
||||||
fields->Set("last_time_unknown", DbValue::FromTimestamp(attrs->Get("last_time_unknown")));
|
fields->Set("last_time_unknown", DbValue::FromTimestamp(attrs->Get("last_time_unknown")));
|
||||||
//fields->Set("last_update", attrs->Get("last_update"));
|
fields->Set("state_type", attrs->Get("state_type"));
|
||||||
|
fields->Set("last_notification", DbValue::FromTimestamp(attrs->Get("last_notification")));
|
||||||
|
fields->Set("next_notification", DbValue::FromTimestamp(attrs->Get("next_notification")));
|
||||||
|
fields->Set("no_more_notifications", Empty);
|
||||||
fields->Set("notifications_enabled", attrs->Get("notifications_enabled"));
|
fields->Set("notifications_enabled", attrs->Get("notifications_enabled"));
|
||||||
fields->Set("active_checks_enabled", attrs->Get("active_checks_enabled"));
|
fields->Set("problem_has_been_acknowledged", attrs->Get("problem_has_been_acknowledged"));
|
||||||
|
fields->Set("acknowledgement_type", attrs->Get("acknowledgement_type"));
|
||||||
|
fields->Set("current_notification_number", attrs->Get("current_notification_number"));
|
||||||
fields->Set("passive_checks_enabled", attrs->Get("passive_checks_enabled"));
|
fields->Set("passive_checks_enabled", attrs->Get("passive_checks_enabled"));
|
||||||
|
fields->Set("active_checks_enabled", attrs->Get("active_checks_enabled"));
|
||||||
|
fields->Set("event_handler_enabled", attrs->Get("event_handler_enabled"));
|
||||||
fields->Set("flap_detection_enabled", attrs->Get("flap_detection_enabled"));
|
fields->Set("flap_detection_enabled", attrs->Get("flap_detection_enabled"));
|
||||||
fields->Set("is_flapping", attrs->Get("is_flapping"));
|
fields->Set("is_flapping", attrs->Get("is_flapping"));
|
||||||
fields->Set("percent_state_change", attrs->Get("percent_state_change"));
|
fields->Set("percent_state_change", attrs->Get("percent_state_change"));
|
||||||
fields->Set("problem_has_been_acknowledged", attrs->Get("problem_has_been_acknowledged"));
|
fields->Set("latency", attrs->Get("check_latency"));
|
||||||
fields->Set("acknowledgement_type", attrs->Get("acknowledgement_type"));
|
fields->Set("execution_time", attrs->Get("check_execution_time"));
|
||||||
//fields->Set("acknowledgement_end_time", attrs->Get("acknowledgement_end_time"));
|
|
||||||
fields->Set("scheduled_downtime_depth", attrs->Get("scheduled_downtime_depth"));
|
fields->Set("scheduled_downtime_depth", attrs->Get("scheduled_downtime_depth"));
|
||||||
fields->Set("last_notification", DbValue::FromTimestamp(attrs->Get("last_notification")));
|
fields->Set("process_performance_data", attrs->Get("process_performance_data"));
|
||||||
fields->Set("next_notification", DbValue::FromTimestamp(attrs->Get("next_notification")));
|
fields->Set("event_handler", attrs->Get("event_handler"));
|
||||||
fields->Set("current_notification_number", attrs->Get("current_notification_number"));
|
fields->Set("check_command", attrs->Get("check_command"));
|
||||||
|
fields->Set("normal_check_interval", attrs->Get("check_interval"));
|
||||||
|
fields->Set("retry_check_interval", attrs->Get("retry_interval"));
|
||||||
|
fields->Set("check_timeperiod_object_id", service->GetCheckPeriod());
|
||||||
|
|
||||||
return fields;
|
return fields;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue