|
Monitoring System 0.1.0
System resource monitoring with pluggable collectors and alerting
|
Writes alerts to a file. More...
#include <alert_notifiers.h>


Public Member Functions | |
| file_notifier (std::string file_path, std::shared_ptr< alert_formatter > formatter=nullptr) | |
| Construct file 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. | |
Public Member Functions inherited from kcenon::monitoring::alert_notifier | |
| virtual | ~alert_notifier ()=default |
Private Member Functions | |
| common::VoidResult | write_to_file (const std::string &content) |
Private Attributes | |
| std::string | file_path_ |
| std::shared_ptr< alert_formatter > | formatter_ |
| std::mutex | mutex_ |
Writes alerts to a file.
Appends alert notifications to a specified file, useful for logging or audit trails.
Definition at line 299 of file alert_notifiers.h.
|
inlineexplicit |
Construct file notifier.
| file_path | Path to output file |
| formatter | Alert formatter (default: text) |
Definition at line 306 of file alert_notifiers.h.
|
inlineoverridevirtual |
Check if notifier is ready.
Implements kcenon::monitoring::alert_notifier.
Definition at line 323 of file alert_notifiers.h.
References file_path_.
|
inlineoverridevirtual |
Get notifier name.
Implements kcenon::monitoring::alert_notifier.
Definition at line 311 of file alert_notifiers.h.
References file_path_.
|
inlineoverridevirtual |
Send a notification for an alert.
| a | Alert to notify about |
Implements kcenon::monitoring::alert_notifier.
Definition at line 315 of file alert_notifiers.h.
References formatter_, and write_to_file().

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

|
inlineprivate |
Definition at line 328 of file alert_notifiers.h.
References file_path_, mutex_, and kcenon::monitoring::storage_write_failed.
Referenced by notify(), and notify_group().

|
private |
Definition at line 353 of file alert_notifiers.h.
Referenced by is_ready(), name(), and write_to_file().
|
private |
Definition at line 354 of file alert_notifiers.h.
Referenced by notify(), and notify_group().
|
private |
Definition at line 355 of file alert_notifiers.h.
Referenced by write_to_file().