mirror of https://github.com/Icinga/icinga2.git
Implement Service::GetFlappingCurrent().
This commit is contained in:
parent
ff6383873f
commit
bdd0ee013c
|
@ -32,6 +32,14 @@ using namespace icinga;
|
||||||
|
|
||||||
#define FLAPPING_INTERVAL (30 * 60)
|
#define FLAPPING_INTERVAL (30 * 60)
|
||||||
|
|
||||||
|
double Service::GetFlappingCurrent(void) const
|
||||||
|
{
|
||||||
|
if (m_FlappingNegative.IsEmpty() || m_FlappingPositive.IsEmpty())
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return 100 * m_FlappingPositive / (m_FlappingPositive + m_FlappingNegative);
|
||||||
|
}
|
||||||
|
|
||||||
double Service::GetFlappingThreshold(void) const
|
double Service::GetFlappingThreshold(void) const
|
||||||
{
|
{
|
||||||
if (m_FlappingThreshold.IsEmpty())
|
if (m_FlappingThreshold.IsEmpty())
|
||||||
|
@ -105,14 +113,5 @@ void Service::UpdateFlappingStatus(bool stateChange)
|
||||||
|
|
||||||
bool Service::IsFlapping(void) const
|
bool Service::IsFlapping(void) const
|
||||||
{
|
{
|
||||||
double threshold = 20;
|
return GetFlappingCurrent() > GetFlappingThreshold();
|
||||||
|
|
||||||
if (!m_FlappingThreshold.IsEmpty())
|
|
||||||
threshold = m_FlappingThreshold;
|
|
||||||
|
|
||||||
if (m_FlappingNegative.IsEmpty() || m_FlappingPositive.IsEmpty())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return (m_FlappingPositive > threshold * (m_FlappingPositive + m_FlappingNegative) / 100);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -269,6 +269,7 @@ public:
|
||||||
bool GetEnableFlapping(void) const;
|
bool GetEnableFlapping(void) const;
|
||||||
void SetEnableFlapping(bool enabled);
|
void SetEnableFlapping(bool enabled);
|
||||||
|
|
||||||
|
double GetFlappingCurrent(void) const;
|
||||||
double GetFlappingThreshold(void) const;
|
double GetFlappingThreshold(void) const;
|
||||||
|
|
||||||
bool IsFlapping(void) const;
|
bool IsFlapping(void) const;
|
||||||
|
|
Loading…
Reference in New Issue