Eunomia  0.1.0
A lightweight eBPF-based CloudNative Monitor tool for Container Security and Observability
tracker_integrations.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
2  *
3  * Copyright (c) 2022, 郑昱笙,濮雯旭,张典典(牛校牛子队)
4  * All rights reserved.
5  */
6 
7 #ifndef TRACKER_INTEGRATIONS_CMD_H
8 #define TRACKER_INTEGRATIONS_CMD_H
9 
11 #include "prometheus/counter.h"
12 #include "prometheus/histogram.h"
13 #include "prometheus_server.h"
14 
15 struct oomkill_tracker final : public tracker_alone_base
16 {
18  {
19  }
20  static std::unique_ptr<oomkill_tracker> create_tracker_with_args(
21  tracker_event_handler handler,
22  const std::vector<std::string> &args);
23 
24  static std::unique_ptr<oomkill_tracker> create_tracker_with_default_env(tracker_event_handler handler);
25 };
26 
28 {
30  {
31  }
32 
33  struct prometheus_event_handler : public event_handler<tracker_alone_event>
34  {
35  prometheus::Family<prometheus::Histogram> &eunomia_tcpconnlat_v4_counter;
36  prometheus::Family<prometheus::Histogram> &eunomia_tcpconnlat_v6_counter;
38 
41  };
42 
43  static std::unique_ptr<tcpconnlat_tracker> create_tracker_with_default_env(tracker_event_handler handler);
44  static std::unique_ptr<tcpconnlat_tracker> create_tracker_with_args(
45  tracker_event_handler handler,
46  const std::vector<std::string> &args);
47 };
48 
49 struct capable_tracker final : public tracker_alone_base
50 {
52  {
53  }
54 
55  struct prometheus_event_handler : public event_handler<tracker_alone_event>
56  {
57  prometheus::Family<prometheus::Counter> &eunomia_capable_counter;
59 
62  };
63 
64  static std::unique_ptr<capable_tracker> create_tracker_with_default_env(tracker_event_handler handler);
65  static std::unique_ptr<capable_tracker> create_tracker_with_args(
66  tracker_event_handler handler,
67  const std::vector<std::string> &args);
68 };
69 
70 struct memleak_tracker final : public tracker_alone_base
71 {
73  {
74  }
75 
76  static std::unique_ptr<memleak_tracker> create_tracker_with_default_env(tracker_event_handler handler);
77  static std::unique_ptr<memleak_tracker> create_tracker_with_args(
78  tracker_event_handler handler,
79  const std::vector<std::string> &args);
80 };
81 
83 {
85  {
86  }
87 
88  struct prometheus_event_handler : public event_handler<tracker_alone_event>
89  {
90  prometheus::Family<prometheus::Counter> &eunomia_mountsnoop_counter;
92 
95  };
96 
97  static std::unique_ptr<mountsnoop_tracker> create_tracker_with_default_env(tracker_event_handler handler);
98  static std::unique_ptr<mountsnoop_tracker> create_tracker_with_args(
99  tracker_event_handler handler,
100  const std::vector<std::string> &args);
101 };
102 
104 {
106  {
107  }
108 
109  struct prometheus_event_handler : public event_handler<tracker_alone_event>
110  {
111  prometheus::Family<prometheus::Counter> &eunomia_sigsnoop_counter;
113 
116  };
117 
118  static std::unique_ptr<sigsnoop_tracker> create_tracker_with_default_env(tracker_event_handler handler);
119  static std::unique_ptr<sigsnoop_tracker> create_tracker_with_args(
120  tracker_event_handler handler,
121  const std::vector<std::string> &args);
122 };
123 
125 {
127  {
128  }
129 
130  struct prometheus_event_handler : public event_handler<tracker_alone_event>
131  {
132  prometheus::Family<prometheus::Counter> &eunomia_opensnoop_counter;
134 
137  };
138 
139  static std::unique_ptr<opensnoop_tracker> create_tracker_with_default_env(tracker_event_handler handler);
140  static std::unique_ptr<opensnoop_tracker> create_tracker_with_args(
141  tracker_event_handler handler,
142  const std::vector<std::string> &args);
143 };
144 
146 {
148  {
149  }
150 
151  struct prometheus_event_handler : public event_handler<tracker_alone_event>
152  {
153  prometheus::Family<prometheus::Counter> &eunomia_bind_counter;
155 
158  };
159 
160  static std::unique_ptr<bindsnoop_tracker> create_tracker_with_default_env(tracker_event_handler handler);
161  static std::unique_ptr<bindsnoop_tracker> create_tracker_with_args(
162  tracker_event_handler handler,
163  const std::vector<std::string> &args);
164 };
165 
167 {
169  {
170  }
171 
172  static std::unique_ptr<syscount_tracker> create_tracker_with_default_env(tracker_event_handler handler);
173  static std::unique_ptr<syscount_tracker> create_tracker_with_args(
174  tracker_event_handler handler,
175  const std::vector<std::string> &args);
176 };
177 
179 {
181  {
182  }
183 
184  static std::unique_ptr<funclatency_tracker> create_tracker_with_default_env(tracker_event_handler handler);
185  static std::unique_ptr<funclatency_tracker> create_tracker_with_args(
186  tracker_event_handler handler,
187  const std::vector<std::string> &args);
188 };
189 
190 struct tcprtt_tracker final : public tracker_alone_base
191 {
193  {
194  }
195 
196  static std::unique_ptr<tcprtt_tracker> create_tracker_with_default_env(tracker_event_handler handler);
197  static std::unique_ptr<tcprtt_tracker> create_tracker_with_args(
198  tracker_event_handler handler,
199  const std::vector<std::string> &args);
200 };
201 
203 {
205  {
206  }
207  static std::unique_ptr<hotupdate_tracker> create_tracker_with_args(
208  tracker_event_handler handler,
209  const std::vector<std::string> &args);
210 
211  static std::unique_ptr<hotupdate_tracker> create_tracker_with_default_env(tracker_event_handler handler);
212 };
213 
214 #endif
tcprtt_tracker
Definition: tracker_integrations.h:190
tcpconnlat_tracker
Definition: tracker_integrations.h:27
mountsnoop_tracker::mountsnoop_tracker
mountsnoop_tracker(config_data config)
Definition: tracker_integrations.h:84
memleak_tracker::create_tracker_with_args
static std::unique_ptr< memleak_tracker > create_tracker_with_args(tracker_event_handler handler, const std::vector< std::string > &args)
Definition: memleak.cpp:17
eunomia_mode::server
@ server
capable_tracker::prometheus_event_handler::handle
void handle(tracker_event< tracker_alone_event > &e)
implement this function to handle the event
Definition: capable.cpp:26
tcpconnlat_tracker::create_tracker_with_default_env
static std::unique_ptr< tcpconnlat_tracker > create_tracker_with_default_env(tracker_event_handler handler)
Definition: tcpconnlat.cpp:9
capable_tracker::prometheus_event_handler::container_manager_ref
const container_manager & container_manager_ref
Definition: tracker_integrations.h:58
tcpconnlat_tracker::prometheus_event_handler
Definition: tracker_integrations.h:33
hotupdate_tracker::hotupdate_tracker
hotupdate_tracker(config_data config)
Definition: tracker_integrations.h:204
capable_tracker::prometheus_event_handler::eunomia_capable_counter
prometheus::Family< prometheus::Counter > & eunomia_capable_counter
Definition: tracker_integrations.h:57
tcpconnlat_tracker::prometheus_event_handler::eunomia_tcpconnlat_v4_counter
prometheus::Family< prometheus::Histogram > & eunomia_tcpconnlat_v4_counter
Definition: tracker_integrations.h:35
sigsnoop_tracker::sigsnoop_tracker
sigsnoop_tracker(config_data config)
Definition: tracker_integrations.h:105
bindsnoop_tracker::bindsnoop_tracker
bindsnoop_tracker(config_data config)
Definition: tracker_integrations.h:147
event_handler
the event handler for single type
Definition: event_handler.h:52
mountsnoop_tracker::create_tracker_with_args
static std::unique_ptr< mountsnoop_tracker > create_tracker_with_args(tracker_event_handler handler, const std::vector< std::string > &args)
Definition: mountsnoop.cpp:52
bindsnoop_tracker::create_tracker_with_default_env
static std::unique_ptr< bindsnoop_tracker > create_tracker_with_default_env(tracker_event_handler handler)
Definition: bindsnoop.cpp:8
hotupdate_tracker::create_tracker_with_default_env
static std::unique_ptr< hotupdate_tracker > create_tracker_with_default_env(tracker_event_handler handler)
Definition: hotupdate.cpp:4
bindsnoop_tracker::prometheus_event_handler::handle
void handle(tracker_event< tracker_alone_event > &e)
implement this function to handle the event
Definition: bindsnoop.cpp:26
hotupdate_tracker::create_tracker_with_args
static std::unique_ptr< hotupdate_tracker > create_tracker_with_args(tracker_event_handler handler, const std::vector< std::string > &args)
Definition: hotupdate.cpp:13
tcpconnlat_tracker::prometheus_event_handler::handle
void handle(tracker_event< tracker_alone_event > &e)
implement this function to handle the event
Definition: tcpconnlat.cpp:31
sigsnoop_tracker::prometheus_event_handler::prometheus_event_handler
prometheus_event_handler(prometheus_server &server)
Definition: sigsnoop.cpp:17
tracker_config< tracker_alone_env, tracker_alone_event >
oomkill_tracker
Definition: tracker_integrations.h:15
opensnoop_tracker::prometheus_event_handler::eunomia_opensnoop_counter
prometheus::Family< prometheus::Counter > & eunomia_opensnoop_counter
Definition: tracker_integrations.h:132
syscount_tracker::create_tracker_with_default_env
static std::unique_ptr< syscount_tracker > create_tracker_with_default_env(tracker_event_handler handler)
Definition: syscount.cpp:8
memleak_tracker::create_tracker_with_default_env
static std::unique_ptr< memleak_tracker > create_tracker_with_default_env(tracker_event_handler handler)
Definition: memleak.cpp:8
hotupdate_tracker
Definition: tracker_integrations.h:202
funclatency_tracker::create_tracker_with_default_env
static std::unique_ptr< funclatency_tracker > create_tracker_with_default_env(tracker_event_handler handler)
Definition: funclatency.cpp:8
bindsnoop_tracker::prometheus_event_handler::container_manager_ref
const container_manager & container_manager_ref
Definition: tracker_integrations.h:154
capable_tracker::create_tracker_with_default_env
static std::unique_ptr< capable_tracker > create_tracker_with_default_env(tracker_event_handler handler)
Definition: capable.cpp:8
capable_tracker::prometheus_event_handler::prometheus_event_handler
prometheus_event_handler(prometheus_server &server)
Definition: capable.cpp:17
container_manager
manager all container or k8s info
Definition: container_manager.h:21
tcpconnlat_tracker::prometheus_event_handler::prometheus_event_handler
prometheus_event_handler(prometheus_server &server)
Definition: tcpconnlat.cpp:18
mountsnoop_tracker::prometheus_event_handler
Definition: tracker_integrations.h:88
memleak_tracker
Definition: tracker_integrations.h:70
capable_tracker::capable_tracker
capable_tracker(config_data config)
Definition: tracker_integrations.h:51
opensnoop_tracker::create_tracker_with_args
static std::unique_ptr< opensnoop_tracker > create_tracker_with_args(tracker_event_handler handler, const std::vector< std::string > &args)
Definition: opensnoop.cpp:52
sigsnoop_tracker::create_tracker_with_default_env
static std::unique_ptr< sigsnoop_tracker > create_tracker_with_default_env(tracker_event_handler handler)
Definition: sigsnoop.cpp:8
sigsnoop_tracker::create_tracker_with_args
static std::unique_ptr< sigsnoop_tracker > create_tracker_with_args(tracker_event_handler handler, const std::vector< std::string > &args)
Definition: sigsnoop.cpp:55
tcpconnlat_tracker::prometheus_event_handler::eunomia_tcpconnlat_v6_counter
prometheus::Family< prometheus::Histogram > & eunomia_tcpconnlat_v6_counter
Definition: tracker_integrations.h:36
sigsnoop_tracker::prometheus_event_handler::handle
void handle(tracker_event< tracker_alone_event > &e)
implement this function to handle the event
Definition: sigsnoop.cpp:26
oomkill_tracker::create_tracker_with_default_env
static std::unique_ptr< oomkill_tracker > create_tracker_with_default_env(tracker_event_handler handler)
Definition: oomkill.cpp:8
capable_tracker::prometheus_event_handler
Definition: tracker_integrations.h:55
mountsnoop_tracker
Definition: tracker_integrations.h:82
bindsnoop_tracker
Definition: tracker_integrations.h:145
oomkill_tracker::create_tracker_with_args
static std::unique_ptr< oomkill_tracker > create_tracker_with_args(tracker_event_handler handler, const std::vector< std::string > &args)
Definition: oomkill.cpp:17
sigsnoop_tracker::prometheus_event_handler
Definition: tracker_integrations.h:109
capable_tracker
Definition: tracker_integrations.h:49
syscount_tracker
Definition: tracker_integrations.h:166
opensnoop_tracker::prometheus_event_handler::handle
void handle(tracker_event< tracker_alone_event > &e)
implement this function to handle the event
Definition: opensnoop.cpp:26
syscount_tracker::create_tracker_with_args
static std::unique_ptr< syscount_tracker > create_tracker_with_args(tracker_event_handler handler, const std::vector< std::string > &args)
Definition: syscount.cpp:17
opensnoop_tracker::prometheus_event_handler::prometheus_event_handler
prometheus_event_handler(prometheus_server &server)
Definition: opensnoop.cpp:17
sigsnoop_tracker
Definition: tracker_integrations.h:103
prometheus_server.h
funclatency_tracker::create_tracker_with_args
static std::unique_ptr< funclatency_tracker > create_tracker_with_args(tracker_event_handler handler, const std::vector< std::string > &args)
Definition: funclatency.cpp:17
bindsnoop_tracker::prometheus_event_handler::prometheus_event_handler
prometheus_event_handler(prometheus_server &server)
Definition: bindsnoop.cpp:17
bindsnoop_tracker::prometheus_event_handler::eunomia_bind_counter
prometheus::Family< prometheus::Counter > & eunomia_bind_counter
Definition: tracker_integrations.h:153
tcprtt_tracker::create_tracker_with_default_env
static std::unique_ptr< tcprtt_tracker > create_tracker_with_default_env(tracker_event_handler handler)
Definition: tcprtt.cpp:8
mountsnoop_tracker::prometheus_event_handler::handle
void handle(tracker_event< tracker_alone_event > &e)
implement this function to handle the event
Definition: mountsnoop.cpp:28
tracker_event
the basic event type
Definition: event_handler.h:31
funclatency_tracker::funclatency_tracker
funclatency_tracker(config_data config)
Definition: tracker_integrations.h:180
opensnoop_tracker::prometheus_event_handler
Definition: tracker_integrations.h:130
opensnoop_tracker::opensnoop_tracker
opensnoop_tracker(config_data config)
Definition: tracker_integrations.h:126
opensnoop_tracker
Definition: tracker_integrations.h:124
syscount_tracker::syscount_tracker
syscount_tracker(config_data config)
Definition: tracker_integrations.h:168
memleak_tracker::memleak_tracker
memleak_tracker(config_data config)
Definition: tracker_integrations.h:72
bindsnoop_tracker::create_tracker_with_args
static std::unique_ptr< bindsnoop_tracker > create_tracker_with_args(tracker_event_handler handler, const std::vector< std::string > &args)
Definition: bindsnoop.cpp:56
bindsnoop_tracker::prometheus_event_handler
Definition: tracker_integrations.h:151
tcpconnlat_tracker::prometheus_event_handler::container_manager_ref
const container_manager & container_manager_ref
Definition: tracker_integrations.h:37
tracker_alone.h
tcpconnlat_tracker::tcpconnlat_tracker
tcpconnlat_tracker(config_data config)
Definition: tracker_integrations.h:29
oomkill_tracker::oomkill_tracker
oomkill_tracker(config_data config)
Definition: tracker_integrations.h:17
prometheus_server
Definition: prometheus_server.h:22
opensnoop_tracker::prometheus_event_handler::container_manager_ref
const container_manager & container_manager_ref
Definition: tracker_integrations.h:133
mountsnoop_tracker::create_tracker_with_default_env
static std::unique_ptr< mountsnoop_tracker > create_tracker_with_default_env(tracker_event_handler handler)
Definition: mountsnoop.cpp:10
tracker_with_config< tracker_alone_env, tracker_alone_event >::tracker_event_handler
std::shared_ptr< event_handler< tracker_alone_event > > tracker_event_handler
type alias for event handler
Definition: tracker.h:67
funclatency_tracker
Definition: tracker_integrations.h:178
tcpconnlat_tracker::create_tracker_with_args
static std::unique_ptr< tcpconnlat_tracker > create_tracker_with_args(tracker_event_handler handler, const std::vector< std::string > &args)
Definition: tcpconnlat.cpp:79
mountsnoop_tracker::prometheus_event_handler::container_manager_ref
const container_manager & container_manager_ref
Definition: tracker_integrations.h:91
tcprtt_tracker::tcprtt_tracker
tcprtt_tracker(config_data config)
Definition: tracker_integrations.h:192
mountsnoop_tracker::prometheus_event_handler::prometheus_event_handler
prometheus_event_handler(prometheus_server &server)
Definition: mountsnoop.cpp:19
capable_tracker::create_tracker_with_args
static std::unique_ptr< capable_tracker > create_tracker_with_args(tracker_event_handler handler, const std::vector< std::string > &args)
Definition: capable.cpp:56
config
seccomp_config config
Definition: seccomp_test.cpp:13
sigsnoop_tracker::prometheus_event_handler::eunomia_sigsnoop_counter
prometheus::Family< prometheus::Counter > & eunomia_sigsnoop_counter
Definition: tracker_integrations.h:111
tcprtt_tracker::create_tracker_with_args
static std::unique_ptr< tcprtt_tracker > create_tracker_with_args(tracker_event_handler handler, const std::vector< std::string > &args)
Definition: tcprtt.cpp:17
opensnoop_tracker::create_tracker_with_default_env
static std::unique_ptr< opensnoop_tracker > create_tracker_with_default_env(tracker_event_handler handler)
Definition: opensnoop.cpp:8
mountsnoop_tracker::prometheus_event_handler::eunomia_mountsnoop_counter
prometheus::Family< prometheus::Counter > & eunomia_mountsnoop_counter
Definition: tracker_integrations.h:90
sigsnoop_tracker::prometheus_event_handler::container_manager_ref
const container_manager & container_manager_ref
Definition: tracker_integrations.h:112
tracker_alone_base
Definition: tracker_alone.h:42