mirror of
https://github.com/netdata/netdata.git
synced 2025-04-25 05:31:37 +00:00

* split rrdfunctions streaming and progress * simplified internal inline functions API * split rrdfunctions inflight management * split rrd functions exporters * renames * base dyncfg structure * config pluginsd * intercept dyncfg function calls * loading and saving of dyncfg metadata and data * save metadata and payload to a single file; added code to update the plugins with jobs and saved configs * basic working unit test * added payload to functions execution * removed old dyncfg code that is not needed any more * more cleanup * cleanup sender for functions with payload * dyncfg functions are not exposed as functions * remaining work to avoid indexing the \0 terminating character in dictionary keys * added back old dyncfg plugins.d commands as noop, to allow plugins continue working * working api; working streaming; * updated plugins.d documentation * aclk and http api requests share the same header parsing logic * added source type internal * fixed crashes * added god mode for tests * fixes * fixed messages * save host machine guids to configs * cleaner manipulation of supported commands * the functions event loop for external plugins can now process dyncfg requests * unified internal and external plugins dyncfg API * Netdata serves schema requests from /etc/netdata/schema.d and /var/lib/netdata/conf.d/schema.d * cleanup and various fixes; fixed bug in previous dyncfg implementation on streaming that was sending the paylod in a way that allowed other streaming commands to be multiplexed * internals go to a separate header file * fix duplicate ACLK requests sent by aclk queue mechanism * use fstat instead of stat * working api * plugin actions renamed to create and delete; dyncfg files are removed only from user actions * prevent deadlock by using the react callback * fix for string_strndupz() * better dyncfg unittests * more tests at the unittests * properly detect dyncfg functions * hide config functions from the UI * tree response improvements * send the initial update with payload * determine tty using stdout, not stderr * changes to statuses, cleanup and the code to bring all business logic into interception * do not crash when the status is empty * functions now propagate the source of the requests to plugins * avoid warning about unused functions * in the count at items for attention, do not count the orphan entries * save source into dyncfg * make the list null terminated * fixed invalid comparison * prevent memory leak on duplicated headers; log x-forwarded-for * more unit tests * added dyncfg unittests into the default unittests * more unit tests and fixes * more unit tests and fixes * fix dictionary unittests * config functions require admin access
233 lines
6.1 KiB
C
233 lines
6.1 KiB
C
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
#include "common.h"
|
|
|
|
void *aclk_main(void *ptr);
|
|
void *analytics_main(void *ptr);
|
|
void *cpuidlejitter_main(void *ptr);
|
|
void *global_statistics_main(void *ptr);
|
|
void *global_statistics_workers_main(void *ptr);
|
|
void *global_statistics_sqlite3_main(void *ptr);
|
|
void *health_main(void *ptr);
|
|
void *pluginsd_main(void *ptr);
|
|
void *service_main(void *ptr);
|
|
void *statsd_main(void *ptr);
|
|
void *timex_main(void *ptr);
|
|
void *profile_main(void *ptr);
|
|
void *replication_thread_main(void *ptr __maybe_unused);
|
|
|
|
extern bool global_statistics_enabled;
|
|
|
|
const struct netdata_static_thread static_threads_common[] = {
|
|
{
|
|
.name = "P[timex]",
|
|
.config_section = CONFIG_SECTION_PLUGINS,
|
|
.config_name = "timex",
|
|
.enabled = 1,
|
|
.thread = NULL,
|
|
.init_routine = NULL,
|
|
.start_routine = timex_main
|
|
},
|
|
{
|
|
.name = "P[idlejitter]",
|
|
.config_section = CONFIG_SECTION_PLUGINS,
|
|
.config_name = "idlejitter",
|
|
.enabled = 1,
|
|
.thread = NULL,
|
|
.init_routine = NULL,
|
|
.start_routine = cpuidlejitter_main
|
|
},
|
|
{
|
|
.name = "HEALTH",
|
|
.config_section = NULL,
|
|
.config_name = NULL,
|
|
.enabled = 1,
|
|
.thread = NULL,
|
|
.init_routine = NULL,
|
|
.start_routine = health_main
|
|
},
|
|
{
|
|
.name = "ANALYTICS",
|
|
.config_section = NULL,
|
|
.config_name = NULL,
|
|
.enabled = 0,
|
|
.thread = NULL,
|
|
.init_routine = NULL,
|
|
.start_routine = analytics_main
|
|
},
|
|
{
|
|
.name = "STATS_GLOBAL",
|
|
.config_section = CONFIG_SECTION_PLUGINS,
|
|
.config_name = "netdata monitoring",
|
|
.env_name = "NETDATA_INTERNALS_MONITORING",
|
|
.global_variable = &global_statistics_enabled,
|
|
.enabled = 0,
|
|
.thread = NULL,
|
|
.init_routine = NULL,
|
|
.start_routine = global_statistics_main
|
|
},
|
|
{
|
|
.name = "STATS_WORKERS",
|
|
.config_section = CONFIG_SECTION_PLUGINS,
|
|
.config_name = "netdata monitoring extended",
|
|
.env_name = "NETDATA_INTERNALS_MONITORING",
|
|
.global_variable = &global_statistics_enabled,
|
|
.enabled = 0, // this is ignored - check main() for "netdata monitoring extended"
|
|
.thread = NULL,
|
|
.init_routine = NULL,
|
|
.start_routine = global_statistics_workers_main
|
|
},
|
|
{
|
|
.name = "STATS_SQLITE3",
|
|
.config_section = CONFIG_SECTION_PLUGINS,
|
|
.config_name = "netdata monitoring extended",
|
|
.env_name = "NETDATA_INTERNALS_MONITORING",
|
|
.global_variable = &global_statistics_enabled,
|
|
.enabled = 0, // this is ignored - check main() for "netdata monitoring extended"
|
|
.thread = NULL,
|
|
.init_routine = NULL,
|
|
.start_routine = global_statistics_sqlite3_main
|
|
},
|
|
{
|
|
.name = "PLUGINSD",
|
|
.config_section = NULL,
|
|
.config_name = NULL,
|
|
.enabled = 1,
|
|
.thread = NULL,
|
|
.init_routine = NULL,
|
|
.start_routine = pluginsd_main
|
|
},
|
|
{
|
|
.name = "SERVICE",
|
|
.config_section = NULL,
|
|
.config_name = NULL,
|
|
.enabled = 1,
|
|
.thread = NULL,
|
|
.init_routine = NULL,
|
|
.start_routine = service_main
|
|
},
|
|
{
|
|
.name = "STATSD_FLUSH",
|
|
.config_section = NULL,
|
|
.config_name = NULL,
|
|
.enabled = 1,
|
|
.thread = NULL,
|
|
.init_routine = NULL,
|
|
.start_routine = statsd_main
|
|
},
|
|
{
|
|
.name = "EXPORTING",
|
|
.config_section = NULL,
|
|
.config_name = NULL,
|
|
.enabled = 1,
|
|
.thread = NULL,
|
|
.init_routine = NULL,
|
|
.start_routine = exporting_main
|
|
},
|
|
{
|
|
.name = "SNDR[localhost]",
|
|
.config_section = NULL,
|
|
.config_name = NULL,
|
|
.enabled = 0,
|
|
.thread = NULL,
|
|
.init_routine = NULL,
|
|
.start_routine = rrdpush_sender_thread
|
|
},
|
|
{
|
|
.name = "WEB[1]",
|
|
.config_section = NULL,
|
|
.config_name = NULL,
|
|
.enabled = 0,
|
|
.thread = NULL,
|
|
.init_routine = NULL,
|
|
.start_routine = socket_listen_main_static_threaded
|
|
},
|
|
|
|
#ifdef ENABLE_H2O
|
|
{
|
|
.name = "h2o",
|
|
.config_section = NULL,
|
|
.config_name = NULL,
|
|
.enabled = 0,
|
|
.thread = NULL,
|
|
.init_routine = NULL,
|
|
.start_routine = h2o_main
|
|
},
|
|
#endif
|
|
|
|
#ifdef ENABLE_ACLK
|
|
{
|
|
.name = "ACLK_MAIN",
|
|
.config_section = NULL,
|
|
.config_name = NULL,
|
|
.enabled = 1,
|
|
.thread = NULL,
|
|
.init_routine = NULL,
|
|
.start_routine = aclk_main
|
|
},
|
|
#endif
|
|
|
|
{
|
|
.name = "RRDCONTEXT",
|
|
.config_section = NULL,
|
|
.config_name = NULL,
|
|
.enabled = 1,
|
|
.thread = NULL,
|
|
.init_routine = NULL,
|
|
.start_routine = rrdcontext_main
|
|
},
|
|
|
|
{
|
|
.name = "REPLAY[1]",
|
|
.config_section = NULL,
|
|
.config_name = NULL,
|
|
.enabled = 1,
|
|
.thread = NULL,
|
|
.init_routine = NULL,
|
|
.start_routine = replication_thread_main
|
|
},
|
|
{
|
|
.name = "P[PROFILE]",
|
|
.config_section = CONFIG_SECTION_PLUGINS,
|
|
.config_name = "profile",
|
|
.enabled = 0,
|
|
.thread = NULL,
|
|
.init_routine = NULL,
|
|
.start_routine = profile_main
|
|
},
|
|
|
|
// 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_concat(const struct netdata_static_thread *lhs,
|
|
const struct netdata_static_thread *rhs)
|
|
{
|
|
struct netdata_static_thread *res;
|
|
|
|
int lhs_size = 0;
|
|
for (; lhs[lhs_size].name; lhs_size++) {}
|
|
|
|
int rhs_size = 0;
|
|
for (; rhs[rhs_size].name; rhs_size++) {}
|
|
|
|
res = callocz(lhs_size + rhs_size + 1, sizeof(struct netdata_static_thread));
|
|
|
|
for (int i = 0; i != lhs_size; i++)
|
|
memcpy(&res[i], &lhs[i], sizeof(struct netdata_static_thread));
|
|
|
|
for (int i = 0; i != rhs_size; i++)
|
|
memcpy(&res[lhs_size + i], &rhs[i], sizeof(struct netdata_static_thread));
|
|
|
|
return res;
|
|
}
|