|
Monitoring System 0.1.0
System resource monitoring with pluggable collectors and alerting
|
Trigger based on comparing value against a threshold. More...
#include <alert_triggers.h>


Public Member Functions | |
| threshold_trigger (double threshold, comparison_operator op=comparison_operator::greater_than, double epsilon=1e-9) | |
| Construct a threshold trigger. | |
| bool | evaluate (double value) const override |
| Evaluate the trigger condition. | |
| std::string | type_name () const override |
| Get trigger type name. | |
| std::string | description () const override |
| Get human-readable description. | |
| double | threshold () const |
| Get the threshold value. | |
| comparison_operator | op () const |
| Get the comparison operator. | |
Public Member Functions inherited from kcenon::monitoring::alert_trigger | |
| virtual | ~alert_trigger ()=default |
Static Public Member Functions | |
| static std::shared_ptr< threshold_trigger > | above (double threshold) |
| Create trigger for value > threshold. | |
| static std::shared_ptr< threshold_trigger > | above_or_equal (double threshold) |
| Create trigger for value >= threshold. | |
| static std::shared_ptr< threshold_trigger > | below (double threshold) |
| Create trigger for value < threshold. | |
| static std::shared_ptr< threshold_trigger > | below_or_equal (double threshold) |
| Create trigger for value <= threshold. | |
| static std::shared_ptr< class range_trigger > | in_range (double min_val, double max_val) |
| Create trigger for value within range (inclusive) | |
| static std::shared_ptr< class range_trigger > | out_of_range (double min_val, double max_val) |
| Create trigger for value outside range (exclusive) | |
Private Attributes | |
| double | threshold_ |
| comparison_operator | operator_ |
| double | epsilon_ |
Trigger based on comparing value against a threshold.
The most common trigger type, comparing metric values against configured thresholds using various comparison operators.
Definition at line 76 of file alert_triggers.h.
|
inlineexplicit |
Construct a threshold trigger.
| threshold | The threshold value |
| op | Comparison operator |
| epsilon | Epsilon for floating-point comparison (default 1e-9) |
Definition at line 84 of file alert_triggers.h.
|
inlinestatic |
Create trigger for value > threshold.
Definition at line 133 of file alert_triggers.h.
References kcenon::monitoring::greater_than, and threshold().
Referenced by AlertManagerRuleTest::create_rule(), main(), AlertManagerProcessingTest::SetUp(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().


|
inlinestatic |
Create trigger for value >= threshold.
Definition at line 140 of file alert_triggers.h.
References kcenon::monitoring::greater_or_equal, and threshold().
Referenced by main(), and TEST_F().


|
inlinestatic |
Create trigger for value < threshold.
Definition at line 147 of file alert_triggers.h.
References kcenon::monitoring::less_than, and threshold().
Referenced by main(), TEST_F(), and TEST_F().


|
inlinestatic |
Create trigger for value <= threshold.
Definition at line 154 of file alert_triggers.h.
References kcenon::monitoring::less_or_equal, and threshold().
Referenced by main(), and TEST_F().


|
inlineoverridevirtual |
Get human-readable description.
Implements kcenon::monitoring::alert_trigger.
Definition at line 114 of file alert_triggers.h.
References kcenon::monitoring::comparison_operator_to_string(), operator_, and threshold_.

|
inlineoverridevirtual |
Evaluate the trigger condition.
| value | Current metric value |
Implements kcenon::monitoring::alert_trigger.
Definition at line 91 of file alert_triggers.h.
References epsilon_, kcenon::monitoring::equal, kcenon::monitoring::greater_or_equal, kcenon::monitoring::greater_than, kcenon::monitoring::less_or_equal, kcenon::monitoring::less_than, kcenon::monitoring::not_equal, operator_, and threshold_.
|
inlinestatic |
Create trigger for value within range (inclusive)
Definition at line 215 of file alert_triggers.h.
Referenced by main(), and TEST_F().

|
inline |
|
inlinestatic |
Create trigger for value outside range (exclusive)
Definition at line 219 of file alert_triggers.h.
Referenced by main(), and TEST_F().

|
inline |
Get the threshold value.
Definition at line 122 of file alert_triggers.h.
References threshold_.
Referenced by above(), above_or_equal(), below(), and below_or_equal().

|
inlineoverridevirtual |
Get trigger type name.
Implements kcenon::monitoring::alert_trigger.
Definition at line 110 of file alert_triggers.h.
|
private |
Definition at line 171 of file alert_triggers.h.
Referenced by evaluate().
|
private |
Definition at line 170 of file alert_triggers.h.
Referenced by description(), evaluate(), and op().
|
private |
Definition at line 169 of file alert_triggers.h.
Referenced by description(), evaluate(), and threshold().