mirror of
https://github.com/netdata/netdata.git
synced 2025-05-02 08:20:10 +00:00

* modularized all external plugins * added README.md in plugins * fixed title * fixed typo * relative link to external plugins * external plugins configuration README * added plugins link * remove plugins link * plugin names are links * added links to external plugins * removed unecessary spacing * list to table * added language * fixed typo * list to table on internal plugins * added more documentation to internal plugins * moved python, node, and bash code and configs into the external plugins * added statsd README * fix bug with corrupting config.h every 2nd compilation * moved all config files together with their code * more documentation * diskspace info * fixed broken links in apps.plugin * added backends docs * updated plugins readme * move nc-backend.sh to backends * created daemon directory * moved all code outside src/ * fixed readme identation * renamed plugins.d.plugin to plugins.d * updated readme * removed linux- from linux plugins * updated readme * updated readme * updated readme * updated readme * updated readme * updated readme * fixed README.md links * fixed netdata tree links * updated codacy, codeclimate and lgtm excluded paths * update CMakeLists.txt * updated automake options at top directory * libnetdata slit into directories * updated READMEs * updated READMEs * updated ARL docs * updated ARL docs * moved /plugins to /collectors * moved all external plugins outside plugins.d * updated codacy, codeclimate, lgtm * updated README * updated url * updated readme * updated readme * updated readme * updated readme * moved api and web into webserver * web/api web/gui web/server * modularized webserver * removed web/gui/version.txt
69 lines
2.3 KiB
C
69 lines
2.3 KiB
C
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
#include "plugin_macos.h"
|
|
|
|
static void macos_main_cleanup(void *ptr) {
|
|
struct netdata_static_thread *static_thread = (struct netdata_static_thread *)ptr;
|
|
static_thread->enabled = NETDATA_MAIN_THREAD_EXITING;
|
|
|
|
info("cleaning up...");
|
|
|
|
static_thread->enabled = NETDATA_MAIN_THREAD_EXITED;
|
|
}
|
|
|
|
void *macos_main(void *ptr) {
|
|
netdata_thread_cleanup_push(macos_main_cleanup, ptr);
|
|
|
|
// when ZERO, attempt to do it
|
|
int vdo_cpu_netdata = !config_get_boolean("plugin:macos", "netdata server resources", 1);
|
|
int vdo_macos_sysctl = !config_get_boolean("plugin:macos", "sysctl", 1);
|
|
int vdo_macos_mach_smi = !config_get_boolean("plugin:macos", "mach system management interface", 1);
|
|
int vdo_macos_iokit = !config_get_boolean("plugin:macos", "iokit", 1);
|
|
|
|
// keep track of the time each module was called
|
|
unsigned long long sutime_macos_sysctl = 0ULL;
|
|
unsigned long long sutime_macos_mach_smi = 0ULL;
|
|
unsigned long long sutime_macos_iokit = 0ULL;
|
|
|
|
usec_t step = localhost->rrd_update_every * USEC_PER_SEC;
|
|
heartbeat_t hb;
|
|
heartbeat_init(&hb);
|
|
|
|
while(!netdata_exit) {
|
|
usec_t hb_dt = heartbeat_next(&hb, step);
|
|
|
|
if(unlikely(netdata_exit)) break;
|
|
|
|
// BEGIN -- the job to be done
|
|
|
|
if(!vdo_macos_sysctl) {
|
|
debug(D_PROCNETDEV_LOOP, "MACOS: calling do_macos_sysctl().");
|
|
vdo_macos_sysctl = do_macos_sysctl(localhost->rrd_update_every, hb_dt);
|
|
}
|
|
if(unlikely(netdata_exit)) break;
|
|
|
|
if(!vdo_macos_mach_smi) {
|
|
debug(D_PROCNETDEV_LOOP, "MACOS: calling do_macos_mach_smi().");
|
|
vdo_macos_mach_smi = do_macos_mach_smi(localhost->rrd_update_every, hb_dt);
|
|
}
|
|
if(unlikely(netdata_exit)) break;
|
|
|
|
if(!vdo_macos_iokit) {
|
|
debug(D_PROCNETDEV_LOOP, "MACOS: calling do_macos_iokit().");
|
|
vdo_macos_iokit = do_macos_iokit(localhost->rrd_update_every, hb_dt);
|
|
}
|
|
if(unlikely(netdata_exit)) break;
|
|
|
|
// END -- the job is done
|
|
|
|
// --------------------------------------------------------------------
|
|
|
|
if(!vdo_cpu_netdata) {
|
|
global_statistics_charts();
|
|
registry_statistics();
|
|
}
|
|
}
|
|
|
|
netdata_thread_cleanup_pop(1);
|
|
return NULL;
|
|
}
|