summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorKarl DeBisschop <kdebisschop@users.sourceforge.net>2003-08-07 23:17:53 (GMT)
committerKarl DeBisschop <kdebisschop@users.sourceforge.net>2003-08-07 23:17:53 (GMT)
commitee37af8e56af48faab21a07c0cde1fa1d31c7849 (patch)
tree1e226de91b2db49a2bc439a73932f93204916d13 /plugins
parent575e82a500d1b097b70883a8e50f4b92451d8270 (diff)
downloadmonitoring-plugins-ee37af8e56af48faab21a07c0cde1fa1d31c7849.tar.gz
markup for translation
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@660 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/check_real.c195
1 files changed, 91 insertions, 104 deletions
diff --git a/plugins/check_real.c b/plugins/check_real.c
index 875f9c4..ecdd561 100644
--- a/plugins/check_real.c
+++ b/plugins/check_real.c
@@ -1,62 +1,39 @@
1/***************************************************************************** 1/******************************************************************************
2* 2
3* CHECK_REAL.C 3 This program is free software; you can redistribute it and/or modify
4* 4 it under the terms of the GNU General Public License as published by
5* Program: RealMedia plugin for Nagios 5 the Free Software Foundation; either version 2 of the License, or
6* License: GPL 6 (at your option) any later version.
7* Copyright (c) 1999 Pedro Leite (leite@cic.ua.pt) 7
8* 8 This program is distributed in the hope that it will be useful,
9* Based on CHECK_HTTP.C 9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10* Copyright (c) 1999 Ethan Galstad (nagios@nagios.org) 10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11* 11 GNU General Public License for more details.
12* Last Modified: $Date$ 12
13* 13 You should have received a copy of the GNU General Public License
14* Command line: CHECK_REAL <host_address> [-e expect] [-u url] [-p port] 14 along with this program; if not, write to the Free Software
15* [-hn host_name] [-wt warn_time] [-ct crit_time] 15 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
16* [-to to_sec] 16
17* 17******************************************************************************/
18* Description: 18
19* 19const char *progname = "check_real";
20* This plugin will attempt to open an RTSP connection with the host. 20const char *revision = "$Revision$";
21* Successul connects return STATE_OK, refusals and timeouts return 21const char *copyright = "2000-2003";
22* STATE_CRITICAL, other errors return STATE_UNKNOWN. Successful connects, 22const char *email = "nagiosplug-devel@lists.sourceforge.net";
23* but incorrect reponse messages from the host result in STATE_WARNING return 23
24* values. If you are checking a virtual server that uses "host headers"you
25* must supply the FQDN (fully qualified domain name) as the [host_name]
26* argument.
27*
28* License Information:
29*
30* This program is free software; you can redistribute it and/or modify
31* it under the terms of the GNU General Public License as published by
32* the Free Software Foundation; either version 2 of the License, or
33* (at your option) any later version.
34*
35* This program is distributed in the hope that it will be useful,
36* but WITHOUT ANY WARRANTY; without even the implied warranty of
37* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
38* GNU General Public License for more details.
39*
40* You should have received a copy of the GNU General Public License
41* along with this program; if not, write to the Free Software
42* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
43*
44****************************************************************************/
45
46#include "config.h"
47#include "common.h" 24#include "common.h"
48#include "netutils.h" 25#include "netutils.h"
49#include "utils.h" 26#include "utils.h"
50 27
51const char *progname = "check_real"; 28enum {
29 PORT = 554
30};
52 31
53#define PORT 554
54#define EXPECT "RTSP/1." 32#define EXPECT "RTSP/1."
55#define URL "" 33#define URL ""
56 34
57int process_arguments (int, char **); 35int process_arguments (int, char **);
58int validate_arguments (void); 36int validate_arguments (void);
59int check_disk (int usp, int free_disk);
60void print_help (void); 37void print_help (void);
61void print_usage (void); 38void print_usage (void);
62 39
@@ -71,6 +48,11 @@ int critical_time = 0;
71int check_critical_time = FALSE; 48int check_critical_time = FALSE;
72int verbose = FALSE; 49int verbose = FALSE;
73 50
51
52
53
54
55
74int 56int
75main (int argc, char **argv) 57main (int argc, char **argv)
76{ 58{
@@ -80,7 +62,7 @@ main (int argc, char **argv)
80 char *status_line = NULL; 62 char *status_line = NULL;
81 63
82 if (process_arguments (argc, argv) != OK) 64 if (process_arguments (argc, argv) != OK)
83 usage ("Invalid command arguments supplied\n"); 65 usage (_("Invalid command arguments supplied\n"));
84 66
85 /* initialize alarm signal handling */ 67 /* initialize alarm signal handling */
86 signal (SIGALRM, socket_timeout_alarm_handler); 68 signal (SIGALRM, socket_timeout_alarm_handler);
@@ -91,7 +73,7 @@ main (int argc, char **argv)
91 73
92 /* try to connect to the host at the given port number */ 74 /* try to connect to the host at the given port number */
93 if (my_tcp_connect (server_address, server_port, &sd) != STATE_OK) 75 if (my_tcp_connect (server_address, server_port, &sd) != STATE_OK)
94 die (STATE_CRITICAL, "Unable to connect to %s on port %d\n", 76 die (STATE_CRITICAL, _("Unable to connect to %s on port %d\n"),
95 server_address, server_port); 77 server_address, server_port);
96 78
97 /* Part I - Server Check */ 79 /* Part I - Server Check */
@@ -113,14 +95,14 @@ main (int argc, char **argv)
113 95
114 /* return a CRITICAL status if we couldn't read any data */ 96 /* return a CRITICAL status if we couldn't read any data */
115 if (result == -1) 97 if (result == -1)
116 die (STATE_CRITICAL, "No data received from %s\n", host_name); 98 die (STATE_CRITICAL, _("No data received from %s\n"), host_name);
117 99
118 /* make sure we find the response we are looking for */ 100 /* make sure we find the response we are looking for */
119 if (!strstr (buffer, server_expect)) { 101 if (!strstr (buffer, server_expect)) {
120 if (server_port == PORT) 102 if (server_port == PORT)
121 printf ("Invalid REAL response received from host\n"); 103 printf (_("Invalid REAL response received from host\n"));
122 else 104 else
123 printf ("Invalid REAL response received from host on port %d\n", 105 printf (_("Invalid REAL response received from host on port %d\n"),
124 server_port); 106 server_port);
125 } 107 }
126 else { 108 else {
@@ -184,16 +166,16 @@ main (int argc, char **argv)
184 166
185 /* return a CRITICAL status if we couldn't read any data */ 167 /* return a CRITICAL status if we couldn't read any data */
186 if (result == -1) { 168 if (result == -1) {
187 printf ("No data received from host\n"); 169 printf (_("No data received from host\n"));
188 result = STATE_CRITICAL; 170 result = STATE_CRITICAL;
189 } 171 }
190 else { 172 else {
191 /* make sure we find the response we are looking for */ 173 /* make sure we find the response we are looking for */
192 if (!strstr (buffer, server_expect)) { 174 if (!strstr (buffer, server_expect)) {
193 if (server_port == PORT) 175 if (server_port == PORT)
194 printf ("Invalid REAL response received from host\n"); 176 printf (_("Invalid REAL response received from host\n"));
195 else 177 else
196 printf ("Invalid REAL response received from host on port %d\n", 178 printf (_("Invalid REAL response received from host on port %d\n"),
197 server_port); 179 server_port);
198 } 180 }
199 else { 181 else {
@@ -247,8 +229,8 @@ main (int argc, char **argv)
247 STATE_WARNING; 229 STATE_WARNING;
248 230
249 /* Put some HTML in here to create a dynamic link */ 231 /* Put some HTML in here to create a dynamic link */
250 printf ("REAL %s - %d second response time\n", 232 printf (_("REAL %s - %d second response time\n"),
251 (result == STATE_OK) ? "ok" : "problem", 233 state_text (result),
252 (int) (end_time - start_time)); 234 (int) (end_time - start_time));
253 } 235 }
254 else 236 else
@@ -267,7 +249,7 @@ main (int argc, char **argv)
267 249
268 250
269 251
270 252
271/* process command-line arguments */ 253/* process command-line arguments */
272int 254int
273process_arguments (int argc, char **argv) 255process_arguments (int argc, char **argv)
@@ -316,7 +298,7 @@ process_arguments (int argc, char **argv)
316 server_address = optarg; 298 server_address = optarg;
317 } 299 }
318 else { 300 else {
319 usage ("Invalid host name\n"); 301 usage (_("Invalid host name\n"));
320 } 302 }
321 break; 303 break;
322 case 'e': /* string to expect in response header */ 304 case 'e': /* string to expect in response header */
@@ -330,7 +312,7 @@ process_arguments (int argc, char **argv)
330 server_port = atoi (optarg); 312 server_port = atoi (optarg);
331 } 313 }
332 else { 314 else {
333 usage ("Server port must be a positive integer\n"); 315 usage (_("Server port must be a positive integer\n"));
334 } 316 }
335 break; 317 break;
336 case 'w': /* warning time threshold */ 318 case 'w': /* warning time threshold */
@@ -339,7 +321,7 @@ process_arguments (int argc, char **argv)
339 check_warning_time = TRUE; 321 check_warning_time = TRUE;
340 } 322 }
341 else { 323 else {
342 usage ("Warning time must be a nonnegative integer\n"); 324 usage (_("Warning time must be a nonnegative integer\n"));
343 } 325 }
344 break; 326 break;
345 case 'c': /* critical time threshold */ 327 case 'c': /* critical time threshold */
@@ -348,7 +330,7 @@ process_arguments (int argc, char **argv)
348 check_critical_time = TRUE; 330 check_critical_time = TRUE;
349 } 331 }
350 else { 332 else {
351 usage ("Critical time must be a nonnegative integer\n"); 333 usage (_("Critical time must be a nonnegative integer\n"));
352 } 334 }
353 break; 335 break;
354 case 'v': /* verbose */ 336 case 'v': /* verbose */
@@ -359,7 +341,7 @@ process_arguments (int argc, char **argv)
359 socket_timeout = atoi (optarg); 341 socket_timeout = atoi (optarg);
360 } 342 }
361 else { 343 else {
362 usage ("Time interval must be a nonnegative integer\n"); 344 usage (_("Time interval must be a nonnegative integer\n"));
363 } 345 }
364 break; 346 break;
365 case 'V': /* version */ 347 case 'V': /* version */
@@ -368,8 +350,8 @@ process_arguments (int argc, char **argv)
368 case 'h': /* help */ 350 case 'h': /* help */
369 print_help (); 351 print_help ();
370 exit (STATE_OK); 352 exit (STATE_OK);
371 case '?': /* help */ 353 case '?': /* usage */
372 usage ("Invalid argument\n"); 354 usage (_("Invalid argument\n"));
373 } 355 }
374 } 356 }
375 357
@@ -379,12 +361,12 @@ process_arguments (int argc, char **argv)
379 server_address = argv[c++]; 361 server_address = argv[c++];
380 } 362 }
381 else { 363 else {
382 usage ("Invalid host name"); 364 usage (_("Invalid host name"));
383 } 365 }
384 } 366 }
385 367
386 if (strlen(server_address) == 0) 368 if (strlen(server_address) == 0)
387 usage ("You must provide a server to check\n"); 369 usage (_("You must provide a server to check\n"));
388 370
389 if (strlen(host_name) == 0) 371 if (strlen(host_name) == 0)
390 asprintf (&host_name, "%s", server_address); 372 asprintf (&host_name, "%s", server_address);
@@ -405,41 +387,47 @@ validate_arguments (void)
405 387
406 388
407 389
408 390
409void 391void
410print_help (void) 392print_help (void)
411{ 393{
394 char *myport;
395 asprintf (&myport, "%d", PORT);
396
412 print_revision (progname, "$Revision$"); 397 print_revision (progname, "$Revision$");
413 printf 398
414 ("Copyright (c) 2000 Pedro Leite (leite@cic.ua.pt)/Karl DeBisschop\n\n" 399 printf (_("Copyright (c) 1999 Pedro Leite <leite@cic.ua.pt>\n"));
415 "This plugin tests the REAL service on the specified host.\n\n"); 400 printf (_(COPYRIGHT), copyright, email);
401
402 printf (_("This plugin tests the REAL service on the specified host.\n\n"));
403
416 print_usage (); 404 print_usage ();
417 printf 405
418 ("\nOptions:\n" 406 printf (_(UT_HELP_VRSN));
419 " -H, --hostname=STRING or IPADDRESS\n" 407
420 " Check this server on the indicated host\n" 408 printf (_(UT_HOST_PORT), 'p', myport);
421 " -I, --IPaddress=STRING or IPADDRESS\n" 409
422 " Check server at this host address\n" 410 printf (_("\
423 " -p, --port=INTEGER\n" 411 -u, --url=STRING\n\
424 " Make connection on the indicated port (default: %d)\n" 412 Connect to this url\n\
425 " -u, --url=STRING\n" 413 -e, --expect=STRING\n\
426 " Connect to this url\n" 414 String to expect in first line of server response (default: %s)\n"),
427 " -e, --expect=STRING\n" 415 EXPECT);
428 " String to expect in first line of server response (default: %s)\n" 416
429 " -w, --warning=INTEGER\n" 417 printf (_(UT_WARN_CRIT));
430 " Seconds necessary to result in a warning status\n" 418
431 " -c, --critical=INTEGER\n" 419 printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
432 " Seconds necessary to result in a critical status\n" 420
433 " -t, --timeout=INTEGER\n" 421 printf (_(UT_VERBOSE));
434 " Seconds before connection attempt times out (default: %d)\n" 422
435 " -v, --verbose\n" 423 printf(_("\
436 " Print extra information (command-line use only)\n" 424This plugin will attempt to open an RTSP connection with the host.\n\
437 " -h, --help\n" 425Successul connects return STATE_OK, refusals and timeouts return\n\
438 " Print detailed help screen\n" 426STATE_CRITICAL, other errors return STATE_UNKNOWN. Successful connects,\n\
439 " -V, --version\n" 427but incorrect reponse messages from the host result in STATE_WARNING return\n\
440 " Print version information\n\n", 428values."));
441 PORT, EXPECT, DEFAULT_SOCKET_TIMEOUT); 429
442 support (); 430 printf (_(UT_SUPPORT));
443} 431}
444 432
445 433
@@ -449,9 +437,8 @@ print_help (void)
449void 437void
450print_usage (void) 438print_usage (void)
451{ 439{
452 printf 440 printf ("\
453 ("Usage: %s -H host [-e expect] [-p port] [-w warn] [-c crit]\n" 441Usage: %s -H host [-e expect] [-p port] [-w warn] [-c crit]\n\
454 " [-t timeout] [-v]\n" 442 [-t timeout] [-v]\n", progname);
455 " %s --help\n" 443 printf (_(UT_HLP_VRS), progname, progname);
456 " %s --version\n", progname, progname, progname);
457} 444}