mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-27 07:34:15 +02:00
Merge {host,service}::StateTypeToString()
& drop unused StateTypeFromString()
This commit is contained in:
parent
5d11df1abf
commit
953a2e2e96
@ -130,7 +130,7 @@ void CompatLogger::CheckResultHandler(const Checkable::Ptr& checkable, const Che
|
|||||||
<< host->GetName() << ";"
|
<< host->GetName() << ";"
|
||||||
<< service->GetShortName() << ";"
|
<< service->GetShortName() << ";"
|
||||||
<< Service::StateToString(service->GetState()) << ";"
|
<< Service::StateToString(service->GetState()) << ";"
|
||||||
<< Service::StateTypeToString(service->GetStateType()) << ";"
|
<< Checkable::StateTypeToString(service->GetStateType()) << ";"
|
||||||
<< attempt_after << ";"
|
<< attempt_after << ";"
|
||||||
<< output << ""
|
<< output << ""
|
||||||
<< "";
|
<< "";
|
||||||
@ -140,7 +140,7 @@ void CompatLogger::CheckResultHandler(const Checkable::Ptr& checkable, const Che
|
|||||||
msgbuf << "HOST ALERT: "
|
msgbuf << "HOST ALERT: "
|
||||||
<< host->GetName() << ";"
|
<< host->GetName() << ";"
|
||||||
<< GetHostStateString(host) << ";"
|
<< GetHostStateString(host) << ";"
|
||||||
<< Host::StateTypeToString(host->GetStateType()) << ";"
|
<< Checkable::StateTypeToString(host->GetStateType()) << ";"
|
||||||
<< attempt_after << ";"
|
<< attempt_after << ";"
|
||||||
<< output << ""
|
<< output << ""
|
||||||
<< "";
|
<< "";
|
||||||
@ -413,14 +413,14 @@ void CompatLogger::EventCommandHandler(const Checkable::Ptr& checkable)
|
|||||||
<< host->GetName() << ";"
|
<< host->GetName() << ";"
|
||||||
<< service->GetShortName() << ";"
|
<< service->GetShortName() << ";"
|
||||||
<< Service::StateToString(service->GetState()) << ";"
|
<< Service::StateToString(service->GetState()) << ";"
|
||||||
<< Service::StateTypeToString(service->GetStateType()) << ";"
|
<< Checkable::StateTypeToString(service->GetStateType()) << ";"
|
||||||
<< current_attempt << ";"
|
<< current_attempt << ";"
|
||||||
<< event_command_name;
|
<< event_command_name;
|
||||||
} else {
|
} else {
|
||||||
msgbuf << "HOST EVENT HANDLER: "
|
msgbuf << "HOST EVENT HANDLER: "
|
||||||
<< host->GetName() << ";"
|
<< host->GetName() << ";"
|
||||||
<< GetHostStateString(host) << ";"
|
<< GetHostStateString(host) << ";"
|
||||||
<< Host::StateTypeToString(host->GetStateType()) << ";"
|
<< Checkable::StateTypeToString(host->GetStateType()) << ";"
|
||||||
<< current_attempt << ";"
|
<< current_attempt << ";"
|
||||||
<< event_command_name;
|
<< event_command_name;
|
||||||
}
|
}
|
||||||
@ -505,7 +505,7 @@ void CompatLogger::ReopenFile(bool rotate)
|
|||||||
msgbuf << "CURRENT HOST STATE: "
|
msgbuf << "CURRENT HOST STATE: "
|
||||||
<< host->GetName() << ";"
|
<< host->GetName() << ";"
|
||||||
<< GetHostStateString(host) << ";"
|
<< GetHostStateString(host) << ";"
|
||||||
<< Host::StateTypeToString(host->GetStateType()) << ";"
|
<< Checkable::StateTypeToString(host->GetStateType()) << ";"
|
||||||
<< host->GetCheckAttempt() << ";"
|
<< host->GetCheckAttempt() << ";"
|
||||||
<< output << "";
|
<< output << "";
|
||||||
|
|
||||||
@ -526,7 +526,7 @@ void CompatLogger::ReopenFile(bool rotate)
|
|||||||
<< host->GetName() << ";"
|
<< host->GetName() << ";"
|
||||||
<< service->GetShortName() << ";"
|
<< service->GetShortName() << ";"
|
||||||
<< Service::StateToString(service->GetState()) << ";"
|
<< Service::StateToString(service->GetState()) << ";"
|
||||||
<< Service::StateTypeToString(service->GetStateType()) << ";"
|
<< Checkable::StateTypeToString(service->GetStateType()) << ";"
|
||||||
<< service->GetCheckAttempt() << ";"
|
<< service->GetCheckAttempt() << ";"
|
||||||
<< output << "";
|
<< output << "";
|
||||||
|
|
||||||
|
@ -994,7 +994,7 @@ void DbEvents::AddCheckResultLogHistory(const Checkable::Ptr& checkable, const C
|
|||||||
<< host->GetName() << ";"
|
<< host->GetName() << ";"
|
||||||
<< service->GetShortName() << ";"
|
<< service->GetShortName() << ";"
|
||||||
<< Service::StateToString(service->GetState()) << ";"
|
<< Service::StateToString(service->GetState()) << ";"
|
||||||
<< Service::StateTypeToString(service->GetStateType()) << ";"
|
<< Checkable::StateTypeToString(service->GetStateType()) << ";"
|
||||||
<< service->GetCheckAttempt() << ";"
|
<< service->GetCheckAttempt() << ";"
|
||||||
<< output << ""
|
<< output << ""
|
||||||
<< "";
|
<< "";
|
||||||
@ -1021,7 +1021,7 @@ void DbEvents::AddCheckResultLogHistory(const Checkable::Ptr& checkable, const C
|
|||||||
msgbuf << "HOST ALERT: "
|
msgbuf << "HOST ALERT: "
|
||||||
<< host->GetName() << ";"
|
<< host->GetName() << ";"
|
||||||
<< GetHostStateString(host) << ";"
|
<< GetHostStateString(host) << ";"
|
||||||
<< Host::StateTypeToString(host->GetStateType()) << ";"
|
<< Checkable::StateTypeToString(host->GetStateType()) << ";"
|
||||||
<< host->GetCheckAttempt() << ";"
|
<< host->GetCheckAttempt() << ";"
|
||||||
<< output << ""
|
<< output << ""
|
||||||
<< "";
|
<< "";
|
||||||
|
@ -322,3 +322,9 @@ void Checkable::CleanDeadlinedExecutions(const Timer * const&)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String Checkable::StateTypeToString(StateType type)
|
||||||
|
{
|
||||||
|
return type == StateTypeSoft ? "SOFT" : "HARD";
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -106,6 +106,8 @@ public:
|
|||||||
|
|
||||||
void UpdateNextCheck(const MessageOrigin::Ptr& origin = nullptr);
|
void UpdateNextCheck(const MessageOrigin::Ptr& origin = nullptr);
|
||||||
|
|
||||||
|
static String StateTypeToString(StateType type);
|
||||||
|
|
||||||
bool HasBeenChecked() const;
|
bool HasBeenChecked() const;
|
||||||
virtual bool IsStateOK(ServiceState state) const = 0;
|
virtual bool IsStateOK(ServiceState state) const = 0;
|
||||||
|
|
||||||
|
@ -227,22 +227,6 @@ String Host::StateToString(HostState state)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StateType Host::StateTypeFromString(const String& type)
|
|
||||||
{
|
|
||||||
if (type == "SOFT")
|
|
||||||
return StateTypeSoft;
|
|
||||||
else
|
|
||||||
return StateTypeHard;
|
|
||||||
}
|
|
||||||
|
|
||||||
String Host::StateTypeToString(StateType type)
|
|
||||||
{
|
|
||||||
if (type == StateTypeSoft)
|
|
||||||
return "SOFT";
|
|
||||||
else
|
|
||||||
return "HARD";
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Host::ResolveMacro(const String& macro, const CheckResult::Ptr&, Value *result) const
|
bool Host::ResolveMacro(const String& macro, const CheckResult::Ptr&, Value *result) const
|
||||||
{
|
{
|
||||||
if (macro == "state") {
|
if (macro == "state") {
|
||||||
|
@ -45,9 +45,6 @@ public:
|
|||||||
static HostState StateFromString(const String& state);
|
static HostState StateFromString(const String& state);
|
||||||
static String StateToString(HostState state);
|
static String StateToString(HostState state);
|
||||||
|
|
||||||
static StateType StateTypeFromString(const String& state);
|
|
||||||
static String StateTypeToString(StateType state);
|
|
||||||
|
|
||||||
bool ResolveMacro(const String& macro, const CheckResult::Ptr& cr, Value *result) const override;
|
bool ResolveMacro(const String& macro, const CheckResult::Ptr& cr, Value *result) const override;
|
||||||
|
|
||||||
void OnAllConfigLoaded() override;
|
void OnAllConfigLoaded() override;
|
||||||
|
@ -195,22 +195,6 @@ String Service::StateToString(ServiceState state)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StateType Service::StateTypeFromString(const String& type)
|
|
||||||
{
|
|
||||||
if (type == "SOFT")
|
|
||||||
return StateTypeSoft;
|
|
||||||
else
|
|
||||||
return StateTypeHard;
|
|
||||||
}
|
|
||||||
|
|
||||||
String Service::StateTypeToString(StateType type)
|
|
||||||
{
|
|
||||||
if (type == StateTypeSoft)
|
|
||||||
return "SOFT";
|
|
||||||
else
|
|
||||||
return "HARD";
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Service::ResolveMacro(const String& macro, const CheckResult::Ptr& cr, Value *result) const
|
bool Service::ResolveMacro(const String& macro, const CheckResult::Ptr& cr, Value *result) const
|
||||||
{
|
{
|
||||||
if (macro == "state") {
|
if (macro == "state") {
|
||||||
|
@ -39,9 +39,6 @@ public:
|
|||||||
static ServiceState StateFromString(const String& state);
|
static ServiceState StateFromString(const String& state);
|
||||||
static String StateToString(ServiceState state);
|
static String StateToString(ServiceState state);
|
||||||
|
|
||||||
static StateType StateTypeFromString(const String& state);
|
|
||||||
static String StateTypeToString(StateType state);
|
|
||||||
|
|
||||||
static void EvaluateApplyRules(const Host::Ptr& host);
|
static void EvaluateApplyRules(const Host::Ptr& host);
|
||||||
|
|
||||||
void OnAllConfigLoaded() override;
|
void OnAllConfigLoaded() override;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user