Monitoring System 0.1.0
System resource monitoring with pluggable collectors and alerting
Loading...
Searching...
No Matches
kcenon::monitoring::webhook_config Struct Reference

Configuration for webhook notifier. More...

#include <alert_notifiers.h>

Collaboration diagram for kcenon::monitoring::webhook_config:
Collaboration graph

Public Member Functions

webhook_configadd_header (const std::string &key, const std::string &value)
 Add a custom header.
 
bool validate () const
 Validate configuration.
 

Public Attributes

std::string url
 Webhook URL.
 
std::string method = "POST"
 HTTP method.
 
std::chrono::milliseconds timeout {30000}
 Request timeout.
 
std::unordered_map< std::string, std::string > headers
 Custom headers.
 
size_t max_retries = 3
 Maximum retry attempts.
 
std::chrono::milliseconds retry_delay {1000}
 Delay between retries.
 
bool send_resolved = true
 Send resolved notifications.
 
std::string content_type = "application/json"
 Content type header.
 

Detailed Description

Configuration for webhook notifier.

Examples
alert_notifiers_example.cpp.

Definition at line 37 of file alert_notifiers.h.

Member Function Documentation

◆ add_header()

webhook_config & kcenon::monitoring::webhook_config::add_header ( const std::string & key,
const std::string & value )
inline

Add a custom header.

Examples
/home/runner/work/monitoring_system/monitoring_system/include/kcenon/monitoring/alert/alert_notifiers.h, and alert_notifiers_example.cpp.

Definition at line 50 of file alert_notifiers.h.

50 {
51 headers[key] = value;
52 return *this;
53 }
std::unordered_map< std::string, std::string > headers
Custom headers.

References headers.

Referenced by main().

Here is the caller graph for this function:

◆ validate()

bool kcenon::monitoring::webhook_config::validate ( ) const
inline

Validate configuration.

Examples
/home/runner/work/monitoring_system/monitoring_system/include/kcenon/monitoring/alert/alert_notifiers.h.

Definition at line 58 of file alert_notifiers.h.

58 {
59 return !url.empty() && timeout.count() > 0;
60 }
std::chrono::milliseconds timeout
Request timeout.

References timeout, and url.

Referenced by kcenon::monitoring::webhook_notifier::is_ready().

Here is the caller graph for this function:

Member Data Documentation

◆ content_type

std::string kcenon::monitoring::webhook_config::content_type = "application/json"

◆ headers

std::unordered_map<std::string, std::string> kcenon::monitoring::webhook_config::headers

◆ max_retries

size_t kcenon::monitoring::webhook_config::max_retries = 3

◆ method

std::string kcenon::monitoring::webhook_config::method = "POST"

◆ retry_delay

std::chrono::milliseconds kcenon::monitoring::webhook_config::retry_delay {1000}

◆ send_resolved

bool kcenon::monitoring::webhook_config::send_resolved = true

◆ timeout

std::chrono::milliseconds kcenon::monitoring::webhook_config::timeout {30000}

◆ url


The documentation for this struct was generated from the following file: