|
Monitoring System 0.1.0
System resource monitoring with pluggable collectors and alerting
|
Buffers alerts and sends in batches. More...
#include <alert_notifiers.h>


Public Member Functions | |
| buffered_notifier (std::shared_ptr< alert_notifier > inner, size_t buffer_size=100, std::chrono::milliseconds flush_interval=std::chrono::seconds(30)) | |
| Construct buffered notifier. | |
| 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. | |
| common::VoidResult | flush () |
| Flush buffered alerts. | |
| size_t | pending_count () const |
| Get current buffer size. | |
Public Member Functions inherited from kcenon::monitoring::alert_notifier | |
| virtual | ~alert_notifier ()=default |
Private Member Functions | |
| bool | should_flush () const |
| common::VoidResult | flush_internal () |
Private Attributes | |
| std::shared_ptr< alert_notifier > | inner_ |
| size_t | buffer_size_ |
| std::chrono::milliseconds | flush_interval_ |
| std::mutex | mutex_ |
| std::vector< alert > | buffer_ |
| std::chrono::steady_clock::time_point | last_flush_ |
Buffers alerts and sends in batches.
Collects alerts and sends them in batches either when the buffer is full or when flush is called.
Definition at line 451 of file alert_notifiers.h.
|
inline |
Construct buffered notifier.
| inner | Inner notifier to use for actual sending |
| buffer_size | Maximum alerts before auto-flush |
| flush_interval | Maximum time before auto-flush |
Definition at line 459 of file alert_notifiers.h.
|
inline |
Flush buffered alerts.
Definition at line 504 of file alert_notifiers.h.
References flush_internal(), and mutex_.

|
inlineprivate |
Definition at line 526 of file alert_notifiers.h.
References kcenon::monitoring::alert_group::add_alert(), buffer_, inner_, and last_flush_.
Referenced by flush(), notify(), and notify_group().


|
inlineoverridevirtual |
Check if notifier is ready.
Implements kcenon::monitoring::alert_notifier.
Definition at line 497 of file alert_notifiers.h.
References inner_.
|
inlineoverridevirtual |
Get notifier name.
Implements kcenon::monitoring::alert_notifier.
Definition at line 467 of file alert_notifiers.h.
References inner_.
|
inlineoverridevirtual |
Send a notification for an alert.
| a | Alert to notify about |
Implements kcenon::monitoring::alert_notifier.
Definition at line 471 of file alert_notifiers.h.
References buffer_, flush_internal(), mutex_, and should_flush().

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

|
inline |
Get current buffer size.
Definition at line 512 of file alert_notifiers.h.
|
inlineprivate |
Definition at line 518 of file alert_notifiers.h.
References buffer_, buffer_size_, flush_interval_, and last_flush_.
Referenced by notify(), and notify_group().

|
private |
Definition at line 548 of file alert_notifiers.h.
Referenced by flush_internal(), notify(), notify_group(), pending_count(), and should_flush().
|
private |
Definition at line 544 of file alert_notifiers.h.
Referenced by should_flush().
|
private |
Definition at line 545 of file alert_notifiers.h.
Referenced by should_flush().
|
private |
Definition at line 543 of file alert_notifiers.h.
Referenced by flush_internal(), is_ready(), and name().
|
private |
Definition at line 549 of file alert_notifiers.h.
Referenced by flush_internal(), and should_flush().
|
mutableprivate |
Definition at line 547 of file alert_notifiers.h.
Referenced by flush(), notify(), notify_group(), and pending_count().