|
Monitoring System 0.1.0
System resource monitoring with pluggable collectors and alerting
|
Template engine for alert messages. More...
#include <alert_config.h>

Public Member Functions | |
| alert_template (std::string template_str) | |
| Construct with template string. | |
| void | set (const std::string &key, const std::string &value) |
| Set a custom variable value. | |
| std::string | render (const alert &a) const |
| Render template with alert data. | |
| const std::string & | template_string () const |
| Get template string. | |
| common::VoidResult | validate () const |
| Validate template syntax. | |
Static Private Member Functions | |
| static std::string | format_value (double value) |
| static std::string | substitute_variables (const std::string &input, const std::unordered_map< std::string, std::string > &vars) |
Private Attributes | |
| std::string | template_str_ |
| std::unordered_map< std::string, std::string > | custom_vars_ |
Template engine for alert messages.
Supports variable substitution in alert summaries and descriptions using ${variable} syntax. Variables can include alert properties, labels, and annotations.
Built-in variables:
Definition at line 58 of file alert_config.h.
|
inlineexplicit |
Construct with template string.
Definition at line 63 of file alert_config.h.
|
inlinestaticprivate |
Definition at line 138 of file alert_config.h.
Referenced by render().

|
inline |
Render template with alert data.
| a | Alert providing context |
Definition at line 78 of file alert_config.h.
References kcenon::monitoring::alert_severity_to_string(), kcenon::monitoring::alert_state_to_string(), kcenon::monitoring::alert::annotations, kcenon::monitoring::alert_annotations::custom, custom_vars_, kcenon::monitoring::alert_annotations::description, kcenon::monitoring::alert::fingerprint(), format_value(), kcenon::monitoring::alert::group_key, kcenon::monitoring::alert::labels, kcenon::monitoring::alert_labels::labels, kcenon::monitoring::alert::name, kcenon::monitoring::alert::rule_name, kcenon::monitoring::alert_annotations::runbook_url, kcenon::monitoring::alert::severity, kcenon::monitoring::alert::state, substitute_variables(), kcenon::monitoring::alert_annotations::summary, template_str_, and kcenon::monitoring::alert::value.

|
inline |
|
inlinestaticprivate |
Definition at line 144 of file alert_config.h.
Referenced by render().

|
inline |
Get template string.
Definition at line 122 of file alert_config.h.
References template_str_.
|
inline |
Validate template syntax.
Definition at line 128 of file alert_config.h.
References template_str_, and kcenon::monitoring::validation_failed.
|
private |
Definition at line 173 of file alert_config.h.
|
private |
Definition at line 172 of file alert_config.h.
Referenced by render(), template_string(), and validate().