allow disabling netdata monitoring section of the dashboard (#13788)
* allow disabling netdata monitoring section of the dashboard * disable-netdata-stats: Modify eBPF.plugin to disable statistic charts according user selection, by default it is enabled * Don't send internal statistics for exporting engine if it's disabled. * Fix global statistics flag initialization * Don't send internal statistics for checks plugin if it's disabled. Co-authored-by: Thiago Marques <thiagoftsm@gmail.com> Co-authored-by: Vladimir Kobal <vlad@prokk.net>
Costa Tsaousis committed
Oct 13, 2022 at 08:12 UTC
61767a8a08d089962ff82e45b3e459c8bd05b0c4
27 files changed
+692
-310
aclk/aclk.c
+1
-1
@@ -686,7 +686,7 @@ void *aclk_main(void *ptr)
686
// that send JSON payloads of 10 MB as single messages
687
mqtt_wss_set_max_buf_size(mqttwss_client, 25*1024*1024);
688
689
- aclk_stats_enabled = config_get_boolean(CONFIG_SECTION_CLOUD, "statistics", CONFIG_BOOLEAN_YES);
689
+ aclk_stats_enabled = config_get_boolean(CONFIG_SECTION_CLOUD, "statistics", global_statistics_enabled);
690
if (aclk_stats_enabled) {
691
stats_thread = callocz(1, sizeof(struct aclk_stats_thread));
692
stats_thread->thread = mallocz(sizeof(netdata_thread_t));
collectors/apps.plugin/apps_plugin.c
+9
-1
@@ -4777,6 +4777,13 @@ int main(int argc, char **argv) {
4777
error_log_errors_per_period = 100;
4778
error_log_throttle_period = 3600;
4779
4780
+ bool send_resource_usage = true;
4781
+ {
4782
+ const char *s = getenv("NETDATA_INTERNALS_MONITORING");
4783
+ if(s && *s && strcmp(s, "NO") == 0)
4784
+ send_resource_usage = false;
4785
+ }
4786
+
4787
// since apps.plugin runs as root, prevent it from opening symbolic links
4788
procfile_open_flags = O_RDONLY|O_NOFOLLOW;
4789
@@ -4904,7 +4911,8 @@ int main(int argc, char **argv) {
4911
calculate_netdata_statistics();
4912
normalize_utilization(apps_groups_root_target);
4913
4907
- send_resource_usage_to_netdata(dt);
4914
+ if(send_resource_usage)
4915
+ send_resource_usage_to_netdata(dt);
4916
4917
#ifndef __FreeBSD__
4918
send_proc_states_count(dt);
collectors/checks.plugin/plugin_checks.c
+3
@@ -12,6 +12,9 @@ static void checks_main_cleanup(void *ptr) {
12
}
13
14
void *checks_main(void *ptr) {
15
+ if (!global_statistics_enabled)
16
+ return NULL;
17
+
18
netdata_thread_cleanup_push(checks_main_cleanup, ptr);
19
20
usec_t usec = 0, susec = localhost->rrd_update_every * USEC_PER_SEC, loop_usec = 0, total_susec = 0;
collectors/ebpf.plugin/ebpf.c
+170
-34
@@ -166,40 +166,176 @@ ebpf_module_t ebpf_modules[] = {
166
};
167
168
struct netdata_static_thread ebpf_threads[] = {
169
- {"EBPF PROCESS", NULL, NULL, 1,
170
- NULL, NULL, NULL},
171
- {"EBPF SOCKET" , NULL, NULL, 1,
172
- NULL, NULL, NULL},
173
- {"EBPF CACHESTAT" , NULL, NULL, 1,
174
- NULL, NULL, NULL},
175
- {"EBPF SYNC" , NULL, NULL, 1,
176
- NULL, NULL, NULL},
177
- {"EBPF DCSTAT" , NULL, NULL, 1,
178
- NULL, NULL, NULL},
179
- {"EBPF SWAP" , NULL, NULL, 1,
180
- NULL, NULL, NULL},
181
- {"EBPF VFS" , NULL, NULL, 1,
182
- NULL, NULL, NULL},
183
- {"EBPF FILESYSTEM" , NULL, NULL, 1,
184
- NULL, NULL, NULL},
185
- {"EBPF DISK" , NULL, NULL, 1,
186
- NULL, NULL, NULL},
187
- {"EBPF MOUNT" , NULL, NULL, 1,
188
- NULL, NULL, NULL},
189
- {"EBPF FD" , NULL, NULL, 1,
190
- NULL, NULL, NULL},
191
- {"EBPF HARDIRQ" , NULL, NULL, 1,
192
- NULL, NULL, NULL},
193
- {"EBPF SOFTIRQ" , NULL, NULL, 1,
194
- NULL, NULL, NULL},
195
- {"EBPF OOMKILL" , NULL, NULL, 1,
196
- NULL, NULL, NULL},
197
- {"EBPF SHM" , NULL, NULL, 1,
198
- NULL, NULL, NULL},
199
- {"EBPF MDFLUSH" , NULL, NULL, 1,
200
- NULL, NULL, NULL},
201
- {NULL , NULL, NULL, 0,
202
- NULL, NULL, NULL}
169
+ {
170
+ .name = "EBPF PROCESS",
171
+ .config_section = NULL,
172
+ .config_name = NULL,
173
+ .env_name = NULL,
174
+ .enabled = 1,
175
+ .thread = NULL,
176
+ .init_routine = NULL,
177
+ .start_routine = NULL
178
+ },
179
+ {
180
+ .name = "EBPF SOCKET",
181
+ .config_section = NULL,
182
+ .config_name = NULL,
183
+ .env_name = NULL,
184
+ .enabled = 1,
185
+ .thread = NULL,
186
+ .init_routine = NULL,
187
+ .start_routine = NULL
188
+ },
189
+ {
190
+ .name = "EBPF CACHESTAT",
191
+ .config_section = NULL,
192
+ .config_name = NULL,
193
+ .env_name = NULL,
194
+ .enabled = 1,
195
+ .thread = NULL,
196
+ .init_routine = NULL,
197
+ .start_routine = NULL
198
+ },
199
+ {
200
+ .name = "EBPF SYNC",
201
+ .config_section = NULL,
202
+ .config_name = NULL,
203
+ .env_name = NULL,
204
+ .enabled = 1,
205
+ .thread = NULL,
206
+ .init_routine = NULL,
207
+ .start_routine = NULL
208
+ },
209
+ {
210
+ .name = "EBPF DCSTAT",
211
+ .config_section = NULL,
212
+ .config_name = NULL,
213
+ .env_name = NULL,
214
+ .enabled = 1,
215
+ .thread = NULL,
216
+ .init_routine = NULL,
217
+ .start_routine = NULL
218
+ },
219
+ {
220
+ .name = "EBPF SWAP",
221
+ .config_section = NULL,
222
+ .config_name = NULL,
223
+ .env_name = NULL,
224
+ .enabled = 1,
225
+ .thread = NULL,
226
+ .init_routine = NULL,
227
+ .start_routine = NULL
228
+ },
229
+ {
230
+ .name = "EBPF VFS",
231
+ .config_section = NULL,
232
+ .config_name = NULL,
233
+ .env_name = NULL,
234
+ .enabled = 1,
235
+ .thread = NULL,
236
+ .init_routine = NULL,
237
+ .start_routine = NULL
238
+ },
239
+ {
240
+ .name = "EBPF FILESYSTEM",
241
+ .config_section = NULL,
242
+ .config_name = NULL,
243
+ .env_name = NULL,
244
+ .enabled = 1,
245
+ .thread = NULL,
246
+ .init_routine = NULL,
247
+ .start_routine = NULL
248
+ },
249
+ {
250
+ .name = "EBPF DISK",
251
+ .config_section = NULL,
252
+ .config_name = NULL,
253
+ .env_name = NULL,
254
+ .enabled = 1,
255
+ .thread = NULL,
256
+ .init_routine = NULL,
257
+ .start_routine = NULL
258
+ },
259
+ {
260
+ .name = "EBPF MOUNT",
261
+ .config_section = NULL,
262
+ .config_name = NULL,
263
+ .env_name = NULL,
264
+ .enabled = 1,
265
+ .thread = NULL,
266
+ .init_routine = NULL,
267
+ .start_routine = NULL
268
+ },
269
+ {
270
+ .name = "EBPF FD",
271
+ .config_section = NULL,
272
+ .config_name = NULL,
273
+ .env_name = NULL,
274
+ .enabled = 1,
275
+ .thread = NULL,
276
+ .init_routine = NULL,
277
+ .start_routine = NULL
278
+ },
279
+ {
280
+ .name = "EBPF HARDIRQ",
281
+ .config_section = NULL,
282
+ .config_name = NULL,
283
+ .env_name = NULL,
284
+ .enabled = 1,
285
+ .thread = NULL,
286
+ .init_routine = NULL,
287
+ .start_routine = NULL
288
+ },
289
+ {
290
+ .name = "EBPF SOFTIRQ",
291
+ .config_section = NULL,
292
+ .config_name = NULL,
293
+ .env_name = NULL,
294
+ .enabled = 1,
295
+ .thread = NULL,
296
+ .init_routine = NULL,
297
+ .start_routine = NULL
298
+ },
299
+ {
300
+ .name = "EBPF OOMKILL",
301
+ .config_section = NULL,
302
+ .config_name = NULL,
303
+ .env_name = NULL,
304
+ .enabled = 1,
305
+ .thread = NULL,
306
+ .init_routine = NULL,
307
+ .start_routine = NULL
308
+ },
309
+ {
310
+ .name = "EBPF SHM",
311
+ .config_section = NULL,
312
+ .config_name = NULL,
313
+ .env_name = NULL,
314
+ .enabled = 1,
315
+ .thread = NULL,
316
+ .init_routine = NULL,
317
+ .start_routine = NULL
318
+ },
319
+ {
320
+ .name = "EBPF MDFLUSH",
321
+ .config_section = NULL,
322
+ .config_name = NULL,
323
+ .env_name = NULL,
324
+ .enabled = 1,
325
+ .thread = NULL,
326
+ .init_routine = NULL,
327
+ .start_routine = NULL
328
+ },
329
+ {
330
+ .name = NULL,
331
+ .config_section = NULL,
332
+ .config_name = NULL,
333
+ .env_name = NULL,
334
+ .enabled = 0,
335
+ .thread = NULL,
336
+ .init_routine = NULL,
337
+ .start_routine = NULL
338
+ },
339
};
340
341
ebpf_filesystem_partitions_t localfs[] =
collectors/ebpf.plugin/ebpf_cachestat.c
+8
-3
@@ -15,9 +15,14 @@ netdata_cachestat_pid_t *cachestat_vector = NULL;
15
static netdata_idx_t cachestat_hash_values[NETDATA_CACHESTAT_END];
16
static netdata_idx_t *cachestat_values = NULL;
17
18
-struct netdata_static_thread cachestat_threads = {"CACHESTAT KERNEL",
19
- NULL, NULL, 1, NULL,
20
- NULL, NULL};
18
+struct netdata_static_thread cachestat_threads = {.name = "CACHESTAT KERNEL",
19
+ .config_section = NULL,
20
+ .config_name = NULL,
21
+ .env_name = NULL,
22
+ .enabled = 1,
23
+ .thread = NULL,
24
+ .init_routine = NULL,
25
+ .start_routine = NULL};
26
27
ebpf_local_maps_t cachestat_maps[] = {{.name = "cstat_global", .internal_input = NETDATA_CACHESTAT_END,
28
.user_input = 0, .type = NETDATA_EBPF_MAP_STATIC,
collectors/ebpf.plugin/ebpf_dcstat.c
+7
-2
@@ -20,8 +20,13 @@ struct config dcstat_config = { .first_section = NULL,
20
.rwlock = AVL_LOCK_INITIALIZER } };
21
22
struct netdata_static_thread dcstat_threads = {"DCSTAT KERNEL",
23
- NULL, NULL, 1, NULL,
24
- NULL, NULL};
23
+ .config_section = NULL,
24
+ .config_name = NULL,
25
+ .env_name = NULL,
26
+ .enabled = 1,
27
+ .thread = NULL,
28
+ .init_routine = NULL,
29
+ .start_routine = NULL};
30
static enum ebpf_threads_status ebpf_dcstat_exited = NETDATA_THREAD_EBPF_RUNNING;
31
32
ebpf_local_maps_t dcstat_maps[] = {{.name = "dcstat_global", .internal_input = NETDATA_DIRECTORY_CACHE_END,
collectors/ebpf.plugin/ebpf_disk.c
+10
-3
@@ -33,9 +33,16 @@ static netdata_syscall_stat_t disk_aggregated_data[NETDATA_EBPF_HIST_MAX_BINS];
33
static netdata_publish_syscall_t disk_publish_aggregated[NETDATA_EBPF_HIST_MAX_BINS];
34
35
static netdata_idx_t *disk_hash_values = NULL;
36
-static struct netdata_static_thread disk_threads = {"DISK KERNEL",
37
- NULL, NULL, 1, NULL,
38
- NULL, NULL };
36
+static struct netdata_static_thread disk_threads = {
37
+ .name = "DISK KERNEL",
38
+ .config_section = NULL,
39
+ .config_name = NULL,
40
+ .env_name = NULL,
41
+ .enabled = 1,
42
+ .thread = NULL,
43
+ .init_routine = NULL,
44
+ .start_routine = NULL
45
+};
46
static enum ebpf_threads_status ebpf_disk_exited = NETDATA_THREAD_EBPF_RUNNING;
47
48
ebpf_publish_disk_t *plot_disks = NULL;
collectors/ebpf.plugin/ebpf_fd.c
+9
-2
@@ -29,8 +29,15 @@ struct config fd_config = { .first_section = NULL, .last_section = NULL, .mutex
29
.index = {.avl_tree = { .root = NULL, .compar = appconfig_section_compare },
30
.rwlock = AVL_LOCK_INITIALIZER } };
31
32
-struct netdata_static_thread fd_thread = {"FD KERNEL", NULL, NULL, 1, NULL,
33
- NULL, NULL};
32
+struct netdata_static_thread fd_thread = {"FD KERNEL",
33
+ .config_section = NULL,
34
+ .config_name = NULL,
35
+ .env_name = NULL,
36
+ .enabled = 1,
37
+ .thread = NULL,
38
+ .init_routine = NULL,
39
+ .start_routine = NULL};
40
+
41
static enum ebpf_threads_status ebpf_fd_exited = NETDATA_THREAD_EBPF_RUNNING;
42
static netdata_idx_t fd_hash_values[NETDATA_FD_COUNTER];
43
static netdata_idx_t *fd_values = NULL;
collectors/ebpf.plugin/ebpf_filesystem.c
+11
-3
@@ -30,9 +30,17 @@ static ebpf_local_maps_t fs_maps[] = {{.name = "tbl_ext4", .internal_input = NET
30
.type = NETDATA_EBPF_MAP_CONTROLLER,
31
.map_fd = ND_EBPF_MAP_FD_NOT_INITIALIZED}};
32
33
-struct netdata_static_thread filesystem_threads = {"EBPF FS READ",
34
- NULL, NULL, 1, NULL,
35
- NULL, NULL };
33
+struct netdata_static_thread filesystem_threads = {
34
+ .name = "EBPF FS READ",
35
+ .config_section = NULL,
36
+ .config_name = NULL,
37
+ .env_name = NULL,
38
+ .enabled = 1,
39
+ .thread = NULL,
40
+ .init_routine = NULL,
41
+ .start_routine = NULL
42
+};
43
+
44
static enum ebpf_threads_status ebpf_fs_exited = NETDATA_THREAD_EBPF_RUNNING;
45
46
static netdata_syscall_stat_t filesystem_aggregated_data[NETDATA_EBPF_HIST_MAX_BINS];
collectors/ebpf.plugin/ebpf_hardirq.c
+10
-3
@@ -135,9 +135,16 @@ static hardirq_ebpf_val_t *hardirq_ebpf_vals = NULL;
135
// tmp store for static hard IRQ values we get from a per-CPU eBPF map.
136
static hardirq_ebpf_static_val_t *hardirq_ebpf_static_vals = NULL;
137
138
-static struct netdata_static_thread hardirq_threads = {"HARDIRQ KERNEL",
139
- NULL, NULL, 1, NULL,
140
- NULL, NULL };
138
+static struct netdata_static_thread hardirq_threads = {
139
+ .name = "HARDIRQ KERNEL",
140
+ .config_section = NULL,
141
+ .config_name = NULL,
142
+ .env_name = NULL,
143
+ .enabled = 1,
144
+ .thread = NULL,
145
+ .init_routine = NULL,
146
+ .start_routine = NULL
147
+};
148
static enum ebpf_threads_status ebpf_hardirq_exited = NETDATA_THREAD_EBPF_RUNNING;
149
150
/**
collectors/ebpf.plugin/ebpf_mdflush.c
+10
-3
@@ -35,9 +35,16 @@ static avl_tree_lock mdflush_pub;
35
// tmp store for mdflush values we get from a per-CPU eBPF map.
36
static mdflush_ebpf_val_t *mdflush_ebpf_vals = NULL;
37
38
-static struct netdata_static_thread mdflush_threads = {"MDFLUSH KERNEL",
39
- NULL, NULL, 1, NULL,
40
- NULL, NULL };
38
+static struct netdata_static_thread mdflush_threads = {
39
+ .name = "MDFLUSH KERNEL",
40
+ .config_section = NULL,
41
+ .config_name = NULL,
42
+ .env_name = NULL,
43
+ .enabled = 1,
44
+ .thread = NULL,
45
+ .init_routine = NULL,
46
+ .start_routine = NULL
47
+};
48
static enum ebpf_threads_status ebpf_mdflush_exited = NETDATA_THREAD_EBPF_RUNNING;
49
50
/**
collectors/ebpf.plugin/ebpf_mount.c
+10
-3
@@ -22,9 +22,16 @@ static netdata_idx_t *mount_values = NULL;
22
23
static netdata_idx_t mount_hash_values[NETDATA_MOUNT_END];
24
25
-struct netdata_static_thread mount_thread = {"MOUNT KERNEL",
26
- NULL, NULL, 1, NULL,
27
- NULL, NULL};
25
+struct netdata_static_thread mount_thread = {
26
+ .name = "MOUNT KERNEL",
27
+ .config_section = NULL,
28
+ .config_name = NULL,
29
+ .env_name = NULL,
30
+ .enabled = 1,
31
+ .thread = NULL,
32
+ .init_routine = NULL,
33
+ .start_routine = NULL
34
+};
35
36
netdata_ebpf_targets_t mount_targets[] = { {.name = "mount", .mode = EBPF_LOAD_TRAMPOLINE},
37
{.name = "umount", .mode = EBPF_LOAD_TRAMPOLINE},
collectors/ebpf.plugin/ebpf_process.c
+33
-2
@@ -46,6 +46,7 @@ ebpf_process_stat_t **global_process_stats = NULL;
46
ebpf_process_publish_apps_t **current_apps_data = NULL;
47
48
int process_enabled = 0;
49
+bool publish_internal_metrics = true;
50
51
struct config process_config = { .first_section = NULL,
52
.last_section = NULL,
@@ -53,8 +54,16 @@ struct config process_config = { .first_section = NULL,
54
.index = { .avl_tree = { .root = NULL, .compar = appconfig_section_compare },
55
.rwlock = AVL_LOCK_INITIALIZER } };
56
56
-static struct netdata_static_thread cgroup_thread = {"EBPF CGROUP", NULL, NULL,
57
- 1, NULL, NULL, NULL};
57
+static struct netdata_static_thread cgroup_thread = {
58
+ .name = "EBPF CGROUP",
59
+ .config_section = NULL,
60
+ .config_name = NULL,
61
+ .env_name = NULL,
62
+ .enabled = 1,
63
+ .thread = NULL,
64
+ .init_routine = NULL,
65
+ .start_routine = NULL
66
+};
67
static enum ebpf_threads_status ebpf_process_exited = NETDATA_THREAD_EBPF_RUNNING;
68
69
static char *threads_stat[NETDATA_EBPF_THREAD_STAT_END] = {"total", "running"};
@@ -492,6 +501,21 @@ static inline void ebpf_create_statistic_load_chart(ebpf_module_t *em)
501
ebpf_algorithms[NETDATA_EBPF_ABSOLUTE_IDX]);
502
}
503
504
+/**
505
+ * Update Internal Metric variable
506
+ *
507
+ * By default eBPF.plugin sends internal metrics for netdata, but user can
508
+ * disable this.
509
+ *
510
+ * The function updates the variable used to send charts.
511
+ */
512
+static void update_internal_metric_variable()
513
+{
514
+ const char *s = getenv("NETDATA_INTERNALS_MONITORING");
515
+ if (s && *s && strcmp(s, "NO") == 0)
516
+ publish_internal_metrics = false;
517
+}
518
+
519
/**
520
* Create Statistics Charts
521
*
@@ -501,6 +525,10 @@ static inline void ebpf_create_statistic_load_chart(ebpf_module_t *em)
525
*/
526
static void ebpf_create_statistic_charts(ebpf_module_t *em)
527
{
528
+ update_internal_metric_variable();
529
+ if (!publish_internal_metrics)
530
+ return;
531
+
532
ebpf_create_statistic_thread_chart(em);
533
534
ebpf_create_statistic_load_chart(em);
@@ -1071,6 +1099,9 @@ void ebpf_process_update_cgroup_algorithm()
1099
*/
1100
void ebpf_send_statistic_data()
1101
{
1102
+ if (!publish_internal_metrics)
1103
+ return;
1104
+
1105
write_begin_chart(NETDATA_MONITORING_FAMILY, NETDATA_EBPF_THREADS);
1106
write_chart_dimension(threads_stat[NETDATA_EBPF_THREAD_STAT_TOTAL], (long long)plugin_statistics.threads);
1107
write_chart_dimension(threads_stat[NETDATA_EBPF_THREAD_STAT_RUNNING], (long long)plugin_statistics.running);
collectors/ebpf.plugin/ebpf_shm.c
+10
-2
@@ -34,8 +34,16 @@ static ebpf_local_maps_t shm_maps[] = {{.name = "tbl_pid_shm", .internal_input =
34
.map_fd = ND_EBPF_MAP_FD_NOT_INITIALIZED},
35
{.name = NULL, .internal_input = 0, .user_input = 0}};
36
37
-struct netdata_static_thread shm_threads = {"SHM KERNEL", NULL, NULL, 1,
38
- NULL, NULL, NULL};
37
+struct netdata_static_thread shm_threads = {
38
+ .name = "SHM KERNEL",
39
+ .config_section = NULL,
40
+ .config_name = NULL,
41
+ .env_name = NULL,
42
+ .enabled = 1,
43
+ .thread = NULL,
44
+ .init_routine = NULL,
45
+ .start_routine = NULL
46
+};
47
static enum ebpf_threads_status ebpf_shm_exited = NETDATA_THREAD_EBPF_RUNNING;
48
49
netdata_ebpf_targets_t shm_targets[] = { {.name = "shmget", .mode = EBPF_LOAD_TRAMPOLINE},
collectors/ebpf.plugin/ebpf_socket.c
+10
-3
@@ -87,9 +87,16 @@ netdata_ebpf_targets_t socket_targets[] = { {.name = "inet_csk_accept", .mode =
87
{.name = "tcp_v6_connect", .mode = EBPF_LOAD_TRAMPOLINE},
88
{.name = NULL, .mode = EBPF_LOAD_TRAMPOLINE}};
89
90
-struct netdata_static_thread socket_threads = {"EBPF SOCKET READ",
91
- NULL, NULL, 1, NULL,
92
- NULL, NULL };
90
+struct netdata_static_thread socket_threads = {
91
+ .name = "EBPF SOCKET READ",
92
+ .config_section = NULL,
93
+ .config_name = NULL,
94
+ .env_name = NULL,
95
+ .enabled = 1,
96
+ .thread = NULL,
97
+ .init_routine = NULL,
98
+ .start_routine = NULL
99
+};
100
static enum ebpf_threads_status ebpf_socket_exited = NETDATA_THREAD_EBPF_RUNNING;
101
102
#ifdef LIBBPF_MAJOR_VERSION
collectors/ebpf.plugin/ebpf_softirq.c
+10
-3
@@ -54,9 +54,16 @@ static softirq_val_t softirq_vals[] = {
54
// tmp store for soft IRQ values we get from a per-CPU eBPF map.
55
static softirq_ebpf_val_t *softirq_ebpf_vals = NULL;
56
57
-static struct netdata_static_thread softirq_threads = {"SOFTIRQ KERNEL",
58
- NULL, NULL, 1, NULL,
59
- NULL, NULL };
57
+static struct netdata_static_thread softirq_threads = {
58
+ .name = "SOFTIRQ KERNEL",
59
+ .config_section = NULL,
60
+ .config_name = NULL,
61
+ .env_name = NULL,
62
+ .enabled = 1,
63
+ .thread = NULL,
64
+ .init_routine = NULL,
65
+ .start_routine = NULL
66
+};
67
static enum ebpf_threads_status ebpf_softirq_exited = NETDATA_THREAD_EBPF_RUNNING;
68
69
/**
collectors/ebpf.plugin/ebpf_swap.c
+10
-2
@@ -34,8 +34,16 @@ static ebpf_local_maps_t swap_maps[] = {{.name = "tbl_pid_swap", .internal_input
34
.map_fd = ND_EBPF_MAP_FD_NOT_INITIALIZED},
35
{.name = NULL, .internal_input = 0, .user_input = 0}};
36
37
-struct netdata_static_thread swap_threads = {"SWAP KERNEL", NULL, NULL, 1,
38
- NULL, NULL, NULL};
37
+struct netdata_static_thread swap_threads = {
38
+ .name = "SWAP KERNEL",
39
+ .config_section = NULL,
40
+ .config_name = NULL,
41
+ .env_name = NULL,
42
+ .enabled = 1,
43
+ .thread = NULL,
44
+ .init_routine = NULL,
45
+ .start_routine = NULL
46
+};
47
static enum ebpf_threads_status ebpf_swap_exited = NETDATA_THREAD_EBPF_RUNNING;
48
49
netdata_ebpf_targets_t swap_targets[] = { {.name = "swap_readpage", .mode = EBPF_LOAD_TRAMPOLINE},
collectors/ebpf.plugin/ebpf_sync.c
+10
-2
@@ -10,8 +10,16 @@ static netdata_publish_syscall_t sync_counter_publish_aggregated[NETDATA_SYNC_ID
10
11
static netdata_idx_t sync_hash_values[NETDATA_SYNC_IDX_END];
12
13
-struct netdata_static_thread sync_threads = {"SYNC KERNEL", NULL, NULL, 1,
14
- NULL, NULL, NULL};
13
+struct netdata_static_thread sync_threads = {
14
+ .name = "SYNC KERNEL",
15
+ .config_section = NULL,
16
+ .config_name = NULL,
17
+ .env_name = NULL,
18
+ .enabled = 1,
19
+ .thread = NULL,
20
+ .init_routine = NULL,
21
+ .start_routine = NULL
22
+};
23
24
static ebpf_local_maps_t sync_maps[] = {{.name = "tbl_sync", .internal_input = NETDATA_SYNC_END,
25
.user_input = 0, .type = NETDATA_EBPF_MAP_STATIC,
collectors/ebpf.plugin/ebpf_vfs.c
+10
-3
@@ -34,9 +34,16 @@ struct config vfs_config = { .first_section = NULL,
34
.index = { .avl_tree = { .root = NULL, .compar = appconfig_section_compare },
35
.rwlock = AVL_LOCK_INITIALIZER } };
36
37
-struct netdata_static_thread vfs_threads = {"VFS KERNEL",
38
- NULL, NULL, 1, NULL,
39
- NULL, NULL};
37
+struct netdata_static_thread vfs_threads = {
38
+ .name = "VFS KERNEL",
39
+ .config_section = NULL,
40
+ .config_name = NULL,
41
+ .env_name = NULL,
42
+ .enabled = 1,
43
+ .thread = NULL,
44
+ .init_routine = NULL,
45
+ .start_routine = NULL
46
+};
47
static enum ebpf_threads_status ebpf_vfs_exited = NETDATA_THREAD_EBPF_RUNNING;
48
49
netdata_ebpf_targets_t vfs_targets[] = { {.name = "vfs_write", .mode = EBPF_LOAD_TRAMPOLINE},
collectors/statsd.plugin/statsd.c
+266
-228
@@ -2535,173 +2535,209 @@ void *statsd_main(void *ptr) {
2535
// ----------------------------------------------------------------------------------------------------------------
2536
// statsd monitoring charts
2537
2538
- RRDSET *st_metrics = rrdset_create_localhost(
2539
- "netdata"
2540
- , "statsd_metrics"
2541
- , NULL
2542
- , "statsd"
2543
- , NULL
2544
- , "Metrics in the netdata statsd database"
2545
- , "metrics"
2546
- , PLUGIN_STATSD_NAME
2547
- , "stats"
2548
- , 132010
2549
- , statsd.update_every
2550
- , RRDSET_TYPE_STACKED
2551
- );
2552
- RRDDIM *rd_metrics_gauge = rrddim_add(st_metrics, "gauges", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
2553
- RRDDIM *rd_metrics_counter = rrddim_add(st_metrics, "counters", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
2554
- RRDDIM *rd_metrics_timer = rrddim_add(st_metrics, "timers", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
2555
- RRDDIM *rd_metrics_meter = rrddim_add(st_metrics, "meters", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
2556
- RRDDIM *rd_metrics_histogram = rrddim_add(st_metrics, "histograms", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
2557
- RRDDIM *rd_metrics_set = rrddim_add(st_metrics, "sets", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
2558
- RRDDIM *rd_metrics_dictionary= rrddim_add(st_metrics, "dictionaries", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
2559
-
2560
- RRDSET *st_useful_metrics = rrdset_create_localhost(
2561
- "netdata"
2562
- , "statsd_useful_metrics"
2563
- , NULL
2564
- , "statsd"
2565
- , NULL
2566
- , "Useful metrics in the netdata statsd database"
2567
- , "metrics"
2568
- , PLUGIN_STATSD_NAME
2569
- , "stats"
2570
- , 132010
2571
- , statsd.update_every
2572
- , RRDSET_TYPE_STACKED
2573
- );
2574
- RRDDIM *rd_useful_metrics_gauge = rrddim_add(st_useful_metrics, "gauges", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
2575
- RRDDIM *rd_useful_metrics_counter = rrddim_add(st_useful_metrics, "counters", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
2576
- RRDDIM *rd_useful_metrics_timer = rrddim_add(st_useful_metrics, "timers", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
2577
- RRDDIM *rd_useful_metrics_meter = rrddim_add(st_useful_metrics, "meters", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
2578
- RRDDIM *rd_useful_metrics_histogram = rrddim_add(st_useful_metrics, "histograms", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
2579
- RRDDIM *rd_useful_metrics_set = rrddim_add(st_useful_metrics, "sets", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
2580
- RRDDIM *rd_useful_metrics_dictionary= rrddim_add(st_useful_metrics, "dictionaries", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
2581
-
2582
- RRDSET *st_events = rrdset_create_localhost(
2583
- "netdata"
2584
- , "statsd_events"
2585
- , NULL
2586
- , "statsd"
2587
- , NULL
2588
- , "Events processed by the netdata statsd server"
2589
- , "events/s"
2590
- , PLUGIN_STATSD_NAME
2591
- , "stats"
2592
- , 132011
2593
- , statsd.update_every
2594
- , RRDSET_TYPE_STACKED
2595
- );
2596
- RRDDIM *rd_events_gauge = rrddim_add(st_events, "gauges", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
2597
- RRDDIM *rd_events_counter = rrddim_add(st_events, "counters", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
2598
- RRDDIM *rd_events_timer = rrddim_add(st_events, "timers", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
2599
- RRDDIM *rd_events_meter = rrddim_add(st_events, "meters", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
2600
- RRDDIM *rd_events_histogram = rrddim_add(st_events, "histograms", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
2601
- RRDDIM *rd_events_set = rrddim_add(st_events, "sets", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
2602
- RRDDIM *rd_events_dictionary= rrddim_add(st_events, "dictionaries", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
2603
- RRDDIM *rd_events_unknown = rrddim_add(st_events, "unknown", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
2604
- RRDDIM *rd_events_errors = rrddim_add(st_events, "errors", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
2605
-
2606
- RRDSET *st_reads = rrdset_create_localhost(
2607
- "netdata"
2608
- , "statsd_reads"
2609
- , NULL
2610
- , "statsd"
2611
- , NULL
2612
- , "Read operations made by the netdata statsd server"
2613
- , "reads/s"
2614
- , PLUGIN_STATSD_NAME
2615
- , "stats"
2616
- , 132012
2617
- , statsd.update_every
2618
- , RRDSET_TYPE_STACKED
2619
- );
2620
- RRDDIM *rd_reads_tcp = rrddim_add(st_reads, "tcp", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
2621
- RRDDIM *rd_reads_udp = rrddim_add(st_reads, "udp", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
2622
-
2623
- RRDSET *st_bytes = rrdset_create_localhost(
2624
- "netdata"
2625
- , "statsd_bytes"
2626
- , NULL
2627
- , "statsd"
2628
- , NULL
2629
- , "Bytes read by the netdata statsd server"
2630
- , "kilobits/s"
2631
- , PLUGIN_STATSD_NAME
2632
- , "stats"
2633
- , 132013
2634
- , statsd.update_every
2635
- , RRDSET_TYPE_STACKED
2636
- );
2637
- RRDDIM *rd_bytes_tcp = rrddim_add(st_bytes, "tcp", NULL, 8, BITS_IN_A_KILOBIT, RRD_ALGORITHM_INCREMENTAL);
2638
- RRDDIM *rd_bytes_udp = rrddim_add(st_bytes, "udp", NULL, 8, BITS_IN_A_KILOBIT, RRD_ALGORITHM_INCREMENTAL);
2639
-
2640
- RRDSET *st_packets = rrdset_create_localhost(
2641
- "netdata"
2642
- , "statsd_packets"
2643
- , NULL
2644
- , "statsd"
2645
- , NULL
2646
- , "Network packets processed by the netdata statsd server"
2647
- , "packets/s"
2648
- , PLUGIN_STATSD_NAME
2649
- , "stats"
2650
- , 132014
2651
- , statsd.update_every
2652
- , RRDSET_TYPE_STACKED
2653
- );
2654
- RRDDIM *rd_packets_tcp = rrddim_add(st_packets, "tcp", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
2655
- RRDDIM *rd_packets_udp = rrddim_add(st_packets, "udp", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
2656
-
2657
- RRDSET *st_tcp_connects = rrdset_create_localhost(
2658
- "netdata"
2659
- , "tcp_connects"
2660
- , NULL
2661
- , "statsd"
2662
- , NULL
2663
- , "statsd server TCP connects and disconnects"
2664
- , "events"
2665
- , PLUGIN_STATSD_NAME
2666
- , "stats"
2667
- , 132015
2668
- , statsd.update_every
2669
- , RRDSET_TYPE_LINE
2670
- );
2671
- RRDDIM *rd_tcp_connects = rrddim_add(st_tcp_connects, "connects", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
2672
- RRDDIM *rd_tcp_disconnects = rrddim_add(st_tcp_connects, "disconnects", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
2673
-
2674
- RRDSET *st_tcp_connected = rrdset_create_localhost(
2675
- "netdata"
2676
- , "tcp_connected"
2677
- , NULL
2678
- , "statsd"
2679
- , NULL
2680
- , "statsd server TCP connected sockets"
2681
- , "sockets"
2682
- , PLUGIN_STATSD_NAME
2683
- , "stats"
2684
- , 132016
2685
- , statsd.update_every
2686
- , RRDSET_TYPE_LINE
2687
- );
2688
- RRDDIM *rd_tcp_connected = rrddim_add(st_tcp_connected, "connected", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
2689
-
2690
- RRDSET *st_pcharts = rrdset_create_localhost(
2691
- "netdata"
2692
- , "private_charts"
2693
- , NULL
2694
- , "statsd"
2695
- , NULL
2696
- , "Private metric charts created by the netdata statsd server"
2697
- , "charts"
2698
- , PLUGIN_STATSD_NAME
2699
- , "stats"
2700
- , 132020
2701
- , statsd.update_every
2702
- , RRDSET_TYPE_AREA
2703
- );
2704
- RRDDIM *rd_pcharts = rrddim_add(st_pcharts, "charts", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
2538
+ RRDSET *st_metrics = NULL;
2539
+ RRDDIM *rd_metrics_gauge = NULL;
2540
+ RRDDIM *rd_metrics_counter = NULL;
2541
+ RRDDIM *rd_metrics_timer = NULL;
2542
+ RRDDIM *rd_metrics_meter = NULL;
2543
+ RRDDIM *rd_metrics_histogram = NULL;
2544
+ RRDDIM *rd_metrics_set = NULL;
2545
+ RRDDIM *rd_metrics_dictionary = NULL;
2546
+ RRDSET *st_useful_metrics = NULL;
2547
+ RRDDIM *rd_useful_metrics_gauge = NULL;
2548
+ RRDDIM *rd_useful_metrics_counter = NULL;
2549
+ RRDDIM *rd_useful_metrics_timer = NULL;
2550
+ RRDDIM *rd_useful_metrics_meter = NULL;
2551
+ RRDDIM *rd_useful_metrics_histogram = NULL;
2552
+ RRDDIM *rd_useful_metrics_set = NULL;
2553
+ RRDDIM *rd_useful_metrics_dictionary = NULL;
2554
+ RRDSET *st_events = NULL;
2555
+ RRDDIM *rd_events_gauge = NULL;
2556
+ RRDDIM *rd_events_counter = NULL;
2557
+ RRDDIM *rd_events_timer = NULL;
2558
+ RRDDIM *rd_events_meter = NULL;
2559
+ RRDDIM *rd_events_histogram = NULL;
2560
+ RRDDIM *rd_events_set = NULL;
2561
+ RRDDIM *rd_events_dictionary = NULL;
2562
+ RRDDIM *rd_events_unknown = NULL;
2563
+ RRDDIM *rd_events_errors = NULL;
2564
+ RRDSET *st_reads = NULL;
2565
+ RRDDIM *rd_reads_tcp = NULL;
2566
+ RRDDIM *rd_reads_udp = NULL;
2567
+ RRDSET *st_bytes = NULL;
2568
+ RRDDIM *rd_bytes_tcp = NULL;
2569
+ RRDDIM *rd_bytes_udp = NULL;
2570
+ RRDSET *st_packets = NULL;
2571
+ RRDDIM *rd_packets_tcp = NULL;
2572
+ RRDDIM *rd_packets_udp = NULL;
2573
+ RRDSET *st_tcp_connects = NULL;
2574
+ RRDDIM *rd_tcp_connects = NULL;
2575
+ RRDDIM *rd_tcp_disconnects = NULL;
2576
+ RRDSET *st_tcp_connected = NULL;
2577
+ RRDDIM *rd_tcp_connected = NULL;
2578
+ RRDSET *st_pcharts = NULL;
2579
+ RRDDIM *rd_pcharts = NULL;
2580
+
2581
+ if(global_statistics_enabled) {
2582
+ st_metrics = rrdset_create_localhost(
2583
+ "netdata",
2584
+ "statsd_metrics",
2585
+ NULL,
2586
+ "statsd",
2587
+ NULL,
2588
+ "Metrics in the netdata statsd database",
2589
+ "metrics",
2590
+ PLUGIN_STATSD_NAME,
2591
+ "stats",
2592
+ 132010,
2593
+ statsd.update_every,
2594
+ RRDSET_TYPE_STACKED);
2595
+ rd_metrics_gauge = rrddim_add(st_metrics, "gauges", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
2596
+ rd_metrics_counter = rrddim_add(st_metrics, "counters", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
2597
+ rd_metrics_timer = rrddim_add(st_metrics, "timers", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
2598
+ rd_metrics_meter = rrddim_add(st_metrics, "meters", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
2599
+ rd_metrics_histogram = rrddim_add(st_metrics, "histograms", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
2600
+ rd_metrics_set = rrddim_add(st_metrics, "sets", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
2601
+ rd_metrics_dictionary = rrddim_add(st_metrics, "dictionaries", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
2602
+
2603
+ st_useful_metrics = rrdset_create_localhost(
2604
+ "netdata",
2605
+ "statsd_useful_metrics",
2606
+ NULL,
2607
+ "statsd",
2608
+ NULL,
2609
+ "Useful metrics in the netdata statsd database",
2610
+ "metrics",
2611
+ PLUGIN_STATSD_NAME,
2612
+ "stats",
2613
+ 132010,
2614
+ statsd.update_every,
2615
+ RRDSET_TYPE_STACKED);
2616
+ rd_useful_metrics_gauge = rrddim_add(st_useful_metrics, "gauges", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
2617
+ rd_useful_metrics_counter = rrddim_add(st_useful_metrics, "counters", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
2618
+ rd_useful_metrics_timer = rrddim_add(st_useful_metrics, "timers", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
2619
+ rd_useful_metrics_meter = rrddim_add(st_useful_metrics, "meters", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
2620
+ rd_useful_metrics_histogram = rrddim_add(st_useful_metrics, "histograms", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
2621
+ rd_useful_metrics_set = rrddim_add(st_useful_metrics, "sets", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
2622
+ rd_useful_metrics_dictionary = rrddim_add(st_useful_metrics, "dictionaries", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
2623
+
2624
+ st_events = rrdset_create_localhost(
2625
+ "netdata",
2626
+ "statsd_events",
2627
+ NULL,
2628
+ "statsd",
2629
+ NULL,
2630
+ "Events processed by the netdata statsd server",
2631
+ "events/s",
2632
+ PLUGIN_STATSD_NAME,
2633
+ "stats",
2634
+ 132011,
2635
+ statsd.update_every,
2636
+ RRDSET_TYPE_STACKED);
2637
+ rd_events_gauge = rrddim_add(st_events, "gauges", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
2638
+ rd_events_counter = rrddim_add(st_events, "counters", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
2639
+ rd_events_timer = rrddim_add(st_events, "timers", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
2640
+ rd_events_meter = rrddim_add(st_events, "meters", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
2641
+ rd_events_histogram = rrddim_add(st_events, "histograms", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
2642
+ rd_events_set = rrddim_add(st_events, "sets", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
2643
+ rd_events_dictionary = rrddim_add(st_events, "dictionaries", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
2644
+ rd_events_unknown = rrddim_add(st_events, "unknown", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
2645
+ rd_events_errors = rrddim_add(st_events, "errors", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
2646
+
2647
+ st_reads = rrdset_create_localhost(
2648
+ "netdata",
2649
+ "statsd_reads",
2650
+ NULL,
2651
+ "statsd",
2652
+ NULL,
2653
+ "Read operations made by the netdata statsd server",
2654
+ "reads/s",
2655
+ PLUGIN_STATSD_NAME,
2656
+ "stats",
2657
+ 132012,
2658
+ statsd.update_every,
2659
+ RRDSET_TYPE_STACKED);
2660
+ rd_reads_tcp = rrddim_add(st_reads, "tcp", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
2661
+ rd_reads_udp = rrddim_add(st_reads, "udp", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
2662
+
2663
+ st_bytes = rrdset_create_localhost(
2664
+ "netdata",
2665
+ "statsd_bytes",
2666
+ NULL,
2667
+ "statsd",
2668
+ NULL,
2669
+ "Bytes read by the netdata statsd server",
2670
+ "kilobits/s",
2671
+ PLUGIN_STATSD_NAME,
2672
+ "stats",
2673
+ 132013,
2674
+ statsd.update_every,
2675
+ RRDSET_TYPE_STACKED);
2676
+ rd_bytes_tcp = rrddim_add(st_bytes, "tcp", NULL, 8, BITS_IN_A_KILOBIT, RRD_ALGORITHM_INCREMENTAL);
2677
+ rd_bytes_udp = rrddim_add(st_bytes, "udp", NULL, 8, BITS_IN_A_KILOBIT, RRD_ALGORITHM_INCREMENTAL);
2678
+
2679
+ st_packets = rrdset_create_localhost(
2680
+ "netdata",
2681
+ "statsd_packets",
2682
+ NULL,
2683
+ "statsd",
2684
+ NULL,
2685
+ "Network packets processed by the netdata statsd server",
2686
+ "packets/s",
2687
+ PLUGIN_STATSD_NAME,
2688
+ "stats",
2689
+ 132014,
2690
+ statsd.update_every,
2691
+ RRDSET_TYPE_STACKED);
2692
+ rd_packets_tcp = rrddim_add(st_packets, "tcp", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
2693
+ rd_packets_udp = rrddim_add(st_packets, "udp", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
2694
+
2695
+ st_tcp_connects = rrdset_create_localhost(
2696
+ "netdata",
2697
+ "tcp_connects",
2698
+ NULL,
2699
+ "statsd",
2700
+ NULL,
2701
+ "statsd server TCP connects and disconnects",
2702
+ "events",
2703
+ PLUGIN_STATSD_NAME,
2704
+ "stats",
2705
+ 132015,
2706
+ statsd.update_every,
2707
+ RRDSET_TYPE_LINE);
2708
+ rd_tcp_connects = rrddim_add(st_tcp_connects, "connects", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
2709
+ rd_tcp_disconnects = rrddim_add(st_tcp_connects, "disconnects", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
2710
+
2711
+ st_tcp_connected = rrdset_create_localhost(
2712
+ "netdata",
2713
+ "tcp_connected",
2714
+ NULL,
2715
+ "statsd",
2716
+ NULL,
2717
+ "statsd server TCP connected sockets",
2718
+ "sockets",
2719
+ PLUGIN_STATSD_NAME,
2720
+ "stats",
2721
+ 132016,
2722
+ statsd.update_every,
2723
+ RRDSET_TYPE_LINE);
2724
+ rd_tcp_connected = rrddim_add(st_tcp_connected, "connected", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
2725
+
2726
+ st_pcharts = rrdset_create_localhost(
2727
+ "netdata",
2728
+ "private_charts",
2729
+ NULL,
2730
+ "statsd",
2731
+ NULL,
2732
+ "Private metric charts created by the netdata statsd server",
2733
+ "charts",
2734
+ PLUGIN_STATSD_NAME,
2735
+ "stats",
2736
+ 132020,
2737
+ statsd.update_every,
2738
+ RRDSET_TYPE_AREA);
2739
+ rd_pcharts = rrddim_add(st_pcharts, "charts", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
2740
+ }
2741
2742
// ----------------------------------------------------------------------------------------------------------------
2743
// statsd thread to turn metrics into charts
@@ -2740,68 +2776,70 @@ void *statsd_main(void *ptr) {
2776
if(unlikely(netdata_exit))
2777
break;
2778
2743
- if(likely(hb_dt)) {
2744
- rrdset_next(st_metrics);
2745
- rrdset_next(st_useful_metrics);
2746
- rrdset_next(st_events);
2747
- rrdset_next(st_reads);
2748
- rrdset_next(st_bytes);
2749
- rrdset_next(st_packets);
2750
- rrdset_next(st_tcp_connects);
2751
- rrdset_next(st_tcp_connected);
2752
- rrdset_next(st_pcharts);
2753
- }
2779
+ if(global_statistics_enabled) {
2780
+ if(likely(hb_dt)) {
2781
+ rrdset_next(st_metrics);
2782
+ rrdset_next(st_useful_metrics);
2783
+ rrdset_next(st_events);
2784
+ rrdset_next(st_reads);
2785
+ rrdset_next(st_bytes);
2786
+ rrdset_next(st_packets);
2787
+ rrdset_next(st_tcp_connects);
2788
+ rrdset_next(st_tcp_connected);
2789
+ rrdset_next(st_pcharts);
2790
+ }
2791
2755
- rrddim_set_by_pointer(st_metrics, rd_metrics_gauge, (collected_number)statsd.gauges.metrics);
2756
- rrddim_set_by_pointer(st_metrics, rd_metrics_counter, (collected_number)statsd.counters.metrics);
2757
- rrddim_set_by_pointer(st_metrics, rd_metrics_timer, (collected_number)statsd.timers.metrics);
2758
- rrddim_set_by_pointer(st_metrics, rd_metrics_meter, (collected_number)statsd.meters.metrics);
2759
- rrddim_set_by_pointer(st_metrics, rd_metrics_histogram, (collected_number)statsd.histograms.metrics);
2760
- rrddim_set_by_pointer(st_metrics, rd_metrics_set, (collected_number)statsd.sets.metrics);
2761
- rrddim_set_by_pointer(st_metrics, rd_metrics_dictionary, (collected_number)statsd.dictionaries.metrics);
2762
- rrdset_done(st_metrics);
2763
-
2764
- rrddim_set_by_pointer(st_useful_metrics, rd_useful_metrics_gauge, (collected_number)statsd.gauges.useful);
2765
- rrddim_set_by_pointer(st_useful_metrics, rd_useful_metrics_counter, (collected_number)statsd.counters.useful);
2766
- rrddim_set_by_pointer(st_useful_metrics, rd_useful_metrics_timer, (collected_number)statsd.timers.useful);
2767
- rrddim_set_by_pointer(st_useful_metrics, rd_useful_metrics_meter, (collected_number)statsd.meters.useful);
2768
- rrddim_set_by_pointer(st_useful_metrics, rd_useful_metrics_histogram, (collected_number)statsd.histograms.useful);
2769
- rrddim_set_by_pointer(st_useful_metrics, rd_useful_metrics_set, (collected_number)statsd.sets.useful);
2770
- rrddim_set_by_pointer(st_useful_metrics, rd_useful_metrics_dictionary, (collected_number)statsd.dictionaries.useful);
2771
- rrdset_done(st_useful_metrics);
2772
-
2773
- rrddim_set_by_pointer(st_events, rd_events_gauge, (collected_number)statsd.gauges.events);
2774
- rrddim_set_by_pointer(st_events, rd_events_counter, (collected_number)statsd.counters.events);
2775
- rrddim_set_by_pointer(st_events, rd_events_timer, (collected_number)statsd.timers.events);
2776
- rrddim_set_by_pointer(st_events, rd_events_meter, (collected_number)statsd.meters.events);
2777
- rrddim_set_by_pointer(st_events, rd_events_histogram, (collected_number)statsd.histograms.events);
2778
- rrddim_set_by_pointer(st_events, rd_events_set, (collected_number)statsd.sets.events);
2779
- rrddim_set_by_pointer(st_events, rd_events_dictionary, (collected_number)statsd.dictionaries.events);
2780
- rrddim_set_by_pointer(st_events, rd_events_unknown, (collected_number)statsd.unknown_types);
2781
- rrddim_set_by_pointer(st_events, rd_events_errors, (collected_number)statsd.socket_errors);
2782
- rrdset_done(st_events);
2783
-
2784
- rrddim_set_by_pointer(st_reads, rd_reads_tcp, (collected_number)statsd.tcp_socket_reads);
2785
- rrddim_set_by_pointer(st_reads, rd_reads_udp, (collected_number)statsd.udp_socket_reads);
2786
- rrdset_done(st_reads);
2787
-
2788
- rrddim_set_by_pointer(st_bytes, rd_bytes_tcp, (collected_number)statsd.tcp_bytes_read);
2789
- rrddim_set_by_pointer(st_bytes, rd_bytes_udp, (collected_number)statsd.udp_bytes_read);
2790
- rrdset_done(st_bytes);
2791
-
2792
- rrddim_set_by_pointer(st_packets, rd_packets_tcp, (collected_number)statsd.tcp_packets_received);
2793
- rrddim_set_by_pointer(st_packets, rd_packets_udp, (collected_number)statsd.udp_packets_received);
2794
- rrdset_done(st_packets);
2795
-
2796
- rrddim_set_by_pointer(st_tcp_connects, rd_tcp_connects, (collected_number)statsd.tcp_socket_connects);
2797
- rrddim_set_by_pointer(st_tcp_connects, rd_tcp_disconnects, (collected_number)statsd.tcp_socket_disconnects);
2798
- rrdset_done(st_tcp_connects);
2799
-
2800
- rrddim_set_by_pointer(st_tcp_connected, rd_tcp_connected, (collected_number)statsd.tcp_socket_connected);
2801
- rrdset_done(st_tcp_connected);
2802
-
2803
- rrddim_set_by_pointer(st_pcharts, rd_pcharts, (collected_number)statsd.private_charts);
2804
- rrdset_done(st_pcharts);
2792
+ rrddim_set_by_pointer(st_metrics, rd_metrics_gauge, (collected_number)statsd.gauges.metrics);
2793
+ rrddim_set_by_pointer(st_metrics, rd_metrics_counter, (collected_number)statsd.counters.metrics);
2794
+ rrddim_set_by_pointer(st_metrics, rd_metrics_timer, (collected_number)statsd.timers.metrics);
2795
+ rrddim_set_by_pointer(st_metrics, rd_metrics_meter, (collected_number)statsd.meters.metrics);
2796
+ rrddim_set_by_pointer(st_metrics, rd_metrics_histogram, (collected_number)statsd.histograms.metrics);
2797
+ rrddim_set_by_pointer(st_metrics, rd_metrics_set, (collected_number)statsd.sets.metrics);
2798
+ rrddim_set_by_pointer(st_metrics, rd_metrics_dictionary, (collected_number)statsd.dictionaries.metrics);
2799
+ rrdset_done(st_metrics);
2800
+
2801
+ rrddim_set_by_pointer(st_useful_metrics, rd_useful_metrics_gauge, (collected_number)statsd.gauges.useful);
2802
+ rrddim_set_by_pointer(st_useful_metrics, rd_useful_metrics_counter, (collected_number)statsd.counters.useful);
2803
+ rrddim_set_by_pointer(st_useful_metrics, rd_useful_metrics_timer, (collected_number)statsd.timers.useful);
2804
+ rrddim_set_by_pointer(st_useful_metrics, rd_useful_metrics_meter, (collected_number)statsd.meters.useful);
2805
+ rrddim_set_by_pointer(st_useful_metrics, rd_useful_metrics_histogram, (collected_number)statsd.histograms.useful);
2806
+ rrddim_set_by_pointer(st_useful_metrics, rd_useful_metrics_set, (collected_number)statsd.sets.useful);
2807
+ rrddim_set_by_pointer(st_useful_metrics, rd_useful_metrics_dictionary, (collected_number)statsd.dictionaries.useful);
2808
+ rrdset_done(st_useful_metrics);
2809
+
2810
+ rrddim_set_by_pointer(st_events, rd_events_gauge, (collected_number)statsd.gauges.events);
2811
+ rrddim_set_by_pointer(st_events, rd_events_counter, (collected_number)statsd.counters.events);
2812
+ rrddim_set_by_pointer(st_events, rd_events_timer, (collected_number)statsd.timers.events);
2813
+ rrddim_set_by_pointer(st_events, rd_events_meter, (collected_number)statsd.meters.events);
2814
+ rrddim_set_by_pointer(st_events, rd_events_histogram, (collected_number)statsd.histograms.events);
2815
+ rrddim_set_by_pointer(st_events, rd_events_set, (collected_number)statsd.sets.events);
2816
+ rrddim_set_by_pointer(st_events, rd_events_dictionary, (collected_number)statsd.dictionaries.events);
2817
+ rrddim_set_by_pointer(st_events, rd_events_unknown, (collected_number)statsd.unknown_types);
2818
+ rrddim_set_by_pointer(st_events, rd_events_errors, (collected_number)statsd.socket_errors);
2819
+ rrdset_done(st_events);
2820
+
2821
+ rrddim_set_by_pointer(st_reads, rd_reads_tcp, (collected_number)statsd.tcp_socket_reads);
2822
+ rrddim_set_by_pointer(st_reads, rd_reads_udp, (collected_number)statsd.udp_socket_reads);
2823
+ rrdset_done(st_reads);
2824
+
2825
+ rrddim_set_by_pointer(st_bytes, rd_bytes_tcp, (collected_number)statsd.tcp_bytes_read);
2826
+ rrddim_set_by_pointer(st_bytes, rd_bytes_udp, (collected_number)statsd.udp_bytes_read);
2827
+ rrdset_done(st_bytes);
2828
+
2829
+ rrddim_set_by_pointer(st_packets, rd_packets_tcp, (collected_number)statsd.tcp_packets_received);
2830
+ rrddim_set_by_pointer(st_packets, rd_packets_udp, (collected_number)statsd.udp_packets_received);
2831
+ rrdset_done(st_packets);
2832
+
2833
+ rrddim_set_by_pointer(st_tcp_connects, rd_tcp_connects, (collected_number)statsd.tcp_socket_connects);
2834
+ rrddim_set_by_pointer(st_tcp_connects, rd_tcp_disconnects, (collected_number)statsd.tcp_socket_disconnects);
2835
+ rrdset_done(st_tcp_connects);
2836
+
2837
+ rrddim_set_by_pointer(st_tcp_connected, rd_tcp_connected, (collected_number)statsd.tcp_socket_connected);
2838
+ rrdset_done(st_tcp_connected);
2839
+
2840
+ rrddim_set_by_pointer(st_pcharts, rd_pcharts, (collected_number)statsd.private_charts);
2841
+ rrdset_done(st_pcharts);
2842
+ }
2843
}
2844
2845
cleanup: ; // added semi-colon to prevent older gcc error: label at end of compound statement
daemon/global_statistics.c
+2
@@ -17,6 +17,8 @@
17
#error WORKER_UTILIZATION_MAX_JOB_TYPES has to be at least 5
18
#endif
19
20
+bool global_statistics_enabled = true;
21
+
22
static struct global_statistics {
23
volatile uint16_t connected_clients;
24
daemon/global_statistics.h
+2
@@ -21,4 +21,6 @@ void finished_web_request_statistics(uint64_t dt,
21
uint64_t web_client_connected(void);
22
void web_client_disconnected(void);
23
24
+extern bool global_statistics_enabled;
25
+
26
#endif /* NETDATA_GLOBAL_STATISTICS_H */
daemon/main.c
+6
-1
@@ -1421,8 +1421,13 @@ int main(int argc, char **argv) {
1421
1422
if(st->enabled && st->init_routine)
1423
st->init_routine();
1424
- }
1424
1425
+ if(st->env_name)
1426
+ setenv(st->env_name, st->enabled?"YES":"NO", 1);
1427
+
1428
+ if(st->global_variable)
1429
+ *st->global_variable = (st->enabled) ? true : false;
1430
+ }
1431
1432
// --------------------------------------------------------------------
1433
// create the listening sockets
daemon/static_threads.c
+17
-3
@@ -13,6 +13,8 @@ extern void *service_main(void *ptr);
13
extern void *statsd_main(void *ptr);
14
extern void *timex_main(void *ptr);
15
16
+extern bool global_statistics_enabled;
17
+
18
const struct netdata_static_thread static_threads_common[] = {
19
{
20
.name = "PLUGIN[timex]",
@@ -52,8 +54,10 @@ const struct netdata_static_thread static_threads_common[] = {
54
},
55
{
56
.name = "GLOBAL_STATS",
55
- .config_section = NULL,
56
- .config_name = NULL,
57
+ .config_section = CONFIG_SECTION_PLUGINS,
58
+ .config_name = "netdata monitoring",
59
+ .env_name = "NETDATA_INTERNALS_MONITORING",
60
+ .global_variable = &global_statistics_enabled,
61
.enabled = 1,
62
.thread = NULL,
63
.init_routine = NULL,
@@ -145,7 +149,17 @@ const struct netdata_static_thread static_threads_common[] = {
149
.start_routine = rrdcontext_main
150
},
151
148
- {NULL, NULL, NULL, 0, NULL, NULL, NULL}
152
+ // terminator
153
+ {
154
+ .name = NULL,
155
+ .config_section = NULL,
156
+ .config_name = NULL,
157
+ .env_name = NULL,
158
+ .enabled = 0,
159
+ .thread = NULL,
160
+ .init_routine = NULL,
161
+ .start_routine = NULL
162
+ }
163
};
164
165
struct netdata_static_thread *
daemon/static_threads.h
+6
@@ -26,6 +26,12 @@ struct netdata_static_thread {
26
27
// the threaded worker
28
void *(*start_routine) (void *);
29
+
30
+ // the environment variable to create
31
+ char *env_name;
32
+
33
+ // global variable
34
+ bool *global_variable;
35
};
36
37
#define NETDATA_MAIN_THREAD_RUNNING CONFIG_BOOLEAN_YES
daemon/static_threads_linux.c
+33
-3
@@ -46,15 +46,45 @@ const struct netdata_static_thread static_threads_linux[] = {
46
.start_routine = cgroups_main
47
},
48
49
- {NULL, NULL, NULL, 0, NULL, NULL, NULL}
49
+ // terminator
50
+ {
51
+ .name = NULL,
52
+ .config_section = NULL,
53
+ .config_name = NULL,
54
+ .env_name = NULL,
55
+ .enabled = 0,
56
+ .thread = NULL,
57
+ .init_routine = NULL,
58
+ .start_routine = NULL
59
+ }
60
};
61
62
const struct netdata_static_thread static_threads_freebsd[] = {
53
- {NULL, NULL, NULL, 0, NULL, NULL, NULL}
63
+ // terminator
64
+ {
65
+ .name = NULL,
66
+ .config_section = NULL,
67
+ .config_name = NULL,
68
+ .env_name = NULL,
69
+ .enabled = 0,
70
+ .thread = NULL,
71
+ .init_routine = NULL,
72
+ .start_routine = NULL
73
+ }
74
};
75
76
const struct netdata_static_thread static_threads_macos[] = {
57
- {NULL, NULL, NULL, 0, NULL, NULL, NULL}
77
+ // terminator
78
+ {
79
+ .name = NULL,
80
+ .config_section = NULL,
81
+ .config_name = NULL,
82
+ .env_name = NULL,
83
+ .enabled = 0,
84
+ .thread = NULL,
85
+ .init_routine = NULL,
86
+ .start_routine = NULL
87
+ }
88
};
89
90
struct netdata_static_thread *static_threads_get() {
exporting/send_internal_metrics.c
+9
@@ -11,6 +11,9 @@
11
*/
12
void create_main_rusage_chart(RRDSET **st_rusage, RRDDIM **rd_user, RRDDIM **rd_system)
13
{
14
+ if (!global_statistics_enabled)
15
+ return;
16
+
17
if (*st_rusage && *rd_user && *rd_system)
18
return;
19
@@ -31,6 +34,9 @@ void create_main_rusage_chart(RRDSET **st_rusage, RRDDIM **rd_user, RRDDIM **rd_
34
*/
35
void send_main_rusage(RRDSET *st_rusage, RRDDIM *rd_user, RRDDIM *rd_system)
36
{
37
+ if (!global_statistics_enabled)
38
+ return;
39
+
40
struct rusage thread;
41
getrusage(RUSAGE_THREAD, &thread);
42
@@ -52,6 +58,9 @@ void send_main_rusage(RRDSET *st_rusage, RRDDIM *rd_user, RRDDIM *rd_system)
58
*/
59
void send_internal_metrics(struct instance *instance)
60
{
61
+ if (!global_statistics_enabled)
62
+ return;
63
+
64
struct stats *stats = &instance->stats;
65
66
// ------------------------------------------------------------------------