Rename the service state constants.

Fixes #5964
This commit is contained in:
Gunnar Beutner 2014-04-08 09:11:54 +02:00
parent e560e1e00c
commit 1c115297f9
31 changed files with 117 additions and 117 deletions

View File

@ -53,12 +53,12 @@ void ClusterCheckTask::ScriptFunc(const Checkable::Ptr& service, const CheckResu
String connected_endpoints = FormatArray(status->Get("conn_endpoints"));
String not_connected_endpoints = FormatArray(status->Get("not_conn_endpoints"));
ServiceState state = StateOK;
ServiceState state = ServiceOK;
String output = "Icinga 2 Cluster is running: Connected Endpoints: "+ Convert::ToString(status->Get("num_conn_endpoints")) + " (" +
connected_endpoints + ").";
if (status->Get("num_not_conn_endpoints") > 0) {
state = StateCritical;
state = ServiceCritical;
output = "Icinga 2 Cluster Problem: " + Convert::ToString(status->Get("num_not_conn_endpoints")) +
" Endpoints (" + not_connected_endpoints + ") not connected.";
}

View File

@ -221,7 +221,7 @@ Value HostGroupsTable::NumServicesAccessor(const Value& row)
Value HostGroupsTable::WorstServicesStateAccessor(const Value& row)
{
Value worst_service = StateOK;
Value worst_service = ServiceOK;
BOOST_FOREACH(const Host::Ptr& host, static_cast<HostGroup::Ptr>(row)->GetMembers()) {
BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
@ -253,7 +253,7 @@ Value HostGroupsTable::NumServicesOkAccessor(const Value& row)
BOOST_FOREACH(const Host::Ptr& host, static_cast<HostGroup::Ptr>(row)->GetMembers()) {
BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
if (service->GetState() == StateOK)
if (service->GetState() == ServiceOK)
num_services++;
}
}
@ -267,7 +267,7 @@ Value HostGroupsTable::NumServicesWarnAccessor(const Value& row)
BOOST_FOREACH(const Host::Ptr& host, static_cast<HostGroup::Ptr>(row)->GetMembers()) {
BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
if (service->GetState() == StateWarning)
if (service->GetState() == ServiceWarning)
num_services++;
}
}
@ -281,7 +281,7 @@ Value HostGroupsTable::NumServicesCritAccessor(const Value& row)
BOOST_FOREACH(const Host::Ptr& host, static_cast<HostGroup::Ptr>(row)->GetMembers()) {
BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
if (service->GetState() == StateCritical)
if (service->GetState() == ServiceCritical)
num_services++;
}
}
@ -295,7 +295,7 @@ Value HostGroupsTable::NumServicesUnknownAccessor(const Value& row)
BOOST_FOREACH(const Host::Ptr& host, static_cast<HostGroup::Ptr>(row)->GetMembers()) {
BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
if (service->GetState() == StateUnknown)
if (service->GetState() == ServiceUnknown)
num_services++;
}
}
@ -305,7 +305,7 @@ Value HostGroupsTable::NumServicesUnknownAccessor(const Value& row)
Value HostGroupsTable::WorstServiceHardStateAccessor(const Value& row)
{
Value worst_service = StateOK;
Value worst_service = ServiceOK;
BOOST_FOREACH(const Host::Ptr& host, static_cast<HostGroup::Ptr>(row)->GetMembers()) {
BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
@ -325,7 +325,7 @@ Value HostGroupsTable::NumServicesHardOkAccessor(const Value& row)
BOOST_FOREACH(const Host::Ptr& host, static_cast<HostGroup::Ptr>(row)->GetMembers()) {
BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
if (service->GetStateType() == StateTypeHard && service->GetState() == StateOK)
if (service->GetStateType() == StateTypeHard && service->GetState() == ServiceOK)
num_services++;
}
}
@ -339,7 +339,7 @@ Value HostGroupsTable::NumServicesHardWarnAccessor(const Value& row)
BOOST_FOREACH(const Host::Ptr& host, static_cast<HostGroup::Ptr>(row)->GetMembers()) {
BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
if (service->GetStateType() == StateTypeHard && service->GetState() == StateWarning)
if (service->GetStateType() == StateTypeHard && service->GetState() == ServiceWarning)
num_services++;
}
}
@ -353,7 +353,7 @@ Value HostGroupsTable::NumServicesHardCritAccessor(const Value& row)
BOOST_FOREACH(const Host::Ptr& host, static_cast<HostGroup::Ptr>(row)->GetMembers()) {
BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
if (service->GetStateType() == StateTypeHard && service->GetState() == StateCritical)
if (service->GetStateType() == StateTypeHard && service->GetState() == ServiceCritical)
num_services++;
}
}
@ -367,7 +367,7 @@ Value HostGroupsTable::NumServicesHardUnknownAccessor(const Value& row)
BOOST_FOREACH(const Host::Ptr& host, static_cast<HostGroup::Ptr>(row)->GetMembers()) {
BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
if (service->GetStateType() == StateTypeHard && service->GetState() == StateUnknown)
if (service->GetStateType() == StateTypeHard && service->GetState() == ServiceUnknown)
num_services++;
}
}

View File

@ -1255,7 +1255,7 @@ Value HostsTable::WorstServiceStateAccessor(const Value& row)
if (!host)
return Empty;
Value worst_service = StateOK;
Value worst_service = ServiceOK;
BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
if (service->GetState() > worst_service)
@ -1275,7 +1275,7 @@ Value HostsTable::NumServicesOkAccessor(const Value& row)
int num_services = 0;
BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
if (service->GetState() == StateOK)
if (service->GetState() == ServiceOK)
num_services++;
}
@ -1292,7 +1292,7 @@ Value HostsTable::NumServicesWarnAccessor(const Value& row)
int num_services = 0;
BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
if (service->GetState() == StateWarning)
if (service->GetState() == ServiceWarning)
num_services++;
}
@ -1309,7 +1309,7 @@ Value HostsTable::NumServicesCritAccessor(const Value& row)
int num_services = 0;
BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
if (service->GetState() == StateCritical)
if (service->GetState() == ServiceCritical)
num_services++;
}
@ -1326,7 +1326,7 @@ Value HostsTable::NumServicesUnknownAccessor(const Value& row)
int num_services = 0;
BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
if (service->GetState() == StateUnknown)
if (service->GetState() == ServiceUnknown)
num_services++;
}
@ -1357,7 +1357,7 @@ Value HostsTable::WorstServiceHardStateAccessor(const Value& row)
if (!host)
return Empty;
Value worst_service = StateOK;
Value worst_service = ServiceOK;
BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
if (service->GetStateType() == StateTypeHard) {
@ -1379,7 +1379,7 @@ Value HostsTable::NumServicesHardOkAccessor(const Value& row)
int num_services = 0;
BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
if (service->GetStateType() == StateTypeHard && service->GetState() == StateOK)
if (service->GetStateType() == StateTypeHard && service->GetState() == ServiceOK)
num_services++;
}
@ -1396,7 +1396,7 @@ Value HostsTable::NumServicesHardWarnAccessor(const Value& row)
int num_services = 0;
BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
if (service->GetStateType() == StateTypeHard && service->GetState() == StateWarning)
if (service->GetStateType() == StateTypeHard && service->GetState() == ServiceWarning)
num_services++;
}
@ -1413,7 +1413,7 @@ Value HostsTable::NumServicesHardCritAccessor(const Value& row)
int num_services = 0;
BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
if (service->GetStateType() == StateTypeHard && service->GetState() == StateCritical)
if (service->GetStateType() == StateTypeHard && service->GetState() == ServiceCritical)
num_services++;
}
@ -1430,7 +1430,7 @@ Value HostsTable::NumServicesHardUnknownAccessor(const Value& row)
int num_services = 0;
BOOST_FOREACH(const Service::Ptr& service, host->GetServices()) {
if (service->GetStateType() == StateTypeHard && service->GetState() == StateUnknown)
if (service->GetStateType() == StateTypeHard && service->GetState() == ServiceUnknown)
num_services++;
}

View File

@ -136,7 +136,7 @@ Value ServiceGroupsTable::MembersWithStateAccessor(const Value& row)
Value ServiceGroupsTable::WorstServiceStateAccessor(const Value& row)
{
Value worst_service = StateOK;
Value worst_service = ServiceOK;
BOOST_FOREACH(const Service::Ptr& service, static_cast<ServiceGroup::Ptr>(row)->GetMembers()) {
if (service->GetState() > worst_service)
@ -156,7 +156,7 @@ Value ServiceGroupsTable::NumServicesOkAccessor(const Value& row)
int num_services = 0;
BOOST_FOREACH(const Service::Ptr& service, static_cast<ServiceGroup::Ptr>(row)->GetMembers()) {
if (service->GetState() == StateOK)
if (service->GetState() == ServiceOK)
num_services++;
}
@ -168,7 +168,7 @@ Value ServiceGroupsTable::NumServicesWarnAccessor(const Value& row)
int num_services = 0;
BOOST_FOREACH(const Service::Ptr& service, static_cast<ServiceGroup::Ptr>(row)->GetMembers()) {
if (service->GetState() == StateWarning)
if (service->GetState() == ServiceWarning)
num_services++;
}
@ -180,7 +180,7 @@ Value ServiceGroupsTable::NumServicesCritAccessor(const Value& row)
int num_services = 0;
BOOST_FOREACH(const Service::Ptr& service, static_cast<ServiceGroup::Ptr>(row)->GetMembers()) {
if (service->GetState() == StateCritical)
if (service->GetState() == ServiceCritical)
num_services++;
}
@ -192,7 +192,7 @@ Value ServiceGroupsTable::NumServicesUnknownAccessor(const Value& row)
int num_services = 0;
BOOST_FOREACH(const Service::Ptr& service, static_cast<ServiceGroup::Ptr>(row)->GetMembers()) {
if (service->GetState() == StateUnknown)
if (service->GetState() == ServiceUnknown)
num_services++;
}
@ -216,7 +216,7 @@ Value ServiceGroupsTable::NumServicesHardOkAccessor(const Value& row)
int num_services = 0;
BOOST_FOREACH(const Service::Ptr& service, static_cast<ServiceGroup::Ptr>(row)->GetMembers()) {
if (service->GetStateType() == StateTypeHard && service->GetState() == StateOK)
if (service->GetStateType() == StateTypeHard && service->GetState() == ServiceOK)
num_services++;
}
@ -228,7 +228,7 @@ Value ServiceGroupsTable::NumServicesHardWarnAccessor(const Value& row)
int num_services = 0;
BOOST_FOREACH(const Service::Ptr& service, static_cast<ServiceGroup::Ptr>(row)->GetMembers()) {
if (service->GetStateType() == StateTypeHard && service->GetState() == StateWarning)
if (service->GetStateType() == StateTypeHard && service->GetState() == ServiceWarning)
num_services++;
}
@ -240,7 +240,7 @@ Value ServiceGroupsTable::NumServicesHardCritAccessor(const Value& row)
int num_services = 0;
BOOST_FOREACH(const Service::Ptr& service, static_cast<ServiceGroup::Ptr>(row)->GetMembers()) {
if (service->GetStateType() == StateTypeHard && service->GetState() == StateCritical)
if (service->GetStateType() == StateTypeHard && service->GetState() == ServiceCritical)
num_services++;
}
@ -252,7 +252,7 @@ Value ServiceGroupsTable::NumServicesHardUnknownAccessor(const Value& row)
int num_services = 0;
BOOST_FOREACH(const Service::Ptr& service, static_cast<ServiceGroup::Ptr>(row)->GetMembers()) {
if (service->GetStateType() == StateTypeHard && service->GetState() == StateUnknown)
if (service->GetStateType() == StateTypeHard && service->GetState() == ServiceUnknown)
num_services++;
}

View File

@ -379,7 +379,7 @@ Value StateHistTable::DurationOkAccessor(const Value& row)
{
Dictionary::Ptr state_hist_bag = static_cast<Dictionary::Ptr>(row);
if (state_hist_bag->Get("state") == StateOK)
if (state_hist_bag->Get("state") == ServiceOK)
return (state_hist_bag->Get("until") - state_hist_bag->Get("from"));
return 0;
@ -389,7 +389,7 @@ Value StateHistTable::DurationPartOkAccessor(const Value& row)
{
Dictionary::Ptr state_hist_bag = static_cast<Dictionary::Ptr>(row);
if (state_hist_bag->Get("state") == StateOK)
if (state_hist_bag->Get("state") == ServiceOK)
return (state_hist_bag->Get("until") - state_hist_bag->Get("from")) / state_hist_bag->Get("query_part");
return 0;
@ -399,7 +399,7 @@ Value StateHistTable::DurationWarningAccessor(const Value& row)
{
Dictionary::Ptr state_hist_bag = static_cast<Dictionary::Ptr>(row);
if (state_hist_bag->Get("state") == StateWarning)
if (state_hist_bag->Get("state") == ServiceWarning)
return (state_hist_bag->Get("until") - state_hist_bag->Get("from"));
return 0;
@ -409,7 +409,7 @@ Value StateHistTable::DurationPartWarningAccessor(const Value& row)
{
Dictionary::Ptr state_hist_bag = static_cast<Dictionary::Ptr>(row);
if (state_hist_bag->Get("state") == StateWarning)
if (state_hist_bag->Get("state") == ServiceWarning)
return (state_hist_bag->Get("until") - state_hist_bag->Get("from")) / state_hist_bag->Get("query_part");
return 0;
@ -419,7 +419,7 @@ Value StateHistTable::DurationCriticalAccessor(const Value& row)
{
Dictionary::Ptr state_hist_bag = static_cast<Dictionary::Ptr>(row);
if (state_hist_bag->Get("state") == StateCritical)
if (state_hist_bag->Get("state") == ServiceCritical)
return (state_hist_bag->Get("until") - state_hist_bag->Get("from"));
return 0;
@ -429,7 +429,7 @@ Value StateHistTable::DurationPartCriticalAccessor(const Value& row)
{
Dictionary::Ptr state_hist_bag = static_cast<Dictionary::Ptr>(row);
if (state_hist_bag->Get("state") == StateCritical)
if (state_hist_bag->Get("state") == ServiceCritical)
return (state_hist_bag->Get("until") - state_hist_bag->Get("from")) / state_hist_bag->Get("query_part");
return 0;
@ -439,7 +439,7 @@ Value StateHistTable::DurationUnknownAccessor(const Value& row)
{
Dictionary::Ptr state_hist_bag = static_cast<Dictionary::Ptr>(row);
if (state_hist_bag->Get("state") == StateUnknown)
if (state_hist_bag->Get("state") == ServiceUnknown)
return (state_hist_bag->Get("until") - state_hist_bag->Get("from"));
return 0;
@ -449,7 +449,7 @@ Value StateHistTable::DurationPartUnknownAccessor(const Value& row)
{
Dictionary::Ptr state_hist_bag = static_cast<Dictionary::Ptr>(row);
if (state_hist_bag->Get("state") == StateUnknown)
if (state_hist_bag->Get("state") == ServiceUnknown)
return (state_hist_bag->Get("until") - state_hist_bag->Get("from")) / state_hist_bag->Get("query_part");
return 0;
@ -473,4 +473,4 @@ Value StateHistTable::DurationPartUnmonitoredAccessor(const Value& row)
return (state_hist_bag->Get("until") - state_hist_bag->Get("from")) / state_hist_bag->Get("query_part");
return 0;
}
}

View File

@ -96,7 +96,7 @@ void NotificationComponent::NotificationTimerHandler(void)
Service::Ptr service = dynamic_pointer_cast<Service>(checkable);
if (service) {
if (service->GetState() == StateOK)
if (service->GetState() == ServiceOK)
continue;
} else {
Host::Ptr host = static_pointer_cast<Host>(checkable);

View File

@ -8,4 +8,4 @@ class FileLogger : StreamLogger
[config] String path;
};
}
}

View File

@ -8,4 +8,4 @@ abstract class Logger : DynamicObject
[config] String severity;
};
}
}

View File

@ -7,4 +7,4 @@ class StreamLogger : Logger
{
};
}
}

View File

@ -7,4 +7,4 @@ class SyslogLogger : Logger
{
};
}
}

View File

@ -84,4 +84,4 @@ void CommandDbObject::OnConfigUpdate(void)
OnQuery(query1);
}
}
}
}

View File

@ -633,16 +633,16 @@ void DbEvents::AddCheckResultLogHistory(const Checkable::Ptr& checkable, const C
<< "";
switch (service->GetState()) {
case StateOK:
case ServiceOK:
type = LogEntryTypeServiceOk;
break;
case StateUnknown:
case ServiceUnknown:
type = LogEntryTypeServiceUnknown;
break;
case StateWarning:
case ServiceWarning:
type = LogEntryTypeServiceWarning;
break;
case StateCritical:
case ServiceCritical:
type = LogEntryTypeServiceCritical;
break;
default:

View File

@ -267,8 +267,8 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const String& aut
if (!old_cr) {
SetStateType(StateTypeHard);
} else if (cr->GetState() == StateOK) {
if (old_state == StateOK && old_stateType == StateTypeSoft)
} else if (cr->GetState() == ServiceOK) {
if (old_state == ServiceOK && old_stateType == StateTypeSoft)
SetStateType(StateTypeHard); // SOFT OK -> HARD OK
recovery = true;
@ -277,7 +277,7 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const String& aut
} else {
if (old_attempt >= GetMaxCheckAttempts()) {
SetStateType(StateTypeHard);
} else if (old_stateType == StateTypeSoft || old_state == StateOK) {
} else if (old_stateType == StateTypeSoft || old_state == ServiceOK) {
SetStateType(StateTypeSoft);
attempt = old_attempt + 1;
} else {
@ -287,16 +287,16 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const String& aut
recovery = false;
switch (cr->GetState()) {
case StateOK:
case ServiceOK:
/* Nothing to do here. */
break;
case StateWarning:
case ServiceWarning:
SetLastStateWarning(Utility::GetTime());
break;
case StateCritical:
case ServiceCritical:
SetLastStateCritical(Utility::GetTime());
break;
case StateUnknown:
case ServiceUnknown:
SetLastStateUnknown(Utility::GetTime());
break;
}
@ -316,7 +316,7 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const String& aut
/* remove acknowledgements */
if (GetAcknowledgement() == AcknowledgementNormal ||
(GetAcknowledgement() == AcknowledgementSticky && new_state == StateOK)) {
(GetAcknowledgement() == AcknowledgementSticky && new_state == ServiceOK)) {
ClearAcknowledgement();
}
@ -348,7 +348,7 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const String& aut
SetLastHardStateChange(now);
}
if (new_state != StateOK)
if (new_state != ServiceOK)
TriggerDowntimes();
Checkable::UpdateStatistics(cr);
@ -359,7 +359,7 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const String& aut
if (!old_cr)
send_notification = false; /* Don't send notifications for the initial state change */
if (old_state == StateOK && old_stateType == StateTypeSoft)
if (old_state == ServiceOK && old_stateType == StateTypeSoft)
send_notification = false; /* Don't send notifications for SOFT-OK -> HARD-OK. */
bool send_downtime_notification = (GetLastInDowntime() != in_downtime);

View File

@ -61,16 +61,16 @@ abstract class Checkable : DynamicObject
default {{{ return 1; }}}
};
[state, enum] ServiceState state_raw {
default {{{ return StateUnknown; }}}
default {{{ return ServiceUnknown; }}}
};
[state, enum] StateType state_type {
default {{{ return StateTypeSoft; }}}
};
[state, enum] ServiceState last_state_raw {
default {{{ return StateUnknown; }}}
default {{{ return ServiceUnknown; }}}
};
[state, enum] ServiceState last_hard_state_raw {
default {{{ return StateUnknown; }}}
default {{{ return ServiceUnknown; }}}
};
[state, enum] StateType last_state_type {
default {{{ return StateTypeSoft; }}}

View File

@ -7,4 +7,4 @@ class CheckCommand : Command
{
};
}
}

View File

@ -20,10 +20,10 @@ enum HostState
*/
enum ServiceState
{
StateOK = 0,
StateWarning = 1,
StateCritical = 2,
StateUnknown = 3
ServiceOK = 0,
ServiceWarning = 1,
ServiceCritical = 2,
ServiceUnknown = 3
};
/**

View File

@ -108,13 +108,13 @@ ServiceStatistics CIB::CalculateServiceStats(void)
CheckResult::Ptr cr = service->GetLastCheckResult();
if (service->GetState() == StateOK)
if (service->GetState() == ServiceOK)
ss.services_ok++;
if (service->GetState() == StateWarning)
if (service->GetState() == ServiceWarning)
ss.services_warning++;
if (service->GetState() == StateCritical)
if (service->GetState() == ServiceCritical)
ss.services_critical++;
if (service->GetState() == StateUnknown)
if (service->GetState() == ServiceUnknown)
ss.services_unknown++;
if (!cr)

View File

@ -157,8 +157,8 @@ int CompatUtility::GetHostNotifyOnDown(const Host::Ptr& host)
unsigned long notification_state_filter = GetCheckableNotificationStateFilter(host);
if (notification_state_filter & (1<<StateCritical) ||
notification_state_filter & (1<<StateWarning))
if (notification_state_filter & (1<<ServiceCritical) ||
notification_state_filter & (1<<ServiceWarning))
return 1;
return 0;
@ -170,7 +170,7 @@ int CompatUtility::GetHostNotifyOnUnreachable(const Host::Ptr& host)
unsigned long notification_state_filter = GetCheckableNotificationStateFilter(host);
if (notification_state_filter & (1<<StateUnknown))
if (notification_state_filter & (1<<ServiceUnknown))
return 1;
return 0;
@ -574,13 +574,13 @@ String CompatUtility::GetCheckableNotificationNotificationOptions(const Checkabl
std::vector<String> notification_options;
/* notification state filters */
if (notification_state_filter & (1<<StateWarning)) {
if (notification_state_filter & (1<<ServiceWarning)) {
notification_options.push_back("w");
}
if (notification_state_filter & (1<<StateUnknown)) {
if (notification_state_filter & (1<<ServiceUnknown)) {
notification_options.push_back("u");
}
if (notification_state_filter & (1<<StateCritical)) {
if (notification_state_filter & (1<<ServiceCritical)) {
notification_options.push_back("c");
}
@ -637,7 +637,7 @@ int CompatUtility::GetCheckableNotifyOnWarning(const Checkable::Ptr& checkable)
{
ASSERT(checkable->OwnsLock());
if (GetCheckableNotificationStateFilter(checkable) & (1<<StateWarning))
if (GetCheckableNotificationStateFilter(checkable) & (1<<ServiceWarning))
return 1;
return 0;
@ -647,7 +647,7 @@ int CompatUtility::GetCheckableNotifyOnCritical(const Checkable::Ptr& checkable)
{
ASSERT(checkable->OwnsLock());
if (GetCheckableNotificationStateFilter(checkable) & (1<<StateCritical))
if (GetCheckableNotificationStateFilter(checkable) & (1<<ServiceCritical))
return 1;
return 0;
@ -657,7 +657,7 @@ int CompatUtility::GetCheckableNotifyOnUnknown(const Checkable::Ptr& checkable)
{
ASSERT(checkable->OwnsLock());
if (GetCheckableNotificationStateFilter(checkable) & (1<<StateUnknown))
if (GetCheckableNotificationStateFilter(checkable) & (1<<ServiceUnknown))
return 1;
return 0;

View File

@ -8,4 +8,4 @@ class Domain : DynamicObject
[config] Dictionary::Ptr acl;
};
}
}

View File

@ -7,4 +7,4 @@ class EventCommand : Command
{
};
}
}

View File

@ -237,9 +237,9 @@ void ExternalCommandProcessor::ProcessHostCheckResult(double time, const std::ve
ServiceState state;
if (exitStatus == 0)
state = StateOK;
state = ServiceOK;
else if (exitStatus == 1)
state = StateCritical;
state = ServiceCritical;
else
BOOST_THROW_EXCEPTION(std::invalid_argument("Invalid status code: " + arguments[1]));
@ -596,7 +596,7 @@ void ExternalCommandProcessor::AcknowledgeSvcProblem(double, const std::vector<S
if (!service)
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot acknowledge service problem for non-existent service '" + arguments[1] + "' on host '" + arguments[0] + "'"));
if (service->GetState() == StateOK)
if (service->GetState() == ServiceOK)
BOOST_THROW_EXCEPTION(std::invalid_argument("The service '" + arguments[1] + "' is OK."));
Log(LogInformation, "icinga", "Setting acknowledgement for service '" + service->GetName() + "'");
@ -618,7 +618,7 @@ void ExternalCommandProcessor::AcknowledgeSvcProblemExpire(double, const std::ve
if (!service)
BOOST_THROW_EXCEPTION(std::invalid_argument("Cannot acknowledge service problem with expire time for non-existent service '" + arguments[1] + "' on host '" + arguments[0] + "'"));
if (service->GetState() == StateOK)
if (service->GetState() == ServiceOK)
BOOST_THROW_EXCEPTION(std::invalid_argument("The service '" + arguments[1] + "' is OK."));
Log(LogInformation, "icinga", "Setting timed acknowledgement for service '" + service->GetName() + "'");

View File

@ -137,8 +137,8 @@ Service::Ptr Host::GetServiceByShortName(const Value& name)
HostState Host::CalculateState(ServiceState state)
{
switch (state) {
case StateOK:
case StateWarning:
case ServiceOK:
case ServiceWarning:
return HostUp;
default:
return HostDown;
@ -326,13 +326,13 @@ bool Host::ResolveMacro(const String& macro, const CheckResult::Ptr&, String *re
int count = 0;
if (key == "totalservicesok")
filter = StateOK;
filter = ServiceOK;
else if (key == "totalserviceswarning")
filter = StateWarning;
filter = ServiceWarning;
else if (key == "totalservicesunknown")
filter = StateUnknown;
filter = ServiceUnknown;
else if (key == "totalservicescritical")
filter = StateCritical;
filter = ServiceCritical;
BOOST_FOREACH(const Service::Ptr& service, GetServices()) {
if (filter != -1 && service->GetState() != filter)

View File

@ -12,4 +12,4 @@ class IcingaApplication : Application
[state, protected] Value override_enable_perfdata;
};
}
}

View File

@ -60,8 +60,8 @@ void Notification::StaticInitialize(void)
{
ScriptVariable::Set("OK", StateFilterOK, true, true);
ScriptVariable::Set("Warning", StateFilterWarning, true, true);
ScriptVariable::Set("Critical", StateCritical, true, true);
ScriptVariable::Set("Unknown", StateUnknown, true, true);
ScriptVariable::Set("Critical", ServiceCritical, true, true);
ScriptVariable::Set("Unknown", ServiceUnknown, true, true);
ScriptVariable::Set("Up", StateFilterUp, true, true);
ScriptVariable::Set("Down", StateFilterDown, true, true);
@ -393,13 +393,13 @@ void Notification::ExecuteNotificationHelper(NotificationType type, const User::
int icinga::ServiceStateToFilter(ServiceState state)
{
switch (state) {
case StateOK:
case ServiceOK:
return StateFilterOK;
case StateWarning:
case ServiceWarning:
return StateFilterWarning;
case StateCritical:
case ServiceCritical:
return StateFilterCritical;
case StateUnknown:
case ServiceUnknown:
return StateFilterUnknown;
default:
VERIFY(!"Invalid state type.");

View File

@ -7,4 +7,4 @@ class NotificationCommand : Command
{
};
}
}

View File

@ -39,13 +39,13 @@ ServiceState PluginUtility::ExitStatusToState(int exitStatus)
{
switch (exitStatus) {
case 0:
return StateOK;
return ServiceOK;
case 1:
return StateWarning;
return ServiceWarning;
case 2:
return StateCritical;
return ServiceCritical;
default:
return StateUnknown;
return ServiceUnknown;
}
}

View File

@ -93,25 +93,25 @@ Host::Ptr Service::GetHost(void) const
ServiceState Service::StateFromString(const String& state)
{
if (state == "OK")
return StateOK;
return ServiceOK;
else if (state == "WARNING")
return StateWarning;
return ServiceWarning;
else if (state == "CRITICAL")
return StateCritical;
return ServiceCritical;
else
return StateUnknown;
return ServiceUnknown;
}
String Service::StateToString(ServiceState state)
{
switch (state) {
case StateOK:
case ServiceOK:
return "OK";
case StateWarning:
case ServiceWarning:
return "WARNING";
case StateCritical:
case ServiceCritical:
return "CRITICAL";
case StateUnknown:
case ServiceUnknown:
default:
return "UNKNOWN";
}

View File

@ -81,7 +81,7 @@ void IcingaCheckTask::ScriptFunc(const Checkable::Ptr& service, const CheckResul
cr->SetOutput("Icinga 2 is running.");
cr->SetPerformanceData(perfdata);
cr->SetState(StateOK);
cr->SetState(ServiceOK);
service->ProcessCheckResult(cr);
}

View File

@ -40,7 +40,7 @@ void NullCheckTask::ScriptFunc(const Checkable::Ptr& service, const CheckResult:
cr->SetOutput(output);
cr->SetPerformanceData(perfdata);
cr->SetState(StateOK);
cr->SetState(ServiceOK);
service->ProcessCheckResult(cr);
}

View File

@ -46,4 +46,4 @@ Array::Ptr TimePeriodTask::EvenMinutesTimePeriodUpdate(const TimePeriod::Ptr&, d
}
return segments;
}
}

View File

@ -42,4 +42,4 @@ private:
}
#endif /* TIMEPERIODTASK_H */
#endif /* TIMEPERIODTASK_H */