From 230d67e18ad368773f2302485d0b55f50f654e3f Mon Sep 17 00:00:00 2001 From: Benoit Mortier Date: Thu, 2 Dec 2004 01:11:01 +0000 Subject: [PATCH] changed Error: by CRITICAL - more localization fixes git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@971 f882894a-f735-0410-b71e-b25c423dba1c --- plugins/check_dns.c | 2 +- plugins/check_game.c | 10 +++++----- plugins/check_http.c | 12 ++++++------ plugins/check_ide-smart.c | 2 +- plugins/check_load.c | 15 ++------------- plugins/check_mrtgtraf.c | 8 +++----- plugins/check_mysql.c | 2 ++ plugins/check_nagios.c | 6 +++--- plugins/check_nt.c | 4 ++-- plugins/check_nwstat.c | 16 ++++++++-------- plugins/check_overcr.c | 6 +++--- plugins/check_pgsql.c | 2 +- plugins/check_ping.c | 4 ++-- plugins/check_procs.c | 2 +- plugins/check_radius.c | 2 +- plugins/check_real.c | 4 ++-- plugins/check_snmp.c | 2 +- plugins/check_ssh.c | 2 +- plugins/check_tcp.c | 18 +++++++++--------- plugins/check_time.c | 2 +- plugins/check_udp.c | 2 +- plugins/check_ups.c | 8 ++++---- plugins/negate.c | 2 +- plugins/popen.c | 2 +- 24 files changed, 62 insertions(+), 73 deletions(-) diff --git a/plugins/check_dns.c b/plugins/check_dns.c index fa7fbc1..9ab001f 100644 --- a/plugins/check_dns.c +++ b/plugins/check_dns.c @@ -107,7 +107,7 @@ main (int argc, char **argv) if ((temp_buffer = strstr (input_buffer, "name = "))) address = strdup (temp_buffer + 7); else { - output = strdup (_("Unknown error (plugin)")); + output = strdup (_("Warning plugin error")); result = STATE_WARNING; } } diff --git a/plugins/check_game.c b/plugins/check_game.c index 8b2a6c4..3a8b9f5 100644 --- a/plugins/check_game.c +++ b/plugins/check_game.c @@ -67,7 +67,7 @@ main (int argc, char **argv) // result = process_arguments (argc, argv); - if (process_arguments (argc, argv) == ERROR) + if (process_arguments (argc, argv) != OK) usage (_("check_game: could not parse arguments\n")); /* if (result != OK) { @@ -116,7 +116,7 @@ main (int argc, char **argv) */ if (!strncmp (input_buffer, "unknown option", 14)) { - printf (_("ERROR: Host type parameter incorrect!\n")); + printf (_("CRITICAL - Host type parameter incorrect!\n")); result = STATE_CRITICAL; return result; } @@ -136,15 +136,15 @@ main (int argc, char **argv) } if (strstr (ret[2], QSTAT_HOST_ERROR)) { - printf ("ERROR: Host not found\n"); + printf ("CRITICAL - Host not found\n"); result = STATE_CRITICAL; } else if (strstr (ret[2], QSTAT_HOST_DOWN)) { - printf ("ERROR: Game server down or unavailable\n"); + printf ("CRITICAL - Game server down or unavailable\n"); result = STATE_CRITICAL; } else if (strstr (ret[2], QSTAT_HOST_TIMEOUT)) { - printf ("ERROR: Game server timeout\n"); + printf ("CRITICAL - Game server timeout\n"); result = STATE_CRITICAL; } else { diff --git a/plugins/check_http.c b/plugins/check_http.c index 748ca46..f5a6c2b 100644 --- a/plugins/check_http.c +++ b/plugins/check_http.c @@ -145,7 +145,7 @@ main (int argc, char **argv) asprintf (&user_agent, "User-Agent: check_http/%s (nagios-plugins %s)", clean_revstring (revision), VERSION); - if (process_arguments (argc, argv) == ERROR) + if (process_arguments (argc, argv) != OK) usage (_("check_http: could not parse arguments\n")); if (strstr (timestamp, ":")) { @@ -174,7 +174,7 @@ main (int argc, char **argv) X509_free (server_cert); } else { - printf (_("ERROR: Cannot retrieve server certificate.\n")); + printf (_("CRITICAL - Cannot retrieve server certificate.\n")); result = STATE_CRITICAL; } SSL_shutdown (ssl); @@ -738,7 +738,7 @@ check_http (void) X509_free (server_cert); } else { - printf (_("ERROR: Cannot retrieve server certificate.\n")); + printf (_("CRITICAL - Cannot retrieve server certificate.\n")); return STATE_CRITICAL; } @@ -1049,11 +1049,11 @@ redir (char *pos, char *status_line) addr = malloc (MAX_IPV4_HOSTLENGTH + 1); if (addr == NULL) - die (STATE_UNKNOWN, _("ERROR: could not allocate addr\n")); + die (STATE_UNKNOWN, _("could not allocate addr\n")); url = malloc (strcspn (pos, "\r\n")); if (url == NULL) - die (STATE_UNKNOWN, _("ERROR: could not allocate url\n")); + die (STATE_UNKNOWN, _("could not allocate url\n")); while (pos) { @@ -1073,7 +1073,7 @@ redir (char *pos, char *status_line) url = realloc (url, strcspn (pos, "\r\n")); if (url == NULL) - die (STATE_UNKNOWN, _("ERROR: could not allocate url\n")); + die (STATE_UNKNOWN, _("could not allocate url\n")); /* URI_HTTP, URI_HOST, URI_PORT, URI_PATH */ if (sscanf (pos, HD1, type, addr, port, url) == 4) { diff --git a/plugins/check_ide-smart.c b/plugins/check_ide-smart.c index 9d3c316..bcace8a 100644 --- a/plugins/check_ide-smart.c +++ b/plugins/check_ide-smart.c @@ -249,7 +249,7 @@ net_saint (values_t * p, thresholds_t * t) total); break; case OPERATIONAL: - printf (_("STATUS - Operational (%d/%d tests passed)\n"), passed, total); + printf (_("OK - Operational (%d/%d tests passed)\n"), passed, total); break; default: printf (_("ERROR - Status '%d' uknown. %d/%d tests passed\n"), status, diff --git a/plugins/check_load.c b/plugins/check_load.c index babe84b..616c3e0 100644 --- a/plugins/check_load.c +++ b/plugins/check_load.c @@ -51,9 +51,6 @@ char *status_line; - - - int main (int argc, char **argv) { @@ -76,7 +73,7 @@ main (int argc, char **argv) bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); - if (process_arguments (argc, argv) == ERROR) + if (process_arguments (argc, argv) != OK) usage (_("check_load: could not parse arguments\n")); #if HAVE_GETLOADAVG==1 @@ -162,9 +159,6 @@ main (int argc, char **argv) - - - /* process command-line arguments */ int process_arguments (int argc, char **argv) @@ -223,7 +217,7 @@ process_arguments (int argc, char **argv) usage (_("Critical threshold must be float or float triplet!\n")); break; case 'V': /* version */ - print_revision (progname, "$Revision$"); + print_revision (progname, revision); exit (STATE_OK); case 'h': /* help */ print_help (); @@ -271,8 +265,6 @@ process_arguments (int argc, char **argv) - - int validate_arguments (void) { @@ -299,9 +291,6 @@ validate_arguments (void) - - - void print_help (void) { diff --git a/plugins/check_mrtgtraf.c b/plugins/check_mrtgtraf.c index 0b0f49e..b9c277b 100644 --- a/plugins/check_mrtgtraf.c +++ b/plugins/check_mrtgtraf.c @@ -191,7 +191,9 @@ main (int argc, char **argv) return result; } - + + + /* process command-line arguments */ int process_arguments (int argc, char **argv) @@ -303,8 +305,6 @@ process_arguments (int argc, char **argv) - - int validate_arguments (void) { @@ -313,8 +313,6 @@ validate_arguments (void) - - void print_help (void) { diff --git a/plugins/check_mysql.c b/plugins/check_mysql.c index ffd96ed..703a1ba 100644 --- a/plugins/check_mysql.c +++ b/plugins/check_mysql.c @@ -39,6 +39,8 @@ int validate_arguments (void); void print_help (void); void print_usage (void); + + int main (int argc, char **argv) { diff --git a/plugins/check_nagios.c b/plugins/check_nagios.c index 4439251..bb2ae6d 100644 --- a/plugins/check_nagios.c +++ b/plugins/check_nagios.c @@ -65,7 +65,7 @@ main (int argc, char **argv) bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); - if (process_arguments (argc, argv) == ERROR) + if (process_arguments (argc, argv) != OK) usage (_("check_nagios: could not parse arguments\n")); /* Set signal handling and alarm */ @@ -80,7 +80,7 @@ main (int argc, char **argv) /* open the status log */ fp = fopen (status_log, "r"); if (fp == NULL) { - printf (_("ERROR - Cannot open status log for reading!\n")); + printf (_("CRITICAL - Cannot open status log for reading!\n")); return STATE_CRITICAL; } @@ -227,7 +227,7 @@ process_arguments (int argc, char **argv) print_help (); exit (STATE_OK); case 'V': /* version */ - print_revision (progname, "$Revision$"); + print_revision (progname, revision); exit (STATE_OK); case 'F': /* status log */ status_log = optarg; diff --git a/plugins/check_nt.c b/plugins/check_nt.c index 84b78bc..15f3dc3 100644 --- a/plugins/check_nt.c +++ b/plugins/check_nt.c @@ -110,8 +110,8 @@ int main(int argc, char **argv){ bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); - if(process_arguments(argc,argv)==ERROR) - usage(_("check_nt: could not parse arguments\n")); + if(process_arguments(argc,argv) != OK) + usage (_("check_nt: could not parse arguments\n")); /* initialize alarm signal handling */ signal(SIGALRM,socket_timeout_alarm_handler); diff --git a/plugins/check_nwstat.c b/plugins/check_nwstat.c index ec5d5d6..6a21f90 100644 --- a/plugins/check_nwstat.c +++ b/plugins/check_nwstat.c @@ -121,8 +121,8 @@ main(int argc, char **argv) { bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); - if (process_arguments(argc,argv)==ERROR) - usage(_("check_nwstat: could not parse arguments\n")); + if (process_arguments(argc,argv) != OK) + usage (_("check_nwstat: could not parse arguments\n")); /* initialize alarm signal handling */ signal(SIGALRM,socket_timeout_alarm_handler); @@ -293,7 +293,7 @@ main(int argc, char **argv) { return result; if (!strcmp(recv_buffer,"-1\n")) { - asprintf (&output_message,_("Error: Volume '%s' does not exist!"),volume_name); + asprintf (&output_message,_("CRITICAL - Volume '%s' does not exist!"),volume_name); result=STATE_CRITICAL; } else { free_disk_space=strtoul(recv_buffer,NULL,10); @@ -318,7 +318,7 @@ main(int argc, char **argv) { if (!strcmp(recv_buffer,"-1\n")) { - asprintf (&output_message,_("Error: Volume '%s' does not exist!"),volume_name); + asprintf (&output_message,_("CRITICAL - Volume '%s' does not exist!"),volume_name); result=STATE_CRITICAL; } else { @@ -438,7 +438,7 @@ main(int argc, char **argv) { return result; if (!strcmp(recv_buffer,"-1\n")) { - asprintf (&output_message,_("Error: Volume '%s' does not exist!"),volume_name); + asprintf (&output_message,_("CRITICAL - Volume '%s' does not exist!"),volume_name); result=STATE_CRITICAL; } else { purgeable_disk_space=strtoul(recv_buffer,NULL,10); @@ -459,7 +459,7 @@ main(int argc, char **argv) { if (!strcmp(recv_buffer,"-1\n")) { - asprintf (&output_message,_("Error: Volume '%s' does not exist!"),volume_name); + asprintf (&output_message,_("CRITICAL - Volume '%s' does not exist!"),volume_name); result=STATE_CRITICAL; } else { @@ -491,7 +491,7 @@ main(int argc, char **argv) { return result; if (!strcmp(recv_buffer,"-1\n")) { - asprintf (&output_message,_("Error: Volume '%s' does not exist!"),volume_name); + asprintf (&output_message,_("CRITICAL - Volume '%s' does not exist!"),volume_name); result=STATE_CRITICAL; } else { non_purgeable_disk_space=strtoul(recv_buffer,NULL,10); @@ -512,7 +512,7 @@ main(int argc, char **argv) { if (!strcmp(recv_buffer,"-1\n")) { - asprintf (&output_message,_("Error: Volume '%s' does not exist!"),volume_name); + asprintf (&output_message,_("CRITICAL - Volume '%s' does not exist!"),volume_name); result=STATE_CRITICAL; } else { diff --git a/plugins/check_overcr.c b/plugins/check_overcr.c index 6682d8e..fea87da 100644 --- a/plugins/check_overcr.c +++ b/plugins/check_overcr.c @@ -85,7 +85,7 @@ main (int argc, char **argv) bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); - if (process_arguments (argc, argv) == ERROR) + if (process_arguments (argc, argv) != OK) usage (_("check_overcr: could not parse arguments\n")); /* initialize alarm signal handling */ @@ -180,7 +180,7 @@ main (int argc, char **argv) /* error if we couldn't find the info for the disk */ if (found_disk == FALSE) die (STATE_CRITICAL, - "Error: Disk '%s' non-existent or not mounted", + "CRITICAL - Disk '%s' non-existent or not mounted", disk_name); if (check_critical_value == TRUE && (percent_used_disk_space >= critical_value)) @@ -339,7 +339,7 @@ process_arguments (int argc, char **argv) print_help (); exit (STATE_OK); case 'V': /* version */ - print_revision (progname, "$Revision$"); + print_revision (progname, revision); exit (STATE_OK); case 'H': /* hostname */ server_address = optarg; diff --git a/plugins/check_pgsql.c b/plugins/check_pgsql.c index 53ba295..bbf47f0 100644 --- a/plugins/check_pgsql.c +++ b/plugins/check_pgsql.c @@ -132,7 +132,7 @@ main (int argc, char **argv) bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); - if (process_arguments (argc, argv) == ERROR) + if (process_arguments (argc, argv) != OK) usage (_("check_pgsql: could not parse arguments\n")); /* Set signal handling and alarm */ diff --git a/plugins/check_ping.c b/plugins/check_ping.c index 260e1b6..0e09054 100644 --- a/plugins/check_ping.c +++ b/plugins/check_ping.c @@ -78,7 +78,7 @@ main (int argc, char **argv) addresses = malloc (sizeof(char*) * max_addr); addresses[0] = NULL; - if (process_arguments (argc, argv) == ERROR) + if (process_arguments (argc, argv) != OK) usage (_("check_ping: could not parse arguments\n")); /* Set signal handling and alarm */ @@ -121,7 +121,7 @@ main (int argc, char **argv) if (pl == UNKNOWN_PACKET_LOSS || rta < 0.0) { printf ("%s\n", cmd); die (STATE_UNKNOWN, - _("Error: Could not interpret output from ping command\n")); + _("CRITICAL - Could not interpret output from ping command\n")); } if (pl >= cpl || rta >= crta || rta < 0) diff --git a/plugins/check_procs.c b/plugins/check_procs.c index 011661c..b7f32c7 100644 --- a/plugins/check_procs.c +++ b/plugins/check_procs.c @@ -115,7 +115,7 @@ main (int argc, char **argv) asprintf (&metric_name, "PROCS"); metric = METRIC_PROCS; - if (process_arguments (argc, argv) == ERROR) + if (process_arguments (argc, argv) != OK) usage (_("check_procs: could not parse arguments\n")); /* Set signal handling and alarm timeout */ diff --git a/plugins/check_radius.c b/plugins/check_radius.c index 3e6bdca..b15ad6e 100644 --- a/plugins/check_radius.c +++ b/plugins/check_radius.c @@ -112,7 +112,7 @@ main (int argc, char **argv) bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); - if (process_arguments (argc, argv) == ERROR) + if (process_arguments (argc, argv) != OK) usage (_("check_radius: could not parse arguments\n")); str = strdup ("dictionary"); diff --git a/plugins/check_real.c b/plugins/check_real.c index 3686ff4..59ad7d0 100644 --- a/plugins/check_real.c +++ b/plugins/check_real.c @@ -345,7 +345,7 @@ process_arguments (int argc, char **argv) } break; case 'V': /* version */ - print_revision (progname, "$Revision$"); + print_revision (progname, revision); exit (STATE_OK); case 'h': /* help */ print_help (); @@ -395,7 +395,7 @@ print_help (void) char *myport; asprintf (&myport, "%d", PORT); - print_revision (progname, "$Revision$"); + print_revision (progname, revision); printf ("Copyright (c) 1999 Pedro Leite \n"); printf (COPYRIGHT, copyright, email); diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c index 7d0ebc9..5167eb5 100644 --- a/plugins/check_snmp.c +++ b/plugins/check_snmp.c @@ -156,7 +156,7 @@ main (int argc, char **argv) output_delim = strdup (DEFAULT_OUTPUT_DELIMITER); miblist = strdup (DEFAULT_MIBLIST); - if (process_arguments (argc, argv) == ERROR) + if (process_arguments (argc, argv) != OK) usage (_("check_snmp: could not parse arguments\n")); /* create the command line to execute */ diff --git a/plugins/check_ssh.c b/plugins/check_ssh.c index b78443f..46dd044 100644 --- a/plugins/check_ssh.c +++ b/plugins/check_ssh.c @@ -57,7 +57,7 @@ main (int argc, char **argv) bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); - if (process_arguments (argc, argv) == ERROR) + if (process_arguments (argc, argv) != OK) usage (_("check_ssh: could not parse arguments\n")); /* initialize alarm signal handling */ diff --git a/plugins/check_tcp.c b/plugins/check_tcp.c index 285932d..da70c5d 100644 --- a/plugins/check_tcp.c +++ b/plugins/check_tcp.c @@ -230,7 +230,7 @@ main (int argc, char **argv) } else { progname = strdup ("check_tcp"); - usage (_("ERROR: Generic check_tcp called with unknown service\n")); + usage (_("CRITICAL - Generic check_tcp called with unknown service\n")); } server_address = strdup ("127.0.0.1"); @@ -239,7 +239,7 @@ main (int argc, char **argv) server_quit = QUIT; status = strdup (""); - if (process_arguments (argc, argv) == ERROR) + if (process_arguments (argc, argv) != OK) usage (_("check_tcp: could not parse arguments\n")); /* use default expect if none listed in process_arguments() */ @@ -259,13 +259,13 @@ main (int argc, char **argv) #ifdef HAVE_SSL if (use_ssl && check_cert == TRUE) { if (connect_SSL () != OK) - die (STATE_CRITICAL,"TCP CRITICAL - Could not make SSL connection\n"); + die (STATE_CRITICAL,"CRITICAL - Could not make SSL connection\n"); if ((server_cert = SSL_get_peer_certificate (ssl)) != NULL) { result = check_certificate (&server_cert); X509_free(server_cert); } else { - printf("ERROR: Cannot retrieve server certificate.\n"); + printf("CRITICAL Cannot retrieve server certificate.\n"); result = STATE_CRITICAL; } SSL_shutdown (ssl); @@ -592,7 +592,7 @@ connect_SSL (void) OpenSSL_add_all_algorithms(); if ((ctx = SSL_CTX_new (meth)) == NULL) { - printf (_("ERROR: Cannot create SSL context.\n")); + printf (_("CRITICAL - Cannot create SSL context.\n")); return STATE_CRITICAL; } @@ -615,13 +615,13 @@ connect_SSL (void) if (SSL_connect(ssl) == 1) return OK; /* ERR_print_errors_fp (stderr); */ - printf (_("ERROR: Cannot make SSL connection ")); + printf (_("CRITICAL - Cannot make SSL connection ")); ERR_print_errors_fp (stdout); /* printf("\n"); */ } else { - printf (_("ERROR: Cannot initiate SSL handshake.\n")); + printf (_("CRITICAL - Cannot initiate SSL handshake.\n")); } SSL_free (ssl); } @@ -651,7 +651,7 @@ check_certificate (X509 ** certificate) /* Generate tm structure to process timestamp */ if (tm->type == V_ASN1_UTCTIME) { if (tm->length < 10) { - printf ("ERROR: Wrong time format in certificate.\n"); + printf ("CRITICAL - Wrong time format in certificate.\n"); return STATE_CRITICAL; } else { @@ -663,7 +663,7 @@ check_certificate (X509 ** certificate) } else { if (tm->length < 12) { - printf ("ERROR: Wrong time format in certificate.\n"); + printf ("CRITICAL - Wrong time format in certificate.\n"); return STATE_CRITICAL; } else { diff --git a/plugins/check_time.c b/plugins/check_time.c index 617b9e0..7c4fe41 100644 --- a/plugins/check_time.c +++ b/plugins/check_time.c @@ -124,7 +124,7 @@ main (int argc, char **argv) else result = STATE_UNKNOWN; die (result, - _("TIME UNKNOWN - no data on recv() from server %s, port %d\n"), + _("TIME UNKNOWN - no data received from server %s, port %d\n"), server_address, server_port); } diff --git a/plugins/check_udp.c b/plugins/check_udp.c index 64ab83a..3706a72 100644 --- a/plugins/check_udp.c +++ b/plugins/check_udp.c @@ -51,7 +51,7 @@ main (int argc, char **argv) bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); - if (process_arguments (argc, argv) == ERROR) + if (process_arguments (argc, argv) != OK) usage (_("check_udp: could not parse arguments\n")); /* initialize alarm signal handling */ diff --git a/plugins/check_ups.c b/plugins/check_ups.c index 7f88ec3..0e23c53 100644 --- a/plugins/check_ups.c +++ b/plugins/check_ups.c @@ -396,20 +396,20 @@ get_ups_variable (const char *varname, char *buf, size_t buflen) ptr = temp_buffer + strlen (varname) + 5; if (!strcmp (ptr, "NOT-SUPPORTED")) { - printf ("Error: Variable '%s' is not supported\n", varname); + printf ("CRITICAL - Variable '%s' is not supported\n", varname); return ERROR; } if (!strcmp (ptr, "DATA-STALE")) { - printf ("Error: UPS data is stale\n"); + printf ("CRITICAL - UPS data is stale\n"); return ERROR; } if (!strcmp (ptr, "UNKNOWN-UPS")) { if (ups_name) - printf ("Error: UPS '%s' is unknown\n", ups_name); + printf ("CRITICAL - UPS '%s' is unknown\n", ups_name); else - printf ("Error: UPS is unknown\n"); + printf ("CRITICAL - UPS is unknown\n"); return ERROR; } diff --git a/plugins/negate.c b/plugins/negate.c index 9e5cf46..93ef46b 100644 --- a/plugins/negate.c +++ b/plugins/negate.c @@ -83,7 +83,7 @@ main (int argc, char **argv) bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); - if (process_arguments (argc, argv) == ERROR) + if (process_arguments (argc, argv) != OK) usage (_("negate: could not parse arguments\n")); /* Set signal handling and alarm */ diff --git a/plugins/popen.c b/plugins/popen.c index d527c22..f05fe97 100644 --- a/plugins/popen.c +++ b/plugins/popen.c @@ -123,7 +123,7 @@ spopen (const char *cmdstring) str += strspn (str, " \t\r\n"); /* trim any leading whitespace */ if (i >= argc - 2) { - printf ("You've got a big problem buddy! You need more args!!!\n"); + printf ("CRITICAL - You need more args!!!\n"); return (NULL); } -- 2.30.2