RumPi 1.0
A self-assembling C++ sensor & actuator library for the Raspberry Pi 5
AlertEvent.h
Go to the documentation of this file.
1#pragma once
2#include "../Common.h"
3
4namespace RumPi
5{
13 {
14 protected:
15 std::string myMetricName;
19 std::string myEventSummary;
20
21 public:
32 AlertEvent();
33
50 AlertEvent(const std::string& metricName, const EAlertLevel alertLevel, const float currentReadingValue, const float valueThreshold, const std::string& eventSummary);
51
63 virtual ~AlertEvent() = default;
64
77 std::string ToString() const;
78
91 const std::string& GetMetricName() const;
92
106
119 float GetCurrentReadingValue() const;
120
133 float GetValueThreshold() const;
134
147 const std::string& GetEventSummary() const;
148
161 void SetMetricName(const std::string& metricName);
162
175 void SetAlertLevel(const EAlertLevel alertLevel);
176
189 void SetCurrentReadingValue(const float currentReadingValue);
190
203 void SetValueThreshold(const float currentValueThreshold);
204
217 void SetEventSummary(const std::string& eventSummary);
218 };
219} // namespace RumPi
A single alert event: a metric crossing (or recovering from) a threshold, with the reading that trigg...
Definition: AlertEvent.h:13
float myValueThreshold
The limit it crossed.
Definition: AlertEvent.h:18
float myCurrentReadingValue
The reading that triggered the event.
Definition: AlertEvent.h:17
float GetValueThreshold() const
Gets the threshold the reading crossed.
Definition: AlertEvent.cpp:112
float GetCurrentReadingValue() const
Gets the reading that triggered the event.
Definition: AlertEvent.cpp:95
std::string myEventSummary
Human-readable summary.
Definition: AlertEvent.h:19
void SetEventSummary(const std::string &eventSummary)
Sets the human-readable summary of the event.
Definition: AlertEvent.cpp:214
void SetCurrentReadingValue(const float currentReadingValue)
Sets the reading that triggered the event.
Definition: AlertEvent.cpp:180
void SetValueThreshold(const float currentValueThreshold)
Sets the threshold the reading crossed.
Definition: AlertEvent.cpp:197
virtual ~AlertEvent()=default
Defaulted destructor.
const std::string & GetMetricName() const
Gets the metric that triggered the event.
Definition: AlertEvent.cpp:61
const std::string & GetEventSummary() const
Gets the human-readable summary of the event.
Definition: AlertEvent.cpp:129
void SetAlertLevel(const EAlertLevel alertLevel)
Sets the alert level of the event.
Definition: AlertEvent.cpp:163
EAlertLevel myAlertLevel
OK (recovered), Warning, or Alert.
Definition: AlertEvent.h:16
AlertEvent()
Builds an undefined alert event (OK level, sentinel -1 values).
Definition: AlertEvent.cpp:15
void SetMetricName(const std::string &metricName)
Sets the metric that triggered the event.
Definition: AlertEvent.cpp:146
std::string myMetricName
The metric that triggered the event, e.g. "SystemTemperature".
Definition: AlertEvent.h:15
EAlertLevel GetAlertLevel() const
Gets the alert level of the event.
Definition: AlertEvent.cpp:78
std::string ToString() const
Serializes the metric, alert level, triggering reading, threshold, and summary to a string.
Definition: AlertEvent.cpp:231
RumPi is the library's top-level facade.
Definition: AlertManager.h:6
EAlertLevel
Severity of a metric relative to its thresholds.
Definition: Common.h:94