xref: /openbmc/telemetry/src/trigger_actions.hpp (revision e8fc57514575f07565035db07cb522fe21988224)
1 #pragma once
2 
3 #include "interfaces/report_manager.hpp"
4 #include "interfaces/trigger_action.hpp"
5 #include "interfaces/trigger_types.hpp"
6 
7 namespace action
8 {
9 
10 class LogToJournal : public interfaces::TriggerAction
11 {
12   public:
13     LogToJournal(numeric::Type type, double val) : type(type), threshold(val)
14     {}
15 
16     void commit(const std::string& id, uint64_t timestamp,
17                 double value) override;
18 
19   private:
20     numeric::Type type;
21     double threshold;
22 
23     const char* getType() const;
24 };
25 
26 class LogToRedfish : public interfaces::TriggerAction
27 {
28   public:
29     LogToRedfish(numeric::Type type, double val) : type(type), threshold(val)
30     {}
31 
32     void commit(const std::string& id, uint64_t timestamp,
33                 double value) override;
34 
35   private:
36     numeric::Type type;
37     double threshold;
38 
39     const char* getMessageId() const;
40 };
41 
42 class UpdateReport : public interfaces::TriggerAction
43 {
44   public:
45     UpdateReport(interfaces::ReportManager& reportManager,
46                  std::vector<std::string> names) :
47         reportManager(reportManager),
48         reportNames(std::move(names))
49     {}
50 
51     void commit(const std::string& id, uint64_t timestamp,
52                 double value) override;
53 
54   private:
55     interfaces::ReportManager& reportManager;
56     std::vector<std::string> reportNames;
57 };
58 } // namespace action
59