summaryrefslogtreecommitdiffstats
path: root/plugins/check_real.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/check_real.c')
-rw-r--r--plugins/check_real.c434
1 files changed, 193 insertions, 241 deletions
diff --git a/plugins/check_real.c b/plugins/check_real.c
index 15e035b..03ed655 100644
--- a/plugins/check_real.c
+++ b/plugins/check_real.c
@@ -1,32 +1,32 @@
1/***************************************************************************** 1/*****************************************************************************
2* 2 *
3* Monitoring check_real plugin 3 * Monitoring check_real plugin
4* 4 *
5* License: GPL 5 * License: GPL
6* Copyright (c) 2000-2007 Monitoring Plugins Development Team 6 * Copyright (c) 2000-2007 Monitoring Plugins Development Team
7* 7 *
8* Description: 8 * Description:
9* 9 *
10* This file contains the check_real plugin 10 * This file contains the check_real plugin
11* 11 *
12* This plugin tests the REAL service on the specified host. 12 * This plugin tests the REAL service on the specified host.
13* 13 *
14* 14 *
15* This program is free software: you can redistribute it and/or modify 15 * This program is free software: you can redistribute it and/or modify
16* it under the terms of the GNU General Public License as published by 16 * it under the terms of the GNU General Public License as published by
17* the Free Software Foundation, either version 3 of the License, or 17 * the Free Software Foundation, either version 3 of the License, or
18* (at your option) any later version. 18 * (at your option) any later version.
19* 19 *
20* This program is distributed in the hope that it will be useful, 20 * This program is distributed in the hope that it will be useful,
21* but WITHOUT ANY WARRANTY; without even the implied warranty of 21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23* GNU General Public License for more details. 23 * GNU General Public License for more details.
24* 24 *
25* You should have received a copy of the GNU General Public License 25 * You should have received a copy of the GNU General Public License
26* along with this program. If not, see <http://www.gnu.org/licenses/>. 26 * along with this program. If not, see <http://www.gnu.org/licenses/>.
27* 27 *
28* 28 *
29*****************************************************************************/ 29 *****************************************************************************/
30 30
31const char *progname = "check_real"; 31const char *progname = "check_real";
32const char *copyright = "2000-2007"; 32const char *copyright = "2000-2007";
@@ -37,16 +37,16 @@ const char *email = "devel@monitoring-plugins.org";
37#include "utils.h" 37#include "utils.h"
38 38
39enum { 39enum {
40 PORT = 554 40 PORT = 554
41}; 41};
42 42
43#define EXPECT "RTSP/1." 43#define EXPECT "RTSP/1."
44#define URL "" 44#define URL ""
45 45
46int process_arguments (int, char **); 46int process_arguments(int, char **);
47int validate_arguments (void); 47int validate_arguments(void);
48void print_help (void); 48void print_help(void);
49void print_usage (void); 49void print_usage(void);
50 50
51int server_port = PORT; 51int server_port = PORT;
52char *server_address; 52char *server_address;
@@ -59,99 +59,92 @@ int critical_time = 0;
59bool check_critical_time = false; 59bool check_critical_time = false;
60bool verbose = false; 60bool verbose = false;
61 61
62 62int main(int argc, char **argv) {
63
64int
65main (int argc, char **argv)
66{
67 int sd; 63 int sd;
68 int result = STATE_UNKNOWN; 64 int result = STATE_UNKNOWN;
69 char buffer[MAX_INPUT_BUFFER]; 65 char buffer[MAX_INPUT_BUFFER];
70 char *status_line = NULL; 66 char *status_line = NULL;
71 67
72 setlocale (LC_ALL, ""); 68 setlocale(LC_ALL, "");
73 bindtextdomain (PACKAGE, LOCALEDIR); 69 bindtextdomain(PACKAGE, LOCALEDIR);
74 textdomain (PACKAGE); 70 textdomain(PACKAGE);
75 71
76 /* Parse extra opts if any */ 72 /* Parse extra opts if any */
77 argv=np_extra_opts (&argc, argv, progname); 73 argv = np_extra_opts(&argc, argv, progname);
78 74
79 if (process_arguments (argc, argv) == ERROR) 75 if (process_arguments(argc, argv) == ERROR)
80 usage4 (_("Could not parse arguments")); 76 usage4(_("Could not parse arguments"));
81 77
82 /* initialize alarm signal handling */ 78 /* initialize alarm signal handling */
83 signal (SIGALRM, socket_timeout_alarm_handler); 79 signal(SIGALRM, socket_timeout_alarm_handler);
84 80
85 /* set socket timeout */ 81 /* set socket timeout */
86 alarm (socket_timeout); 82 alarm(socket_timeout);
87 time (&start_time); 83 time(&start_time);
88 84
89 /* try to connect to the host at the given port number */ 85 /* try to connect to the host at the given port number */
90 if (my_tcp_connect (server_address, server_port, &sd) != STATE_OK) 86 if (my_tcp_connect(server_address, server_port, &sd) != STATE_OK)
91 die (STATE_CRITICAL, _("Unable to connect to %s on port %d\n"), 87 die(STATE_CRITICAL, _("Unable to connect to %s on port %d\n"), server_address, server_port);
92 server_address, server_port);
93 88
94 /* Part I - Server Check */ 89 /* Part I - Server Check */
95 90
96 /* send the OPTIONS request */ 91 /* send the OPTIONS request */
97 sprintf (buffer, "OPTIONS rtsp://%s:%d RTSP/1.0\r\n", host_name, server_port); 92 sprintf(buffer, "OPTIONS rtsp://%s:%d RTSP/1.0\r\n", host_name, server_port);
98 result = send (sd, buffer, strlen (buffer), 0); 93 result = send(sd, buffer, strlen(buffer), 0);
99 94
100 /* send the header sync */ 95 /* send the header sync */
101 sprintf (buffer, "CSeq: 1\r\n"); 96 sprintf(buffer, "CSeq: 1\r\n");
102 result = send (sd, buffer, strlen (buffer), 0); 97 result = send(sd, buffer, strlen(buffer), 0);
103 98
104 /* send a newline so the server knows we're done with the request */ 99 /* send a newline so the server knows we're done with the request */
105 sprintf (buffer, "\r\n"); 100 sprintf(buffer, "\r\n");
106 result = send (sd, buffer, strlen (buffer), 0); 101 result = send(sd, buffer, strlen(buffer), 0);
107 102
108 /* watch for the REAL connection string */ 103 /* watch for the REAL connection string */
109 result = recv (sd, buffer, MAX_INPUT_BUFFER - 1, 0); 104 result = recv(sd, buffer, MAX_INPUT_BUFFER - 1, 0);
110 105
111 /* return a CRITICAL status if we couldn't read any data */ 106 /* return a CRITICAL status if we couldn't read any data */
112 if (result == -1) 107 if (result == -1)
113 die (STATE_CRITICAL, _("No data received from %s\n"), host_name); 108 die(STATE_CRITICAL, _("No data received from %s\n"), host_name);
114 109
115 /* make sure we find the response we are looking for */ 110 /* make sure we find the response we are looking for */
116 if (!strstr (buffer, server_expect)) { 111 if (!strstr(buffer, server_expect)) {
117 if (server_port == PORT) 112 if (server_port == PORT)
118 printf ("%s\n", _("Invalid REAL response received from host")); 113 printf("%s\n", _("Invalid REAL response received from host"));
119 else 114 else
120 printf (_("Invalid REAL response received from host on port %d\n"), 115 printf(_("Invalid REAL response received from host on port %d\n"), server_port);
121 server_port); 116 } else {
122 }
123 else {
124 /* else we got the REAL string, so check the return code */ 117 /* else we got the REAL string, so check the return code */
125 118
126 time (&end_time); 119 time(&end_time);
127 120
128 result = STATE_OK; 121 result = STATE_OK;
129 122
130 status_line = (char *) strtok (buffer, "\n"); 123 status_line = (char *)strtok(buffer, "\n");
131 124
132 if (strstr (status_line, "200")) 125 if (strstr(status_line, "200"))
133 result = STATE_OK; 126 result = STATE_OK;
134 127
135 /* client errors result in a warning state */ 128 /* client errors result in a warning state */
136 else if (strstr (status_line, "400")) 129 else if (strstr(status_line, "400"))
137 result = STATE_WARNING; 130 result = STATE_WARNING;
138 else if (strstr (status_line, "401")) 131 else if (strstr(status_line, "401"))
139 result = STATE_WARNING; 132 result = STATE_WARNING;
140 else if (strstr (status_line, "402")) 133 else if (strstr(status_line, "402"))
141 result = STATE_WARNING; 134 result = STATE_WARNING;
142 else if (strstr (status_line, "403")) 135 else if (strstr(status_line, "403"))
143 result = STATE_WARNING; 136 result = STATE_WARNING;
144 else if (strstr (status_line, "404")) 137 else if (strstr(status_line, "404"))
145 result = STATE_WARNING; 138 result = STATE_WARNING;
146 139
147 /* server errors result in a critical state */ 140 /* server errors result in a critical state */
148 else if (strstr (status_line, "500")) 141 else if (strstr(status_line, "500"))
149 result = STATE_CRITICAL; 142 result = STATE_CRITICAL;
150 else if (strstr (status_line, "501")) 143 else if (strstr(status_line, "501"))
151 result = STATE_CRITICAL; 144 result = STATE_CRITICAL;
152 else if (strstr (status_line, "502")) 145 else if (strstr(status_line, "502"))
153 result = STATE_CRITICAL; 146 result = STATE_CRITICAL;
154 else if (strstr (status_line, "503")) 147 else if (strstr(status_line, "503"))
155 result = STATE_CRITICAL; 148 result = STATE_CRITICAL;
156 149
157 else 150 else
@@ -159,74 +152,70 @@ main (int argc, char **argv)
159 } 152 }
160 153
161 /* Part II - Check stream exists and is ok */ 154 /* Part II - Check stream exists and is ok */
162 if ((result == STATE_OK )&& (server_url != NULL) ) { 155 if ((result == STATE_OK) && (server_url != NULL)) {
163 156
164 /* Part I - Server Check */ 157 /* Part I - Server Check */
165 158
166 /* send the DESCRIBE request */ 159 /* send the DESCRIBE request */
167 sprintf (buffer, "DESCRIBE rtsp://%s:%d%s RTSP/1.0\r\n", host_name, 160 sprintf(buffer, "DESCRIBE rtsp://%s:%d%s RTSP/1.0\r\n", host_name, server_port, server_url);
168 server_port, server_url); 161 result = send(sd, buffer, strlen(buffer), 0);
169 result = send (sd, buffer, strlen (buffer), 0);
170 162
171 /* send the header sync */ 163 /* send the header sync */
172 sprintf (buffer, "CSeq: 2\r\n"); 164 sprintf(buffer, "CSeq: 2\r\n");
173 result = send (sd, buffer, strlen (buffer), 0); 165 result = send(sd, buffer, strlen(buffer), 0);
174 166
175 /* send a newline so the server knows we're done with the request */ 167 /* send a newline so the server knows we're done with the request */
176 sprintf (buffer, "\r\n"); 168 sprintf(buffer, "\r\n");
177 result = send (sd, buffer, strlen (buffer), 0); 169 result = send(sd, buffer, strlen(buffer), 0);
178 170
179 /* watch for the REAL connection string */ 171 /* watch for the REAL connection string */
180 result = recv (sd, buffer, MAX_INPUT_BUFFER - 1, 0); 172 result = recv(sd, buffer, MAX_INPUT_BUFFER - 1, 0);
181 buffer[result] = '\0'; /* null terminate received buffer */ 173 buffer[result] = '\0'; /* null terminate received buffer */
182 174
183 /* return a CRITICAL status if we couldn't read any data */ 175 /* return a CRITICAL status if we couldn't read any data */
184 if (result == -1) { 176 if (result == -1) {
185 printf (_("No data received from host\n")); 177 printf(_("No data received from host\n"));
186 result = STATE_CRITICAL; 178 result = STATE_CRITICAL;
187 } 179 } else {
188 else {
189 /* make sure we find the response we are looking for */ 180 /* make sure we find the response we are looking for */
190 if (!strstr (buffer, server_expect)) { 181 if (!strstr(buffer, server_expect)) {
191 if (server_port == PORT) 182 if (server_port == PORT)
192 printf ("%s\n", _("Invalid REAL response received from host")); 183 printf("%s\n", _("Invalid REAL response received from host"));
193 else 184 else
194 printf (_("Invalid REAL response received from host on port %d\n"), 185 printf(_("Invalid REAL response received from host on port %d\n"), server_port);
195 server_port); 186 } else {
196 }
197 else {
198 187
199 /* else we got the REAL string, so check the return code */ 188 /* else we got the REAL string, so check the return code */
200 189
201 time (&end_time); 190 time(&end_time);
202 191
203 result = STATE_OK; 192 result = STATE_OK;
204 193
205 status_line = (char *) strtok (buffer, "\n"); 194 status_line = (char *)strtok(buffer, "\n");
206 195
207 if (strstr (status_line, "200")) 196 if (strstr(status_line, "200"))
208 result = STATE_OK; 197 result = STATE_OK;
209 198
210 /* client errors result in a warning state */ 199 /* client errors result in a warning state */
211 else if (strstr (status_line, "400")) 200 else if (strstr(status_line, "400"))
212 result = STATE_WARNING; 201 result = STATE_WARNING;
213 else if (strstr (status_line, "401")) 202 else if (strstr(status_line, "401"))
214 result = STATE_WARNING; 203 result = STATE_WARNING;
215 else if (strstr (status_line, "402")) 204 else if (strstr(status_line, "402"))
216 result = STATE_WARNING; 205 result = STATE_WARNING;
217 else if (strstr (status_line, "403")) 206 else if (strstr(status_line, "403"))
218 result = STATE_WARNING; 207 result = STATE_WARNING;
219 else if (strstr (status_line, "404")) 208 else if (strstr(status_line, "404"))
220 result = STATE_WARNING; 209 result = STATE_WARNING;
221 210
222 /* server errors result in a critical state */ 211 /* server errors result in a critical state */
223 else if (strstr (status_line, "500")) 212 else if (strstr(status_line, "500"))
224 result = STATE_CRITICAL; 213 result = STATE_CRITICAL;
225 else if (strstr (status_line, "501")) 214 else if (strstr(status_line, "501"))
226 result = STATE_CRITICAL; 215 result = STATE_CRITICAL;
227 else if (strstr (status_line, "502")) 216 else if (strstr(status_line, "502"))
228 result = STATE_CRITICAL; 217 result = STATE_CRITICAL;
229 else if (strstr (status_line, "503")) 218 else if (strstr(status_line, "503"))
230 result = STATE_CRITICAL; 219 result = STATE_CRITICAL;
231 220
232 else 221 else
@@ -238,217 +227,180 @@ main (int argc, char **argv)
238 /* Return results */ 227 /* Return results */
239 if (result == STATE_OK) { 228 if (result == STATE_OK) {
240 229
241 if (check_critical_time 230 if (check_critical_time && (end_time - start_time) > critical_time)
242 && (end_time - start_time) > critical_time) result = STATE_CRITICAL; 231 result = STATE_CRITICAL;
243 else if (check_warning_time 232 else if (check_warning_time && (end_time - start_time) > warning_time)
244 && (end_time - start_time) > warning_time) result = 233 result = STATE_WARNING;
245 STATE_WARNING;
246 234
247 /* Put some HTML in here to create a dynamic link */ 235 /* Put some HTML in here to create a dynamic link */
248 printf (_("REAL %s - %d second response time\n"), 236 printf(_("REAL %s - %d second response time\n"), state_text(result), (int)(end_time - start_time));
249 state_text (result), 237 } else
250 (int) (end_time - start_time)); 238 printf("%s\n", status_line);
251 }
252 else
253 printf ("%s\n", status_line);
254 239
255 /* close the connection */ 240 /* close the connection */
256 close (sd); 241 close(sd);
257 242
258 /* reset the alarm */ 243 /* reset the alarm */
259 alarm (0); 244 alarm(0);
260 245
261 return result; 246 return result;
262} 247}
263 248
264
265
266/* process command-line arguments */ 249/* process command-line arguments */
267int 250int process_arguments(int argc, char **argv) {
268process_arguments (int argc, char **argv)
269{
270 int c; 251 int c;
271 252
272 int option = 0; 253 int option = 0;
273 static struct option longopts[] = { 254 static struct option longopts[] = {{"hostname", required_argument, 0, 'H'}, {"IPaddress", required_argument, 0, 'I'},
274 {"hostname", required_argument, 0, 'H'}, 255 {"expect", required_argument, 0, 'e'}, {"url", required_argument, 0, 'u'},
275 {"IPaddress", required_argument, 0, 'I'}, 256 {"port", required_argument, 0, 'p'}, {"critical", required_argument, 0, 'c'},
276 {"expect", required_argument, 0, 'e'}, 257 {"warning", required_argument, 0, 'w'}, {"timeout", required_argument, 0, 't'},
277 {"url", required_argument, 0, 'u'}, 258 {"verbose", no_argument, 0, 'v'}, {"version", no_argument, 0, 'V'},
278 {"port", required_argument, 0, 'p'}, 259 {"help", no_argument, 0, 'h'}, {0, 0, 0, 0}};
279 {"critical", required_argument, 0, 'c'},
280 {"warning", required_argument, 0, 'w'},
281 {"timeout", required_argument, 0, 't'},
282 {"verbose", no_argument, 0, 'v'},
283 {"version", no_argument, 0, 'V'},
284 {"help", no_argument, 0, 'h'},
285 {0, 0, 0, 0}
286 };
287 260
288 if (argc < 2) 261 if (argc < 2)
289 return ERROR; 262 return ERROR;
290 263
291 for (c = 1; c < argc; c++) { 264 for (c = 1; c < argc; c++) {
292 if (strcmp ("-to", argv[c]) == 0) 265 if (strcmp("-to", argv[c]) == 0)
293 strcpy (argv[c], "-t"); 266 strcpy(argv[c], "-t");
294 else if (strcmp ("-wt", argv[c]) == 0) 267 else if (strcmp("-wt", argv[c]) == 0)
295 strcpy (argv[c], "-w"); 268 strcpy(argv[c], "-w");
296 else if (strcmp ("-ct", argv[c]) == 0) 269 else if (strcmp("-ct", argv[c]) == 0)
297 strcpy (argv[c], "-c"); 270 strcpy(argv[c], "-c");
298 } 271 }
299 272
300 while (1) { 273 while (1) {
301 c = getopt_long (argc, argv, "+hvVI:H:e:u:p:w:c:t:", longopts, 274 c = getopt_long(argc, argv, "+hvVI:H:e:u:p:w:c:t:", longopts, &option);
302 &option);
303 275
304 if (c == -1 || c == EOF) 276 if (c == -1 || c == EOF)
305 break; 277 break;
306 278
307 switch (c) { 279 switch (c) {
308 case 'I': /* hostname */ 280 case 'I': /* hostname */
309 case 'H': /* hostname */ 281 case 'H': /* hostname */
310 if (server_address) 282 if (server_address)
311 break; 283 break;
312 else if (is_host (optarg)) 284 else if (is_host(optarg))
313 server_address = optarg; 285 server_address = optarg;
314 else 286 else
315 usage2 (_("Invalid hostname/address"), optarg); 287 usage2(_("Invalid hostname/address"), optarg);
316 break; 288 break;
317 case 'e': /* string to expect in response header */ 289 case 'e': /* string to expect in response header */
318 server_expect = optarg; 290 server_expect = optarg;
319 break; 291 break;
320 case 'u': /* server URL */ 292 case 'u': /* server URL */
321 server_url = optarg; 293 server_url = optarg;
322 break; 294 break;
323 case 'p': /* port */ 295 case 'p': /* port */
324 if (is_intpos (optarg)) { 296 if (is_intpos(optarg)) {
325 server_port = atoi (optarg); 297 server_port = atoi(optarg);
326 } 298 } else {
327 else { 299 usage4(_("Port must be a positive integer"));
328 usage4 (_("Port must be a positive integer"));
329 } 300 }
330 break; 301 break;
331 case 'w': /* warning time threshold */ 302 case 'w': /* warning time threshold */
332 if (is_intnonneg (optarg)) { 303 if (is_intnonneg(optarg)) {
333 warning_time = atoi (optarg); 304 warning_time = atoi(optarg);
334 check_warning_time = true; 305 check_warning_time = true;
335 } 306 } else {
336 else { 307 usage4(_("Warning time must be a positive integer"));
337 usage4 (_("Warning time must be a positive integer"));
338 } 308 }
339 break; 309 break;
340 case 'c': /* critical time threshold */ 310 case 'c': /* critical time threshold */
341 if (is_intnonneg (optarg)) { 311 if (is_intnonneg(optarg)) {
342 critical_time = atoi (optarg); 312 critical_time = atoi(optarg);
343 check_critical_time = true; 313 check_critical_time = true;
344 } 314 } else {
345 else { 315 usage4(_("Critical time must be a positive integer"));
346 usage4 (_("Critical time must be a positive integer"));
347 } 316 }
348 break; 317 break;
349 case 'v': /* verbose */ 318 case 'v': /* verbose */
350 verbose = true; 319 verbose = true;
351 break; 320 break;
352 case 't': /* timeout */ 321 case 't': /* timeout */
353 if (is_intnonneg (optarg)) { 322 if (is_intnonneg(optarg)) {
354 socket_timeout = atoi (optarg); 323 socket_timeout = atoi(optarg);
355 } 324 } else {
356 else { 325 usage4(_("Timeout interval must be a positive integer"));
357 usage4 (_("Timeout interval must be a positive integer"));
358 } 326 }
359 break; 327 break;
360 case 'V': /* version */ 328 case 'V': /* version */
361 print_revision (progname, NP_VERSION); 329 print_revision(progname, NP_VERSION);
362 exit (STATE_UNKNOWN); 330 exit(STATE_UNKNOWN);
363 case 'h': /* help */ 331 case 'h': /* help */
364 print_help (); 332 print_help();
365 exit (STATE_UNKNOWN); 333 exit(STATE_UNKNOWN);
366 case '?': /* usage */ 334 case '?': /* usage */
367 usage5 (); 335 usage5();
368 } 336 }
369 } 337 }
370 338
371 c = optind; 339 c = optind;
372 if (server_address==NULL && argc>c) { 340 if (server_address == NULL && argc > c) {
373 if (is_host (argv[c])) { 341 if (is_host(argv[c])) {
374 server_address = argv[c++]; 342 server_address = argv[c++];
375 } 343 } else {
376 else { 344 usage2(_("Invalid hostname/address"), argv[c]);
377 usage2 (_("Invalid hostname/address"), argv[c]);
378 } 345 }
379 } 346 }
380 347
381 if (server_address==NULL) 348 if (server_address == NULL)
382 usage4 (_("You must provide a server to check")); 349 usage4(_("You must provide a server to check"));
383 350
384 if (host_name==NULL) 351 if (host_name == NULL)
385 host_name = strdup (server_address); 352 host_name = strdup(server_address);
386 353
387 if (server_expect == NULL) 354 if (server_expect == NULL)
388 server_expect = strdup(EXPECT); 355 server_expect = strdup(EXPECT);
389 356
390 return validate_arguments (); 357 return validate_arguments();
391} 358}
392 359
360int validate_arguments(void) { return OK; }
393 361
394 362void print_help(void) {
395int
396validate_arguments (void)
397{
398 return OK;
399}
400
401
402
403void
404print_help (void)
405{
406 char *myport; 363 char *myport;
407 xasprintf (&myport, "%d", PORT); 364 xasprintf(&myport, "%d", PORT);
408 365
409 print_revision (progname, NP_VERSION); 366 print_revision(progname, NP_VERSION);
410 367
411 printf ("Copyright (c) 1999 Pedro Leite <leite@cic.ua.pt>\n"); 368 printf("Copyright (c) 1999 Pedro Leite <leite@cic.ua.pt>\n");
412 printf (COPYRIGHT, copyright, email); 369 printf(COPYRIGHT, copyright, email);
413 370
414 printf ("%s\n", _("This plugin tests the REAL service on the specified host.")); 371 printf("%s\n", _("This plugin tests the REAL service on the specified host."));
415 372
416 printf ("\n\n"); 373 printf("\n\n");
417 374
418 print_usage (); 375 print_usage();
419 376
420 printf (UT_HELP_VRSN); 377 printf(UT_HELP_VRSN);
421 printf (UT_EXTRA_OPTS); 378 printf(UT_EXTRA_OPTS);
422 379
423 printf (UT_HOST_PORT, 'p', myport); 380 printf(UT_HOST_PORT, 'p', myport);
424 381
425 printf (" %s\n", "-u, --url=STRING"); 382 printf(" %s\n", "-u, --url=STRING");
426 printf (" %s\n", _("Connect to this url")); 383 printf(" %s\n", _("Connect to this url"));
427 printf (" %s\n", "-e, --expect=STRING"); 384 printf(" %s\n", "-e, --expect=STRING");
428 printf (_("String to expect in first line of server response (default: %s)\n"), 385 printf(_("String to expect in first line of server response (default: %s)\n"), EXPECT);
429 EXPECT);
430 386
431 printf (UT_WARN_CRIT); 387 printf(UT_WARN_CRIT);
432 388
433 printf (UT_CONN_TIMEOUT, DEFAULT_SOCKET_TIMEOUT); 389 printf(UT_CONN_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);
434 390
435 printf (UT_VERBOSE); 391 printf(UT_VERBOSE);
436 392
437 printf ("\n"); 393 printf("\n");
438 printf ("%s\n", _("This plugin will attempt to open an RTSP connection with the host.")); 394 printf("%s\n", _("This plugin will attempt to open an RTSP connection with the host."));
439 printf ("%s\n", _("Successful connects return STATE_OK, refusals and timeouts return")); 395 printf("%s\n", _("Successful connects return STATE_OK, refusals and timeouts return"));
440 printf ("%s\n", _("STATE_CRITICAL, other errors return STATE_UNKNOWN. Successful connects,")); 396 printf("%s\n", _("STATE_CRITICAL, other errors return STATE_UNKNOWN. Successful connects,"));
441 printf ("%s\n", _("but incorrect response messages from the host result in STATE_WARNING return")); 397 printf("%s\n", _("but incorrect response messages from the host result in STATE_WARNING return"));
442 printf ("%s\n", _("values.")); 398 printf("%s\n", _("values."));
443 399
444 printf (UT_SUPPORT); 400 printf(UT_SUPPORT);
445} 401}
446 402
447 403void print_usage(void) {
448 404 printf("%s\n", _("Usage:"));
449void 405 printf("%s -H host [-e expect] [-p port] [-w warn] [-c crit] [-t timeout] [-v]\n", progname);
450print_usage (void)
451{
452 printf ("%s\n", _("Usage:"));
453 printf ("%s -H host [-e expect] [-p port] [-w warn] [-c crit] [-t timeout] [-v]\n", progname);
454} 406}