master
h 55 lines 1.72 KB
Raw
1 // SPDX-License-Identifier: GPL-3.0-or-later
2
3 #ifndef NETDATA_PLUGINS_D_H
4 #define NETDATA_PLUGINS_D_H 1
5
6 #include "libnetdata/libnetdata.h"
7
8 struct rrdhost;
9
10 #define PLUGINSD_CMD_MAX (FILENAME_MAX*2)
11 #define PLUGINSD_STOCK_PLUGINS_DIRECTORY_PATH 0
12
13 #define PLUGINSD_MAX_DIRECTORIES 20
14 extern char *plugin_directories[PLUGINSD_MAX_DIRECTORIES];
15
16 struct plugind {
17 STRING *id; // config node id
18 STRING *filename; // just the filename
19 STRING *fullfilename; // with path
20 STRING *cmd; // the command that it executes
21
22 size_t successful_collections; // the number of times we have seen
23 // values collected from this plugin
24
25 size_t serial_failures; // the number of times the plugin started
26 // without collecting values
27
28 struct rrdhost *host; // the host the plugin collects data for
29 int update_every; // the plugin default data collection frequency
30
31 struct {
32 SPINLOCK spinlock;
33 bool running; // do not touch this structure after setting this to 1
34 bool enabled; // if this is enabled or not
35 ND_THREAD *thread;
36 POPEN_INSTANCE *pi;
37 pid_t pid;
38 } unsafe;
39
40 time_t started_t;
41
42 struct plugind *prev;
43 struct plugind *next;
44 };
45
46 extern struct plugind *pluginsd_root;
47
48 size_t pluginsd_process(struct rrdhost *host, struct plugind *cd, int fd_input, int fd_output, int trust_durations);
49
50 struct parser;
51 void pluginsd_process_cleanup(struct parser *parser);
52
53 size_t pluginsd_initialize_plugin_directories();
54
55 #endif /* NETDATA_PLUGINS_D_H */