1 /** 2 * @file ndomod.h Nagios Data Output Event Broker Module declarations 3 */ 4 /* 5 * Copyright 2009-2014 Nagios Core Development Team and Community Contributors 6 * Copyright 2005-2009 Ethan Galstad 7 * 8 * This file is part of NDOUtils. 9 * 10 * NDOUtils is free software: you can redistribute it and/or modify 11 * it under the terms of the GNU General Public License version 2 as 12 * published by the Free Software Foundation. 13 * 14 * NDOUtils is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU General Public License for more details. 18 * 19 * You should have received a copy of the GNU General Public License 20 * along with NDOUtils. If not, see <http://www.gnu.org/licenses/>. 21 */ 22 23 #ifndef NDO_NDOMOD_H_INCLUDED 24 #define NDO_NDOMOD_H_INCLUDED 25 26 27 /* this is needed for access to daemon's internal data */ 28 #define NSCORE 1 29 30 typedef struct ndomod_sink_buffer_struct{ 31 char **buffer; 32 unsigned long size; 33 unsigned long head; 34 unsigned long tail; 35 unsigned long items; 36 unsigned long maxitems; 37 unsigned long overflow; 38 }ndomod_sink_buffer; 39 40 41 #define NDOMOD_MAX_BUFLEN 16384 42 43 44 #define NDOMOD_PROCESS_PROCESS_DATA 1 45 #define NDOMOD_PROCESS_TIMED_EVENT_DATA 2 46 #define NDOMOD_PROCESS_LOG_DATA 4 47 #define NDOMOD_PROCESS_SYSTEM_COMMAND_DATA 8 48 #define NDOMOD_PROCESS_EVENT_HANDLER_DATA 16 49 #define NDOMOD_PROCESS_NOTIFICATION_DATA 32 50 #define NDOMOD_PROCESS_SERVICE_CHECK_DATA 64 51 #define NDOMOD_PROCESS_HOST_CHECK_DATA 128 52 #define NDOMOD_PROCESS_COMMENT_DATA 256 53 #define NDOMOD_PROCESS_DOWNTIME_DATA 512 54 #define NDOMOD_PROCESS_FLAPPING_DATA 1024 55 #define NDOMOD_PROCESS_PROGRAM_STATUS_DATA 2048 56 #define NDOMOD_PROCESS_HOST_STATUS_DATA 4096 57 #define NDOMOD_PROCESS_SERVICE_STATUS_DATA 8192 58 #define NDOMOD_PROCESS_ADAPTIVE_PROGRAM_DATA 16384 59 #define NDOMOD_PROCESS_ADAPTIVE_HOST_DATA 32768 60 #define NDOMOD_PROCESS_ADAPTIVE_SERVICE_DATA 65536 61 #define NDOMOD_PROCESS_EXTERNAL_COMMAND_DATA 131072 62 #define NDOMOD_PROCESS_OBJECT_CONFIG_DATA 262144 63 #define NDOMOD_PROCESS_MAIN_CONFIG_DATA 524288 64 #define NDOMOD_PROCESS_AGGREGATED_STATUS_DATA 1048576 65 #define NDOMOD_PROCESS_RETENTION_DATA 2097152 66 #define NDOMOD_PROCESS_ACKNOWLEDGEMENT_DATA 4194304 67 #define NDOMOD_PROCESS_STATECHANGE_DATA 8388608 68 #define NDOMOD_PROCESS_CONTACT_STATUS_DATA 16777216 69 #define NDOMOD_PROCESS_ADAPTIVE_CONTACT_DATA 33554432 70 71 #define NDOMOD_PROCESS_EVERYTHING 67108863 72 73 74 #define NDOMOD_CONFIG_DUMP_NONE 0 75 #define NDOMOD_CONFIG_DUMP_ORIGINAL 1 76 #define NDOMOD_CONFIG_DUMP_RETAINED 2 77 #define NDOMOD_CONFIG_DUMP_ALL 3 78 79 80 int nebmodule_init(int,char *,void *); 81 int nebmodule_deinit(int,int); 82 83 int ndomod_init(void); 84 int ndomod_deinit(void); 85 86 int ndomod_check_nagios_object_version(void); 87 88 int ndomod_write_to_logs(char *,int); 89 90 int ndomod_process_module_args(char *); 91 int ndomod_process_config_var(char *); 92 int ndomod_process_config_file(char *); 93 static void ndomod_free_config_memory(void); 94 95 int ndomod_open_sink(void); 96 int ndomod_close_sink(void); 97 int ndomod_write_to_sink(char *,int,int); 98 int ndomod_rotate_sink_file(void *); 99 int ndomod_hello_sink(int,int); 100 int ndomod_goodbye_sink(void); 101 102 int ndomod_sink_buffer_init(ndomod_sink_buffer *sbuf,unsigned long); 103 int ndomod_sink_buffer_deinit(ndomod_sink_buffer *sbuf); 104 int ndomod_sink_buffer_push(ndomod_sink_buffer *sbuf,char *); 105 char *ndomod_sink_buffer_peek(ndomod_sink_buffer *sbuf); 106 char *ndomod_sink_buffer_pop(ndomod_sink_buffer *sbuf); 107 int ndomod_sink_buffer_items(ndomod_sink_buffer *sbuf); 108 unsigned long ndomod_sink_buffer_get_overflow(ndomod_sink_buffer *sbuf); 109 int ndomod_sink_buffer_set_overflow(ndomod_sink_buffer *sbuf,unsigned long); 110 111 int ndomod_load_unprocessed_data(char *); 112 int ndomod_save_unprocessed_data(char *); 113 114 int ndomod_register_callbacks(void); 115 int ndomod_deregister_callbacks(void); 116 117 int ndomod_broker_data(int,void *); 118 119 int ndomod_write_config(int); 120 void ndomod_write_active_objects(); 121 int ndomod_write_object_config(int); 122 123 int ndomod_write_config_files(void); 124 int ndomod_write_main_config_file(void); 125 126 int ndomod_write_runtime_variables(void); 127 128 #endif 129