|
Monitoring System 0.1.0
System resource monitoring with pluggable collectors and alerting
|
Routes alerts to different notifiers based on criteria. More...
#include <alert_notifiers.h>


Classes | |
| struct | route |
Public Types | |
| using | route_condition = std::function<bool(const alert&)> |
Public Member Functions | |
| routing_notifier (std::string notifier_name) | |
| Construct routing notifier. | |
| void | add_route (route_condition condition, std::shared_ptr< alert_notifier > notifier) |
| Add a route. | |
| void | set_default_route (std::shared_ptr< alert_notifier > notifier) |
| Add a default route for non-matching alerts. | |
| std::string | name () const override |
| Get notifier name. | |
| common::VoidResult | notify (const alert &a) override |
| Send a notification for an alert. | |
| common::VoidResult | notify_group (const alert_group &group) override |
| Send a notification for an alert group. | |
| bool | is_ready () const override |
| Check if notifier is ready. | |
| void | route_by_severity (alert_severity severity, std::shared_ptr< alert_notifier > notifier) |
| Route by severity. | |
| void | route_by_label (const std::string &key, const std::string &value, std::shared_ptr< alert_notifier > notifier) |
| Route by label. | |
Public Member Functions inherited from kcenon::monitoring::alert_notifier | |
| virtual | ~alert_notifier ()=default |
Private Attributes | |
| std::string | name_ |
| std::mutex | mutex_ |
| std::vector< route > | routes_ |
| std::shared_ptr< alert_notifier > | default_route_ |
Routes alerts to different notifiers based on criteria.
Allows configuring different notification targets based on alert properties like severity or labels.
Definition at line 559 of file alert_notifiers.h.
| using kcenon::monitoring::routing_notifier::route_condition = std::function<bool(const alert&)> |
Definition at line 561 of file alert_notifiers.h.
|
inlineexplicit |
Construct routing notifier.
Definition at line 566 of file alert_notifiers.h.
|
inline |
Add a route.
| condition | Condition for this route |
| notifier | Notifier to use when condition matches |
Definition at line 574 of file alert_notifiers.h.
References mutex_, and routes_.
Referenced by route_by_label(), and route_by_severity().

|
inlineoverridevirtual |
Check if notifier is ready.
Implements kcenon::monitoring::alert_notifier.
Definition at line 617 of file alert_notifiers.h.
References default_route_, mutex_, and routes_.
|
inlineoverridevirtual |
Get notifier name.
Implements kcenon::monitoring::alert_notifier.
Definition at line 588 of file alert_notifiers.h.
References name_.
|
inlineoverridevirtual |
Send a notification for an alert.
| a | Alert to notify about |
Implements kcenon::monitoring::alert_notifier.
Definition at line 590 of file alert_notifiers.h.
References default_route_, mutex_, and routes_.
Referenced by notify_group().

|
inlineoverridevirtual |
Send a notification for an alert group.
| group | Alert group to notify about |
Implements kcenon::monitoring::alert_notifier.
Definition at line 606 of file alert_notifiers.h.
References kcenon::monitoring::alert_group::alerts, and notify().

|
inline |
Route by label.
Definition at line 637 of file alert_notifiers.h.
References add_route(), kcenon::monitoring::alert_labels::get(), and kcenon::monitoring::alert::labels.

|
inline |
Route by severity.
Definition at line 626 of file alert_notifiers.h.
References add_route(), and kcenon::monitoring::alert::severity.

|
inline |
Add a default route for non-matching alerts.
Definition at line 583 of file alert_notifiers.h.
References default_route_, and mutex_.
|
private |
Definition at line 655 of file alert_notifiers.h.
Referenced by is_ready(), notify(), and set_default_route().
|
mutableprivate |
Definition at line 653 of file alert_notifiers.h.
Referenced by add_route(), is_ready(), notify(), and set_default_route().
|
private |
Definition at line 652 of file alert_notifiers.h.
Referenced by name().
|
private |
Definition at line 654 of file alert_notifiers.h.
Referenced by add_route(), is_ready(), and notify().