summaryrefslogtreecommitdiffstats
path: root/daemon
diff options
context:
space:
mode:
authorCosta Tsaousis <costa@netdata.cloud>2022-10-13 08:12:52 +0300
committerGitHub <noreply@github.com>2022-10-13 08:12:52 +0300
commit61767a8a08d089962ff82e45b3e459c8bd05b0c4 (patch)
tree427ae61c25efa1fc4cbc3d9987e6b7b439fa8e32 /daemon
parentafe1b704857a7307547341a1027c019bbe68e910 (diff)
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>
Diffstat (limited to 'daemon')
-rw-r--r--daemon/global_statistics.c2
-rw-r--r--daemon/global_statistics.h2
-rw-r--r--daemon/main.c7
-rw-r--r--daemon/static_threads.c20
-rw-r--r--daemon/static_threads.h6
-rw-r--r--daemon/static_threads_linux.c36
6 files changed, 66 insertions, 7 deletions
diff --git a/daemon/global_statistics.c b/daemon/global_statistics.c
index 79e0bb7711..62997cb785 100644
--- a/daemon/global_statistics.c
+++ b/daemon/global_statistics.c
@@ -17,6 +17,8 @@
#error WORKER_UTILIZATION_MAX_JOB_TYPES has to be at least 5
#endif
+bool global_statistics_enabled = true;
+
static struct global_statistics {
volatile uint16_t connected_clients;
diff --git a/daemon/global_statistics.h b/daemon/global_statistics.h
index a54610b0ed..1ccc02e716 100644
--- a/daemon/global_statistics.h
+++ b/daemon/global_statistics.h
@@ -21,4 +21,6 @@ void finished_web_request_statistics(uint64_t dt,
uint64_t web_client_connected(void);
void web_client_disconnected(void);
+extern bool global_statistics_enabled;
+
#endif /* NETDATA_GLOBAL_STATISTICS_H */
diff --git a/daemon/main.c b/daemon/main.c
index ddbec32408..df93bfa25b 100644
--- a/daemon/main.c
+++ b/daemon/main.c
@@ -1421,8 +1421,13 @@ int main(int argc, char **argv) {
if(st->enabled && st->init_routine)
st->init_routine();
- }
+ if(st->env_name)
+ setenv(st->env_name, st->enabled?"YES":"NO", 1);
+
+ if(st->global_variable)
+ *st->global_variable = (st->enabled) ? true : false;
+ }
// --------------------------------------------------------------------
// create the listening sockets
diff --git a/daemon/static_threads.c b/daemon/static_threads.c
index 2575bd4ca6..1e319cf59e 100644
--- a/daemon/static_threads.c
+++ b/daemon/static_threads.c
@@ -13,6 +13,8 @@ extern void *service_main(void *ptr);
extern void *statsd_main(void *ptr);
extern void *timex_main(void *ptr);
+extern bool global_statistics_enabled;
+
const struct netdata_static_thread static_threads_common[] = {
{
.name = "PLUGIN[timex]",
@@ -52,8 +54,10 @@ const struct netdata_static_thread static_threads_common[] = {
},
{
.name = "GLOBAL_STATS",
- .config_section = NULL,
- .config_name = NULL,
+ .config_section = CONFIG_SECTION_PLUGINS,
+ .config_name = "netdata monitoring",
+ .env_name = "NETDATA_INTERNALS_MONITORING",
+ .global_variable = &global_statistics_enabled,
.enabled = 1,
.thread = NULL,
.init_routine = NULL,
@@ -145,7 +149,17 @@ const struct netdata_static_thread static_threads_common[] = {
.start_routine = rrdcontext_main
},
- {NULL, NULL, NULL, 0, NULL, NULL, NULL}
+ // terminator
+ {
+ .name = NULL,
+ .config_section = NULL,
+ .config_name = NULL,
+ .env_name = NULL,
+ .enabled = 0,
+ .thread = NULL,
+ .init_routine = NULL,
+ .start_routine = NULL
+ }
};
struct netdata_static_thread *
diff --git a/daemon/static_threads.h b/daemon/static_threads.h
index dac615e76d..9597da7047 100644
--- a/daemon/static_threads.h
+++ b/daemon/static_threads.h
@@ -26,6 +26,12 @@ struct netdata_static_thread {
// the threaded worker
void *(*start_routine) (void *);
+
+ // the environment variable to create
+ char *env_name;
+
+ // global variable
+ bool *global_variable;
};
#define NETDATA_MAIN_THREAD_RUNNING CONFIG_BOOLEAN_YES
diff --git a/daemon/static_threads_linux.c b/daemon/static_threads_linux.c
index 5f7a67768e..260b2c176a 100644
--- a/daemon/static_threads_linux.c
+++ b/daemon/static_threads_linux.c
@@ -46,15 +46,45 @@ const struct netdata_static_thread static_threads_linux[] = {
.start_routine = cgroups_main
},
- {NULL, NULL, NULL, 0, NULL, NULL, NULL}
+ // terminator
+ {
+ .name = NULL,
+ .config_section = NULL,
+ .config_name = NULL,
+ .env_name = NULL,
+ .enabled = 0,
+ .thread = NULL,
+ .init_routine = NULL,
+ .start_routine = NULL
+ }
};
const struct netdata_static_thread static_threads_freebsd[] = {
- {NULL, NULL, NULL, 0, NULL, NULL, NULL}
+ // terminator
+ {
+ .name = NULL,
+ .config_section = NULL,
+ .config_name = NULL,
+ .env_name = NULL,
+ .enabled = 0,
+ .thread = NULL,
+ .init_routine = NULL,
+ .start_routine = NULL
+ }
};
const struct netdata_static_thread static_threads_macos[] = {
- {NULL, NULL, NULL, 0, NULL, NULL, NULL}
+ // terminator
+ {
+ .name = NULL,
+ .config_section = NULL,
+ .config_name = NULL,
+ .env_name = NULL,
+ .enabled = 0,
+ .thread = NULL,
+ .init_routine = NULL,
+ .start_routine = NULL
+ }
};
struct netdata_static_thread *static_threads_get() {