Drop CompatUtility::GetCheckableCheckPeriod()

This commit is contained in:
Michael Friedrich 2017-12-06 17:49:53 +01:00
parent ce8bfdfa5a
commit e3a899a9ac
5 changed files with 23 additions and 15 deletions

View File

@ -282,7 +282,9 @@ void StatusDataWriter::DumpHostObject(std::ostream& fp, const Host::Ptr& host)
if (eventcommand && host->GetEnableEventHandler()) if (eventcommand && host->GetEnableEventHandler())
fp << "\t" "event_handler" "\t" << CompatUtility::GetCommandName(eventcommand) << "\n"; fp << "\t" "event_handler" "\t" << CompatUtility::GetCommandName(eventcommand) << "\n";
fp << "\t" "check_period" "\t" << CompatUtility::GetCheckableCheckPeriod(host) << "\n"; TimePeriod::Ptr checkPeriod = host->GetCheckPeriod();
if (checkPeriod)
fp << "\t" "check_period" "\t" << checkPeriod->GetName() << "\n";
fp << "\t" "contacts" "\t"; fp << "\t" "contacts" "\t";
DumpNameList(fp, CompatUtility::GetCheckableNotificationUsers(host)); DumpNameList(fp, CompatUtility::GetCheckableNotificationUsers(host));
@ -336,13 +338,16 @@ void StatusDataWriter::DumpCheckableStatusAttrs(std::ostream& fp, const Checkabl
fp << "\t" << "check_command=" << CompatUtility::GetCommandName(checkcommand) << "!" << CompatUtility::GetCheckableCommandArgs(checkable) << "\n" fp << "\t" << "check_command=" << CompatUtility::GetCommandName(checkcommand) << "!" << CompatUtility::GetCheckableCommandArgs(checkable) << "\n"
"\t" "event_handler=" << CompatUtility::GetCommandName(eventcommand) << "\n" "\t" "event_handler=" << CompatUtility::GetCommandName(eventcommand) << "\n"
"\t" "check_period=" << CompatUtility::GetCheckableCheckPeriod(checkable) << "\n"
"\t" "check_interval=" << CompatUtility::GetCheckableCheckInterval(checkable) << "\n" "\t" "check_interval=" << CompatUtility::GetCheckableCheckInterval(checkable) << "\n"
"\t" "retry_interval=" << CompatUtility::GetCheckableRetryInterval(checkable) << "\n" "\t" "retry_interval=" << CompatUtility::GetCheckableRetryInterval(checkable) << "\n"
"\t" "has_been_checked=" << Convert::ToLong(checkable->HasBeenChecked()) << "\n" "\t" "has_been_checked=" << Convert::ToLong(checkable->HasBeenChecked()) << "\n"
"\t" "should_be_scheduled=" << checkable->GetEnableActiveChecks() << "\n" "\t" "should_be_scheduled=" << checkable->GetEnableActiveChecks() << "\n"
"\t" "event_handler_enabled=" << Convert::ToLong(checkable->GetEnableEventHandler()) << "\n"; "\t" "event_handler_enabled=" << Convert::ToLong(checkable->GetEnableEventHandler()) << "\n";
TimePeriod::Ptr checkPeriod = checkable->GetCheckPeriod();
if (checkPeriod)
fp << "\t" "check_period" "\t" << checkPeriod->GetName() << "\n";
if (cr) { if (cr) {
fp << "\t" << "check_execution_time=" << Convert::ToString(cr->CalculateExecutionTime()) << "\n" fp << "\t" << "check_execution_time=" << Convert::ToString(cr->CalculateExecutionTime()) << "\n"
"\t" "check_latency=" << Convert::ToString(cr->CalculateLatency()) << "\n"; "\t" "check_latency=" << Convert::ToString(cr->CalculateLatency()) << "\n";
@ -427,7 +432,6 @@ void StatusDataWriter::DumpServiceObject(std::ostream& fp, const Service::Ptr& s
"\t" "host_name" "\t" << host->GetName() << "\n" "\t" "host_name" "\t" << host->GetName() << "\n"
"\t" "service_description" "\t" << service->GetShortName() << "\n" "\t" "service_description" "\t" << service->GetShortName() << "\n"
"\t" "display_name" "\t" << service->GetDisplayName() << "\n" "\t" "display_name" "\t" << service->GetDisplayName() << "\n"
"\t" "check_period" "\t" << CompatUtility::GetCheckableCheckPeriod(service) << "\n"
"\t" "check_interval" "\t" << CompatUtility::GetCheckableCheckInterval(service) << "\n" "\t" "check_interval" "\t" << CompatUtility::GetCheckableCheckInterval(service) << "\n"
"\t" "retry_interval" "\t" << CompatUtility::GetCheckableRetryInterval(service) << "\n" "\t" "retry_interval" "\t" << CompatUtility::GetCheckableRetryInterval(service) << "\n"
"\t" "max_check_attempts" "\t" << service->GetMaxCheckAttempts() << "\n" "\t" "max_check_attempts" "\t" << service->GetMaxCheckAttempts() << "\n"
@ -449,6 +453,10 @@ void StatusDataWriter::DumpServiceObject(std::ostream& fp, const Service::Ptr& s
if (eventcommand && service->GetEnableEventHandler()) if (eventcommand && service->GetEnableEventHandler())
fp << "\t" "event_handler" "\t" << CompatUtility::GetCommandName(eventcommand) << "\n"; fp << "\t" "event_handler" "\t" << CompatUtility::GetCommandName(eventcommand) << "\n";
TimePeriod::Ptr checkPeriod = service->GetCheckPeriod();
if (checkPeriod)
fp << "\t" "check_period" "\t" << checkPeriod->GetName() << "\n";
fp << "\t" "contacts" "\t"; fp << "\t" "contacts" "\t";
DumpNameList(fp, CompatUtility::GetCheckableNotificationUsers(service)); DumpNameList(fp, CompatUtility::GetCheckableNotificationUsers(service));
fp << "\n"; fp << "\n";

View File

@ -193,15 +193,6 @@ double CompatUtility::GetCheckableRetryInterval(const Checkable::Ptr& checkable)
return checkable->GetRetryInterval() / 60.0; return checkable->GetRetryInterval() / 60.0;
} }
String CompatUtility::GetCheckableCheckPeriod(const Checkable::Ptr& checkable)
{
TimePeriod::Ptr check_period = checkable->GetCheckPeriod();
if (check_period)
return check_period->GetName();
else
return "24x7";
}
int CompatUtility::GetCheckableNoMoreNotifications(const Checkable::Ptr& checkable) int CompatUtility::GetCheckableNoMoreNotifications(const Checkable::Ptr& checkable)
{ {
if (CompatUtility::GetCheckableNotificationNotificationInterval(checkable) == 0 && !checkable->GetVolatile()) if (CompatUtility::GetCheckableNotificationNotificationInterval(checkable) == 0 && !checkable->GetVolatile())

View File

@ -53,7 +53,6 @@ public:
static String GetCheckableCommandArgs(const Checkable::Ptr& checkable); static String GetCheckableCommandArgs(const Checkable::Ptr& checkable);
static double GetCheckableCheckInterval(const Checkable::Ptr& checkable); static double GetCheckableCheckInterval(const Checkable::Ptr& checkable);
static double GetCheckableRetryInterval(const Checkable::Ptr& checkable); static double GetCheckableRetryInterval(const Checkable::Ptr& checkable);
static String GetCheckableCheckPeriod(const Checkable::Ptr& checkable);
static int GetCheckableNoMoreNotifications(const Checkable::Ptr& checkable); static int GetCheckableNoMoreNotifications(const Checkable::Ptr& checkable);
static int GetCheckableInNotificationPeriod(const Checkable::Ptr& checkable); static int GetCheckableInNotificationPeriod(const Checkable::Ptr& checkable);

View File

@ -304,7 +304,12 @@ Value HostsTable::CheckPeriodAccessor(const Value& row)
if (!host) if (!host)
return Empty; return Empty;
return CompatUtility::GetCheckableCheckPeriod(host); TimePeriod::Ptr checkPeriod = host->GetCheckPeriod();
if (!checkPeriod)
return Empty;
return checkPeriod->GetName();
} }
Value HostsTable::NotesAccessor(const Value& row) Value HostsTable::NotesAccessor(const Value& row)

View File

@ -356,7 +356,12 @@ Value ServicesTable::CheckPeriodAccessor(const Value& row)
if (!service) if (!service)
return Empty; return Empty;
return CompatUtility::GetCheckableCheckPeriod(service); TimePeriod::Ptr checkPeriod = service->GetCheckPeriod();
if (!checkPeriod)
return Empty;
return checkPeriod->GetName();
} }
Value ServicesTable::NotesAccessor(const Value& row) Value ServicesTable::NotesAccessor(const Value& row)