diff options
author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-03-12 17:22:17 +0100 |
---|---|---|
committer | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-03-12 17:22:17 +0100 |
commit | 97e65dddbda048f10b58ef8d190f2c0146a164a0 (patch) | |
tree | 1236da278c9dcc0ccaa7a1294a158bc572f1d172 | |
parent | a8b7df88113ae08d1b34f6efcd7d6d971e2b7c22 (diff) | |
download | monitoring-plugins-97e65ddd.tar.gz |
Refactor check_real
-rw-r--r-- | plugins/Makefile.am | 1 | ||||
-rw-r--r-- | plugins/check_real.c | 167 | ||||
-rw-r--r-- | plugins/check_real.d/config.h | 37 |
3 files changed, 130 insertions, 75 deletions
diff --git a/plugins/Makefile.am b/plugins/Makefile.am index 6c582a15..3269b9fb 100644 --- a/plugins/Makefile.am +++ b/plugins/Makefile.am | |||
@@ -55,6 +55,7 @@ EXTRA_DIST = t \ | |||
55 | check_game.d \ | 55 | check_game.d \ |
56 | check_nagios.d \ | 56 | check_nagios.d \ |
57 | check_dbi.d \ | 57 | check_dbi.d \ |
58 | check_real.d \ | ||
58 | check_ssh.d \ | 59 | check_ssh.d \ |
59 | check_nt.d \ | 60 | check_nt.d \ |
60 | check_dns.d \ | 61 | check_dns.d \ |
diff --git a/plugins/check_real.c b/plugins/check_real.c index 3737f69d..ec0928ed 100644 --- a/plugins/check_real.c +++ b/plugins/check_real.c | |||
@@ -28,6 +28,8 @@ | |||
28 | * | 28 | * |
29 | *****************************************************************************/ | 29 | *****************************************************************************/ |
30 | 30 | ||
31 | #include "states.h" | ||
32 | #include <stdio.h> | ||
31 | const char *progname = "check_real"; | 33 | const char *progname = "check_real"; |
32 | const char *copyright = "2000-2024"; | 34 | const char *copyright = "2000-2024"; |
33 | const char *email = "devel@monitoring-plugins.org"; | 35 | const char *email = "devel@monitoring-plugins.org"; |
@@ -35,27 +37,20 @@ const char *email = "devel@monitoring-plugins.org"; | |||
35 | #include "common.h" | 37 | #include "common.h" |
36 | #include "netutils.h" | 38 | #include "netutils.h" |
37 | #include "utils.h" | 39 | #include "utils.h" |
38 | 40 | #include "check_real.d/config.h" | |
39 | enum { | ||
40 | PORT = 554 | ||
41 | }; | ||
42 | 41 | ||
43 | #define EXPECT "RTSP/1." | 42 | #define EXPECT "RTSP/1." |
44 | #define URL "" | 43 | #define URL "" |
45 | 44 | ||
46 | static int process_arguments(int, char **); | 45 | typedef struct { |
46 | int errorcode; | ||
47 | check_real_config config; | ||
48 | } check_real_config_wrapper; | ||
49 | static check_real_config_wrapper process_arguments(int /*argc*/, char ** /*argv*/); | ||
50 | |||
47 | static void print_help(void); | 51 | static void print_help(void); |
48 | void print_usage(void); | 52 | void print_usage(void); |
49 | 53 | ||
50 | static int server_port = PORT; | ||
51 | static char *server_address; | ||
52 | static char *host_name; | ||
53 | static char *server_url = NULL; | ||
54 | static char *server_expect; | ||
55 | static int warning_time = 0; | ||
56 | static bool check_warning_time = false; | ||
57 | static int critical_time = 0; | ||
58 | static bool check_critical_time = false; | ||
59 | static bool verbose = false; | 54 | static bool verbose = false; |
60 | 55 | ||
61 | int main(int argc, char **argv) { | 56 | int main(int argc, char **argv) { |
@@ -66,10 +61,13 @@ int main(int argc, char **argv) { | |||
66 | /* Parse extra opts if any */ | 61 | /* Parse extra opts if any */ |
67 | argv = np_extra_opts(&argc, argv, progname); | 62 | argv = np_extra_opts(&argc, argv, progname); |
68 | 63 | ||
69 | if (process_arguments(argc, argv) == ERROR) { | 64 | check_real_config_wrapper tmp_config = process_arguments(argc, argv); |
65 | if (tmp_config.errorcode == ERROR) { | ||
70 | usage4(_("Could not parse arguments")); | 66 | usage4(_("Could not parse arguments")); |
71 | } | 67 | } |
72 | 68 | ||
69 | const check_real_config config = tmp_config.config; | ||
70 | |||
73 | /* initialize alarm signal handling */ | 71 | /* initialize alarm signal handling */ |
74 | signal(SIGALRM, socket_timeout_alarm_handler); | 72 | signal(SIGALRM, socket_timeout_alarm_handler); |
75 | 73 | ||
@@ -79,40 +77,50 @@ int main(int argc, char **argv) { | |||
79 | 77 | ||
80 | /* try to connect to the host at the given port number */ | 78 | /* try to connect to the host at the given port number */ |
81 | int socket; | 79 | int socket; |
82 | if (my_tcp_connect(server_address, server_port, &socket) != STATE_OK) { | 80 | if (my_tcp_connect(config.server_address, config.server_port, &socket) != STATE_OK) { |
83 | die(STATE_CRITICAL, _("Unable to connect to %s on port %d\n"), server_address, server_port); | 81 | die(STATE_CRITICAL, _("Unable to connect to %s on port %d\n"), config.server_address, config.server_port); |
84 | } | 82 | } |
85 | 83 | ||
86 | /* Part I - Server Check */ | 84 | /* Part I - Server Check */ |
87 | 85 | ||
88 | /* send the OPTIONS request */ | 86 | /* send the OPTIONS request */ |
89 | char buffer[MAX_INPUT_BUFFER]; | 87 | char buffer[MAX_INPUT_BUFFER]; |
90 | sprintf(buffer, "OPTIONS rtsp://%s:%d RTSP/1.0\r\n", host_name, server_port); | 88 | sprintf(buffer, "OPTIONS rtsp://%s:%d RTSP/1.0\r\n", config.host_name, config.server_port); |
91 | int result = send(socket, buffer, strlen(buffer), 0); | 89 | ssize_t sent_bytes = send(socket, buffer, strlen(buffer), 0); |
90 | if (sent_bytes == -1) { | ||
91 | die(STATE_CRITICAL, _("Sending options to %s failed\n"), config.host_name); | ||
92 | } | ||
92 | 93 | ||
93 | /* send the header sync */ | 94 | /* send the header sync */ |
94 | sprintf(buffer, "CSeq: 1\r\n"); | 95 | sprintf(buffer, "CSeq: 1\r\n"); |
95 | result = send(socket, buffer, strlen(buffer), 0); | 96 | sent_bytes = send(socket, buffer, strlen(buffer), 0); |
97 | if (sent_bytes == -1) { | ||
98 | die(STATE_CRITICAL, _("Sending header sync to %s failed\n"), config.host_name); | ||
99 | } | ||
96 | 100 | ||
97 | /* send a newline so the server knows we're done with the request */ | 101 | /* send a newline so the server knows we're done with the request */ |
98 | sprintf(buffer, "\r\n"); | 102 | sprintf(buffer, "\r\n"); |
99 | result = send(socket, buffer, strlen(buffer), 0); | 103 | sent_bytes = send(socket, buffer, strlen(buffer), 0); |
104 | if (sent_bytes == -1) { | ||
105 | die(STATE_CRITICAL, _("Sending newline to %s failed\n"), config.host_name); | ||
106 | } | ||
100 | 107 | ||
101 | /* watch for the REAL connection string */ | 108 | /* watch for the REAL connection string */ |
102 | result = recv(socket, buffer, MAX_INPUT_BUFFER - 1, 0); | 109 | ssize_t received_bytes = recv(socket, buffer, MAX_INPUT_BUFFER - 1, 0); |
103 | 110 | ||
104 | /* return a CRITICAL status if we couldn't read any data */ | 111 | /* return a CRITICAL status if we couldn't read any data */ |
105 | if (result == -1) { | 112 | if (received_bytes == -1) { |
106 | die(STATE_CRITICAL, _("No data received from %s\n"), host_name); | 113 | die(STATE_CRITICAL, _("No data received from %s\n"), config.host_name); |
107 | } | 114 | } |
108 | 115 | ||
116 | mp_state_enum result = STATE_OK; | ||
109 | char *status_line = NULL; | 117 | char *status_line = NULL; |
110 | /* make sure we find the response we are looking for */ | 118 | /* make sure we find the response we are looking for */ |
111 | if (!strstr(buffer, server_expect)) { | 119 | if (!strstr(buffer, config.server_expect)) { |
112 | if (server_port == PORT) { | 120 | if (config.server_port == PORT) { |
113 | printf("%s\n", _("Invalid REAL response received from host")); | 121 | printf("%s\n", _("Invalid REAL response received from host")); |
114 | } else { | 122 | } else { |
115 | printf(_("Invalid REAL response received from host on port %d\n"), server_port); | 123 | printf(_("Invalid REAL response received from host on port %d\n"), config.server_port); |
116 | } | 124 | } |
117 | } else { | 125 | } else { |
118 | /* else we got the REAL string, so check the return code */ | 126 | /* else we got the REAL string, so check the return code */ |
@@ -121,7 +129,7 @@ int main(int argc, char **argv) { | |||
121 | 129 | ||
122 | result = STATE_OK; | 130 | result = STATE_OK; |
123 | 131 | ||
124 | status_line = (char *)strtok(buffer, "\n"); | 132 | status_line = strtok(buffer, "\n"); |
125 | 133 | ||
126 | if (strstr(status_line, "200")) { | 134 | if (strstr(status_line, "200")) { |
127 | result = STATE_OK; | 135 | result = STATE_OK; |
@@ -138,10 +146,8 @@ int main(int argc, char **argv) { | |||
138 | result = STATE_WARNING; | 146 | result = STATE_WARNING; |
139 | } else if (strstr(status_line, "404")) { | 147 | } else if (strstr(status_line, "404")) { |
140 | result = STATE_WARNING; | 148 | result = STATE_WARNING; |
141 | } | 149 | } else if (strstr(status_line, "500")) { |
142 | 150 | /* server errors result in a critical state */ | |
143 | /* server errors result in a critical state */ | ||
144 | else if (strstr(status_line, "500")) { | ||
145 | result = STATE_CRITICAL; | 151 | result = STATE_CRITICAL; |
146 | } else if (strstr(status_line, "501")) { | 152 | } else if (strstr(status_line, "501")) { |
147 | result = STATE_CRITICAL; | 153 | result = STATE_CRITICAL; |
@@ -149,45 +155,52 @@ int main(int argc, char **argv) { | |||
149 | result = STATE_CRITICAL; | 155 | result = STATE_CRITICAL; |
150 | } else if (strstr(status_line, "503")) { | 156 | } else if (strstr(status_line, "503")) { |
151 | result = STATE_CRITICAL; | 157 | result = STATE_CRITICAL; |
152 | } | 158 | } else { |
153 | |||
154 | else { | ||
155 | result = STATE_UNKNOWN; | 159 | result = STATE_UNKNOWN; |
156 | } | 160 | } |
157 | } | 161 | } |
158 | 162 | ||
159 | /* Part II - Check stream exists and is ok */ | 163 | /* Part II - Check stream exists and is ok */ |
160 | if ((result == STATE_OK) && (server_url != NULL)) { | 164 | if ((result == STATE_OK) && (config.server_url != NULL)) { |
161 | 165 | ||
162 | /* Part I - Server Check */ | 166 | /* Part I - Server Check */ |
163 | 167 | ||
164 | /* send the DESCRIBE request */ | 168 | /* send the DESCRIBE request */ |
165 | sprintf(buffer, "DESCRIBE rtsp://%s:%d%s RTSP/1.0\r\n", host_name, server_port, server_url); | 169 | sprintf(buffer, "DESCRIBE rtsp://%s:%d%s RTSP/1.0\r\n", config.host_name, config.server_port, config.server_url); |
166 | result = send(socket, buffer, strlen(buffer), 0); | 170 | |
171 | ssize_t sent_bytes = send(socket, buffer, strlen(buffer), 0); | ||
172 | if (sent_bytes == -1) { | ||
173 | die(STATE_CRITICAL, _("Sending DESCRIBE request to %s failed\n"), config.host_name); | ||
174 | } | ||
167 | 175 | ||
168 | /* send the header sync */ | 176 | /* send the header sync */ |
169 | sprintf(buffer, "CSeq: 2\r\n"); | 177 | sprintf(buffer, "CSeq: 2\r\n"); |
170 | result = send(socket, buffer, strlen(buffer), 0); | 178 | sent_bytes = send(socket, buffer, strlen(buffer), 0); |
179 | if (sent_bytes == -1) { | ||
180 | die(STATE_CRITICAL, _("Sending DESCRIBE request to %s failed\n"), config.host_name); | ||
181 | } | ||
171 | 182 | ||
172 | /* send a newline so the server knows we're done with the request */ | 183 | /* send a newline so the server knows we're done with the request */ |
173 | sprintf(buffer, "\r\n"); | 184 | sprintf(buffer, "\r\n"); |
174 | result = send(socket, buffer, strlen(buffer), 0); | 185 | sent_bytes = send(socket, buffer, strlen(buffer), 0); |
186 | if (sent_bytes == -1) { | ||
187 | die(STATE_CRITICAL, _("Sending DESCRIBE request to %s failed\n"), config.host_name); | ||
188 | } | ||
175 | 189 | ||
176 | /* watch for the REAL connection string */ | 190 | /* watch for the REAL connection string */ |
177 | result = recv(socket, buffer, MAX_INPUT_BUFFER - 1, 0); | 191 | ssize_t recv_bytes = recv(socket, buffer, MAX_INPUT_BUFFER - 1, 0); |
178 | buffer[result] = '\0'; /* null terminate received buffer */ | 192 | if (recv_bytes == -1) { |
179 | 193 | /* return a CRITICAL status if we couldn't read any data */ | |
180 | /* return a CRITICAL status if we couldn't read any data */ | ||
181 | if (result == -1) { | ||
182 | printf(_("No data received from host\n")); | 194 | printf(_("No data received from host\n")); |
183 | result = STATE_CRITICAL; | 195 | result = STATE_CRITICAL; |
184 | } else { | 196 | } else { |
197 | buffer[result] = '\0'; /* null terminate received buffer */ | ||
185 | /* make sure we find the response we are looking for */ | 198 | /* make sure we find the response we are looking for */ |
186 | if (!strstr(buffer, server_expect)) { | 199 | if (!strstr(buffer, config.server_expect)) { |
187 | if (server_port == PORT) { | 200 | if (config.server_port == PORT) { |
188 | printf("%s\n", _("Invalid REAL response received from host")); | 201 | printf("%s\n", _("Invalid REAL response received from host")); |
189 | } else { | 202 | } else { |
190 | printf(_("Invalid REAL response received from host on port %d\n"), server_port); | 203 | printf(_("Invalid REAL response received from host on port %d\n"), config.server_port); |
191 | } | 204 | } |
192 | } else { | 205 | } else { |
193 | 206 | ||
@@ -197,7 +210,7 @@ int main(int argc, char **argv) { | |||
197 | 210 | ||
198 | result = STATE_OK; | 211 | result = STATE_OK; |
199 | 212 | ||
200 | status_line = (char *)strtok(buffer, "\n"); | 213 | status_line = strtok(buffer, "\n"); |
201 | 214 | ||
202 | if (strstr(status_line, "200")) { | 215 | if (strstr(status_line, "200")) { |
203 | result = STATE_OK; | 216 | result = STATE_OK; |
@@ -236,10 +249,9 @@ int main(int argc, char **argv) { | |||
236 | 249 | ||
237 | /* Return results */ | 250 | /* Return results */ |
238 | if (result == STATE_OK) { | 251 | if (result == STATE_OK) { |
239 | 252 | if (config.check_critical_time && (end_time - start_time) > config.critical_time) { | |
240 | if (check_critical_time && (end_time - start_time) > critical_time) { | ||
241 | result = STATE_CRITICAL; | 253 | result = STATE_CRITICAL; |
242 | } else if (check_warning_time && (end_time - start_time) > warning_time) { | 254 | } else if (config.check_warning_time && (end_time - start_time) > config.warning_time) { |
243 | result = STATE_WARNING; | 255 | result = STATE_WARNING; |
244 | } | 256 | } |
245 | 257 | ||
@@ -255,11 +267,11 @@ int main(int argc, char **argv) { | |||
255 | /* reset the alarm */ | 267 | /* reset the alarm */ |
256 | alarm(0); | 268 | alarm(0); |
257 | 269 | ||
258 | return result; | 270 | exit(result); |
259 | } | 271 | } |
260 | 272 | ||
261 | /* process command-line arguments */ | 273 | /* process command-line arguments */ |
262 | int process_arguments(int argc, char **argv) { | 274 | check_real_config_wrapper process_arguments(int argc, char **argv) { |
263 | static struct option longopts[] = {{"hostname", required_argument, 0, 'H'}, {"IPaddress", required_argument, 0, 'I'}, | 275 | static struct option longopts[] = {{"hostname", required_argument, 0, 'H'}, {"IPaddress", required_argument, 0, 'I'}, |
264 | {"expect", required_argument, 0, 'e'}, {"url", required_argument, 0, 'u'}, | 276 | {"expect", required_argument, 0, 'e'}, {"url", required_argument, 0, 'u'}, |
265 | {"port", required_argument, 0, 'p'}, {"critical", required_argument, 0, 'c'}, | 277 | {"port", required_argument, 0, 'p'}, {"critical", required_argument, 0, 'c'}, |
@@ -267,8 +279,14 @@ int process_arguments(int argc, char **argv) { | |||
267 | {"verbose", no_argument, 0, 'v'}, {"version", no_argument, 0, 'V'}, | 279 | {"verbose", no_argument, 0, 'v'}, {"version", no_argument, 0, 'V'}, |
268 | {"help", no_argument, 0, 'h'}, {0, 0, 0, 0}}; | 280 | {"help", no_argument, 0, 'h'}, {0, 0, 0, 0}}; |
269 | 281 | ||
282 | check_real_config_wrapper result = { | ||
283 | .errorcode = OK, | ||
284 | .config = check_real_config_init(), | ||
285 | }; | ||
286 | |||
270 | if (argc < 2) { | 287 | if (argc < 2) { |
271 | return ERROR; | 288 | result.errorcode = ERROR; |
289 | return result; | ||
272 | } | 290 | } |
273 | 291 | ||
274 | for (int i = 1; i < argc; i++) { | 292 | for (int i = 1; i < argc; i++) { |
@@ -281,10 +299,9 @@ int process_arguments(int argc, char **argv) { | |||
281 | } | 299 | } |
282 | } | 300 | } |
283 | 301 | ||
284 | int option_char; | ||
285 | while (true) { | 302 | while (true) { |
286 | int option = 0; | 303 | int option = 0; |
287 | option_char = getopt_long(argc, argv, "+hvVI:H:e:u:p:w:c:t:", longopts, &option); | 304 | int option_char = getopt_long(argc, argv, "+hvVI:H:e:u:p:w:c:t:", longopts, &option); |
288 | 305 | ||
289 | if (option_char == -1 || option_char == EOF) { | 306 | if (option_char == -1 || option_char == EOF) { |
290 | break; | 307 | break; |
@@ -293,39 +310,39 @@ int process_arguments(int argc, char **argv) { | |||
293 | switch (option_char) { | 310 | switch (option_char) { |
294 | case 'I': /* hostname */ | 311 | case 'I': /* hostname */ |
295 | case 'H': /* hostname */ | 312 | case 'H': /* hostname */ |
296 | if (server_address) { | 313 | if (result.config.server_address) { |
297 | break; | 314 | break; |
298 | } else if (is_host(optarg)) { | 315 | } else if (is_host(optarg)) { |
299 | server_address = optarg; | 316 | result.config.server_address = optarg; |
300 | } else { | 317 | } else { |
301 | usage2(_("Invalid hostname/address"), optarg); | 318 | usage2(_("Invalid hostname/address"), optarg); |
302 | } | 319 | } |
303 | break; | 320 | break; |
304 | case 'e': /* string to expect in response header */ | 321 | case 'e': /* string to expect in response header */ |
305 | server_expect = optarg; | 322 | result.config.server_expect = optarg; |
306 | break; | 323 | break; |
307 | case 'u': /* server URL */ | 324 | case 'u': /* server URL */ |
308 | server_url = optarg; | 325 | result.config.server_url = optarg; |
309 | break; | 326 | break; |
310 | case 'p': /* port */ | 327 | case 'p': /* port */ |
311 | if (is_intpos(optarg)) { | 328 | if (is_intpos(optarg)) { |
312 | server_port = atoi(optarg); | 329 | result.config.server_port = atoi(optarg); |
313 | } else { | 330 | } else { |
314 | usage4(_("Port must be a positive integer")); | 331 | usage4(_("Port must be a positive integer")); |
315 | } | 332 | } |
316 | break; | 333 | break; |
317 | case 'w': /* warning time threshold */ | 334 | case 'w': /* warning time threshold */ |
318 | if (is_intnonneg(optarg)) { | 335 | if (is_intnonneg(optarg)) { |
319 | warning_time = atoi(optarg); | 336 | result.config.warning_time = atoi(optarg); |
320 | check_warning_time = true; | 337 | result.config.check_warning_time = true; |
321 | } else { | 338 | } else { |
322 | usage4(_("Warning time must be a positive integer")); | 339 | usage4(_("Warning time must be a positive integer")); |
323 | } | 340 | } |
324 | break; | 341 | break; |
325 | case 'c': /* critical time threshold */ | 342 | case 'c': /* critical time threshold */ |
326 | if (is_intnonneg(optarg)) { | 343 | if (is_intnonneg(optarg)) { |
327 | critical_time = atoi(optarg); | 344 | result.config.critical_time = atoi(optarg); |
328 | check_critical_time = true; | 345 | result.config.check_critical_time = true; |
329 | } else { | 346 | } else { |
330 | usage4(_("Critical time must be a positive integer")); | 347 | usage4(_("Critical time must be a positive integer")); |
331 | } | 348 | } |
@@ -351,28 +368,28 @@ int process_arguments(int argc, char **argv) { | |||
351 | } | 368 | } |
352 | } | 369 | } |
353 | 370 | ||
354 | option_char = optind; | 371 | int option_char = optind; |
355 | if (server_address == NULL && argc > option_char) { | 372 | if (result.config.server_address == NULL && argc > option_char) { |
356 | if (is_host(argv[option_char])) { | 373 | if (is_host(argv[option_char])) { |
357 | server_address = argv[option_char++]; | 374 | result.config.server_address = argv[option_char++]; |
358 | } else { | 375 | } else { |
359 | usage2(_("Invalid hostname/address"), argv[option_char]); | 376 | usage2(_("Invalid hostname/address"), argv[option_char]); |
360 | } | 377 | } |
361 | } | 378 | } |
362 | 379 | ||
363 | if (server_address == NULL) { | 380 | if (result.config.server_address == NULL) { |
364 | usage4(_("You must provide a server to check")); | 381 | usage4(_("You must provide a server to check")); |
365 | } | 382 | } |
366 | 383 | ||
367 | if (host_name == NULL) { | 384 | if (result.config.host_name == NULL) { |
368 | host_name = strdup(server_address); | 385 | result.config.host_name = strdup(result.config.server_address); |
369 | } | 386 | } |
370 | 387 | ||
371 | if (server_expect == NULL) { | 388 | if (result.config.server_expect == NULL) { |
372 | server_expect = strdup(EXPECT); | 389 | result.config.server_expect = strdup(EXPECT); |
373 | } | 390 | } |
374 | 391 | ||
375 | return OK; | 392 | return result; |
376 | } | 393 | } |
377 | 394 | ||
378 | void print_help(void) { | 395 | void print_help(void) { |
diff --git a/plugins/check_real.d/config.h b/plugins/check_real.d/config.h new file mode 100644 index 00000000..c4663cf9 --- /dev/null +++ b/plugins/check_real.d/config.h | |||
@@ -0,0 +1,37 @@ | |||
1 | #pragma once | ||
2 | |||
3 | #include "../../config.h" | ||
4 | #include <stddef.h> | ||
5 | |||
6 | enum { | ||
7 | PORT = 554 | ||
8 | }; | ||
9 | |||
10 | typedef struct { | ||
11 | char *server_address; | ||
12 | char *host_name; | ||
13 | int server_port; | ||
14 | char *server_url; | ||
15 | |||
16 | char *server_expect; | ||
17 | int warning_time; | ||
18 | bool check_warning_time; | ||
19 | int critical_time; | ||
20 | bool check_critical_time; | ||
21 | } check_real_config; | ||
22 | |||
23 | check_real_config check_real_config_init() { | ||
24 | check_real_config tmp = { | ||
25 | .server_address = NULL, | ||
26 | .host_name = NULL, | ||
27 | .server_port = PORT, | ||
28 | .server_url = NULL, | ||
29 | |||
30 | .server_expect = NULL, | ||
31 | .warning_time = 0, | ||
32 | .check_warning_time = false, | ||
33 | .critical_time = 0, | ||
34 | .check_critical_time = false, | ||
35 | }; | ||
36 | return tmp; | ||
37 | } | ||