mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-26 15:14:07 +02:00
Use named variables instead of hard-coded constants.
This commit is contained in:
parent
4f39e10a05
commit
eba470db3e
@ -23,6 +23,11 @@ using namespace icinga;
|
|||||||
|
|
||||||
REGISTER_CLASS(Service);
|
REGISTER_CLASS(Service);
|
||||||
|
|
||||||
|
const int Service::DefaultMaxAttempts = 3;
|
||||||
|
const int Service::DefaultCheckInterval = 5 * 60;
|
||||||
|
const int Service::MinCheckInterval = 15;
|
||||||
|
const int Service::CheckIntervalDivisor = 5;
|
||||||
|
|
||||||
boost::signal<void (const Service::Ptr&, const CheckResultMessage&)> Service::OnCheckResultReceived;
|
boost::signal<void (const Service::Ptr&, const CheckResultMessage&)> Service::OnCheckResultReceived;
|
||||||
boost::signal<void (const Service::Ptr&, const String&)> Service::OnCheckerChanged;
|
boost::signal<void (const Service::Ptr&, const String&)> Service::OnCheckerChanged;
|
||||||
|
|
||||||
@ -101,7 +106,7 @@ long Service::GetMaxCheckAttempts(void) const
|
|||||||
Value value = Get("max_check_attempts");
|
Value value = Get("max_check_attempts");
|
||||||
|
|
||||||
if (value.IsEmpty())
|
if (value.IsEmpty())
|
||||||
return 3;
|
return DefaultMaxCheckAttempts;
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
@ -111,10 +116,10 @@ long Service::GetCheckInterval(void) const
|
|||||||
Value value = Get("check_interval");
|
Value value = Get("check_interval");
|
||||||
|
|
||||||
if (value.IsEmpty())
|
if (value.IsEmpty())
|
||||||
return 300;
|
return DefaultCheckInterval;
|
||||||
|
|
||||||
if (value < 15)
|
if (value < MinCheckInterval)
|
||||||
value = 15;
|
value = MinCheckInterval;
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
@ -124,7 +129,7 @@ long Service::GetRetryInterval(void) const
|
|||||||
Value value = Get("retry_interval");
|
Value value = Get("retry_interval");
|
||||||
|
|
||||||
if (value.IsEmpty())
|
if (value.IsEmpty())
|
||||||
return GetCheckInterval() / 5;
|
return GetCheckInterval() / CheckIntervalDivisor;
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
@ -52,6 +52,11 @@ public:
|
|||||||
static bool Exists(const String& name);
|
static bool Exists(const String& name);
|
||||||
static Service::Ptr GetByName(const String& name);
|
static Service::Ptr GetByName(const String& name);
|
||||||
|
|
||||||
|
static const int DefaultMaxAttempts;
|
||||||
|
static const int DefaultCheckInterval;
|
||||||
|
static const int MinCheckInterval;
|
||||||
|
static const int CheckIntervalDivisor;
|
||||||
|
|
||||||
String GetAlias(void) const;
|
String GetAlias(void) const;
|
||||||
Host::Ptr GetHost(void) const;
|
Host::Ptr GetHost(void) const;
|
||||||
Dictionary::Ptr GetMacros(void) const;
|
Dictionary::Ptr GetMacros(void) const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user