mirror of https://github.com/Icinga/icinga2.git
Move CompatUtility::GetCheckableCheckType() into IDO/Livestatus features
It is just boolean mapping to numbers, each modules does that in a sort of different way. DB IDO automatically transforms boolean to numbers. Livestatus would return JSON which keeps true booleans, but requires a number (just a guess, there is no spec for this message format).
This commit is contained in:
parent
70af1a3545
commit
92c565d744
|
@ -1395,7 +1395,7 @@ void DbEvents::AddCheckableCheckHistory(const Checkable::Ptr& checkable, const C
|
||||||
query1.Category = DbCatCheck;
|
query1.Category = DbCatCheck;
|
||||||
|
|
||||||
Dictionary::Ptr fields1 = new Dictionary();
|
Dictionary::Ptr fields1 = new Dictionary();
|
||||||
fields1->Set("check_type", CompatUtility::GetCheckableCheckType(checkable));
|
fields1->Set("check_type", !checkable->GetEnableActiveChecks()); /* 0 .. active, 1 .. passive */
|
||||||
fields1->Set("current_check_attempt", checkable->GetCheckAttempt());
|
fields1->Set("current_check_attempt", checkable->GetCheckAttempt());
|
||||||
fields1->Set("max_check_attempts", checkable->GetMaxCheckAttempts());
|
fields1->Set("max_check_attempts", checkable->GetMaxCheckAttempts());
|
||||||
fields1->Set("state_type", checkable->GetStateType());
|
fields1->Set("state_type", checkable->GetStateType());
|
||||||
|
|
|
@ -141,7 +141,7 @@ Dictionary::Ptr HostDbObject::GetStatusFields() const
|
||||||
fields->Set("last_check", DbValue::FromTimestamp(cr->GetScheduleEnd()));
|
fields->Set("last_check", DbValue::FromTimestamp(cr->GetScheduleEnd()));
|
||||||
|
|
||||||
fields->Set("next_check", DbValue::FromTimestamp(host->GetNextCheck()));
|
fields->Set("next_check", DbValue::FromTimestamp(host->GetNextCheck()));
|
||||||
fields->Set("check_type", CompatUtility::GetCheckableCheckType(host));
|
fields->Set("check_type", !host->GetEnableActiveChecks()); /* 0 .. active, 1 .. passive */
|
||||||
fields->Set("last_state_change", DbValue::FromTimestamp(host->GetLastStateChange()));
|
fields->Set("last_state_change", DbValue::FromTimestamp(host->GetLastStateChange()));
|
||||||
fields->Set("last_hard_state_change", DbValue::FromTimestamp(host->GetLastHardStateChange()));
|
fields->Set("last_hard_state_change", DbValue::FromTimestamp(host->GetLastHardStateChange()));
|
||||||
fields->Set("last_hard_state", host->GetLastHardState());
|
fields->Set("last_hard_state", host->GetLastHardState());
|
||||||
|
|
|
@ -128,7 +128,7 @@ Dictionary::Ptr ServiceDbObject::GetStatusFields() const
|
||||||
fields->Set("last_check", DbValue::FromTimestamp(cr->GetScheduleEnd()));
|
fields->Set("last_check", DbValue::FromTimestamp(cr->GetScheduleEnd()));
|
||||||
|
|
||||||
fields->Set("next_check", DbValue::FromTimestamp(service->GetNextCheck()));
|
fields->Set("next_check", DbValue::FromTimestamp(service->GetNextCheck()));
|
||||||
fields->Set("check_type", CompatUtility::GetCheckableCheckType(service));
|
fields->Set("check_type", !service->GetEnableActiveChecks()); /* 0 .. active, 1 .. passive */
|
||||||
fields->Set("last_state_change", DbValue::FromTimestamp(service->GetLastStateChange()));
|
fields->Set("last_state_change", DbValue::FromTimestamp(service->GetLastStateChange()));
|
||||||
fields->Set("last_hard_state_change", DbValue::FromTimestamp(service->GetLastHardStateChange()));
|
fields->Set("last_hard_state_change", DbValue::FromTimestamp(service->GetLastHardStateChange()));
|
||||||
fields->Set("last_hard_state", service->GetLastHardState());
|
fields->Set("last_hard_state", service->GetLastHardState());
|
||||||
|
|
|
@ -183,11 +183,6 @@ String CompatUtility::GetCheckableCommandArgs(const Checkable::Ptr& checkable)
|
||||||
return Empty;
|
return Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CompatUtility::GetCheckableCheckType(const Checkable::Ptr& checkable)
|
|
||||||
{
|
|
||||||
return (checkable->GetEnableActiveChecks() ? 0 : 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
double CompatUtility::GetCheckableCheckInterval(const Checkable::Ptr& checkable)
|
double CompatUtility::GetCheckableCheckInterval(const Checkable::Ptr& checkable)
|
||||||
{
|
{
|
||||||
return checkable->GetCheckInterval() / 60.0;
|
return checkable->GetCheckInterval() / 60.0;
|
||||||
|
|
|
@ -51,7 +51,6 @@ public:
|
||||||
|
|
||||||
/* service */
|
/* service */
|
||||||
static String GetCheckableCommandArgs(const Checkable::Ptr& checkable);
|
static String GetCheckableCommandArgs(const Checkable::Ptr& checkable);
|
||||||
static int GetCheckableCheckType(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 String GetCheckableCheckPeriod(const Checkable::Ptr& checkable);
|
||||||
|
|
|
@ -522,7 +522,7 @@ Value HostsTable::CheckTypeAccessor(const Value& row)
|
||||||
if (!host)
|
if (!host)
|
||||||
return Empty;
|
return Empty;
|
||||||
|
|
||||||
return CompatUtility::GetCheckableCheckType(host);
|
return (host->GetEnableActiveChecks() ? 0 : 1); /* 0 .. active, 1 .. passive */
|
||||||
}
|
}
|
||||||
|
|
||||||
Value HostsTable::LastStateAccessor(const Value& row)
|
Value HostsTable::LastStateAccessor(const Value& row)
|
||||||
|
|
|
@ -549,7 +549,7 @@ Value ServicesTable::CheckTypeAccessor(const Value& row)
|
||||||
if (!service)
|
if (!service)
|
||||||
return Empty;
|
return Empty;
|
||||||
|
|
||||||
return CompatUtility::GetCheckableCheckType(service);
|
return (service->GetEnableActiveChecks() ? 0 : 1); /* 0 .. active, 1 .. passive */
|
||||||
}
|
}
|
||||||
|
|
||||||
Value ServicesTable::AcknowledgedAccessor(const Value& row)
|
Value ServicesTable::AcknowledgedAccessor(const Value& row)
|
||||||
|
|
Loading…
Reference in New Issue