plugins_d.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. // SPDX-License-Identifier: GPL-3.0-or-later
  2. #ifndef NETDATA_PLUGINS_D_H
  3. #define NETDATA_PLUGINS_D_H 1
  4. #include "daemon/common.h"
  5. #define PLUGINSD_FILE_SUFFIX ".plugin"
  6. #define PLUGINSD_FILE_SUFFIX_LEN strlen(PLUGINSD_FILE_SUFFIX)
  7. #define PLUGINSD_CMD_MAX (FILENAME_MAX*2)
  8. #define PLUGINSD_STOCK_PLUGINS_DIRECTORY_PATH 0
  9. #define PLUGINSD_KEYWORD_CHART "CHART"
  10. #define PLUGINSD_KEYWORD_DIMENSION "DIMENSION"
  11. #define PLUGINSD_KEYWORD_BEGIN "BEGIN"
  12. #define PLUGINSD_KEYWORD_END "END"
  13. #define PLUGINSD_KEYWORD_FLUSH "FLUSH"
  14. #define PLUGINSD_KEYWORD_DISABLE "DISABLE"
  15. #define PLUGINSD_KEYWORD_VARIABLE "VARIABLE"
  16. #define PLUGINSD_KEYWORD_LABEL "LABEL"
  17. #define PLUGINSD_KEYWORD_OVERWRITE "OVERWRITE"
  18. #define PLUGINSD_KEYWORD_GUID "GUID"
  19. #define PLUGINSD_KEYWORD_CONTEXT "CONTEXT"
  20. #define PLUGINSD_KEYWORD_TOMBSTONE "TOMBSTONE"
  21. #define PLUGINSD_KEYWORD_HOST "HOST"
  22. #define PLUGINSD_LINE_MAX 1024
  23. #define PLUGINSD_LINE_MAX_SSL_READ 512
  24. #define PLUGINSD_MAX_WORDS 20
  25. #define PLUGINSD_MAX_DIRECTORIES 20
  26. extern char *plugin_directories[PLUGINSD_MAX_DIRECTORIES];
  27. struct plugind {
  28. char id[CONFIG_MAX_NAME+1]; // config node id
  29. char filename[FILENAME_MAX+1]; // just the filename
  30. char fullfilename[FILENAME_MAX+1]; // with path
  31. char cmd[PLUGINSD_CMD_MAX+1]; // the command that it executes
  32. volatile pid_t pid;
  33. netdata_thread_t thread;
  34. size_t successful_collections; // the number of times we have seen
  35. // values collected from this plugin
  36. size_t serial_failures; // the number of times the plugin started
  37. // without collecting values
  38. int update_every; // the plugin default data collection frequency
  39. volatile sig_atomic_t obsolete; // do not touch this structure after setting this to 1
  40. volatile sig_atomic_t enabled; // if this is enabled or not
  41. time_t started_t;
  42. uint32_t version;
  43. struct plugind *next;
  44. };
  45. extern struct plugind *pluginsd_root;
  46. extern size_t pluginsd_process(RRDHOST *host, struct plugind *cd, FILE *fp, int trust_durations);
  47. extern int pluginsd_split_words(char *str, char **words, int max_words, char *recover_string, char **recover_location, int max_recover);
  48. extern int pluginsd_initialize_plugin_directories();
  49. extern int config_isspace(char c);
  50. extern int pluginsd_space(char c);
  51. int quoted_strings_splitter(char *str, char **words, int max_words, int (*custom_isspace)(char), char *recover_input, char **recover_location, int max_recover);
  52. #endif /* NETDATA_PLUGINS_D_H */