master
h 107 lines 2.58 KB
Raw
1 // SPDX-License-Identifier: GPL-3.0-or-later
2
3 #ifndef NETDATA_COMMON_H
4 #define NETDATA_COMMON_H 1
5
6 #ifdef __cplusplus
7 extern "C" {
8 #endif
9
10 #include "libnetdata/libnetdata.h"
11 #include "config/netdata-conf.h"
12 #include "libuv_workers.h"
13
14 // ----------------------------------------------------------------------------
15 // netdata include files
16
17 #include "web/api/maps/maps.h"
18
19 #include "daemon/config/netdata-conf.h"
20 #include "daemon/dyncfg/dyncfg.h"
21
22 #include "daemon/pulse/pulse.h"
23
24 // health monitoring and alarm notifications
25 #include "health/health.h"
26
27 // the netdata database
28 #include "database/rrd.h"
29
30 // the netdata webserver(s)
31 #include "web/server/web_server.h"
32
33 // streaming metrics between netdata servers
34 #include "streaming/stream.h"
35
36 // anomaly detection
37 #include "ml/ml_public.h"
38
39 // the netdata registry
40 // the registry is actually an API feature
41 #include "registry/registry.h"
42
43 // exporting engine for archiving the metrics
44 #include "exporting/exporting_engine.h"
45
46 // the netdata API
47 #include "web/server/web_client.h"
48 #include "web/rtc/webrtc.h"
49
50 // all data collection plugins
51 #include "collectors/all.h"
52
53 // netdata unit tests
54 #include "unit_test.h"
55
56 // netdata agent claiming
57 #include "claim/claim.h"
58
59 // netdata agent cloud link
60 #include "aclk/aclk.h"
61
62 // global GUID map functions
63
64 // the netdata daemon
65 #include "daemon.h"
66 #include "main.h"
67 #include "static_threads.h"
68 #include "signal-handler.h"
69 #include "commands.h"
70 #include "pipename.h"
71 #include "analytics.h"
72
73 // global netdata daemon variables
74 extern bool netdata_anonymous_statistics_enabled;
75
76 // Thread-safe system timezone access.
77 // Use system_tz_get() to read; the returned struct owns strdup'd copies
78 // that must be released with system_tz_free().
79 // Use system_tz_set() to write (called by timezone detection and periodic refresh).
80 typedef struct {
81 char *timezone; // IANA timezone name, e.g. "America/New_York" (owned, strdup'd)
82 char *abbrev_timezone; // abbreviated timezone, e.g. "EDT" (owned, strdup'd)
83 int32_t utc_offset; // offset from UTC in seconds
84 } SYSTEM_TZ;
85
86 SYSTEM_TZ system_tz_get(void);
87 void system_tz_set(const char *timezone, const char *abbrev_timezone, int32_t utc_offset);
88 void system_tz_free(SYSTEM_TZ *tz);
89
90 extern bool netdata_ready;
91 extern time_t netdata_start_time;
92
93 static inline bool netdata_ready_load(void) {
94 return __atomic_load_n(&netdata_ready, __ATOMIC_ACQUIRE);
95 }
96
97 static inline void netdata_ready_store(bool ready) {
98 __atomic_store_n(&netdata_ready, ready, __ATOMIC_RELEASE);
99 }
100
101 void set_environment_for_plugins_and_scripts(void);
102
103 #ifdef __cplusplus
104 }
105 #endif
106
107 #endif /* NETDATA_COMMON_H */