Code

changed Error: by CRITICAL -
[nagiosplug.git] / plugins / check_dns.c
index 39023f950b45e8db31d9c6b41a5925417d1d7b4e..9ab001f7eea61cdcf8ef5a61e2012f5d374210b2 100644 (file)
@@ -16,6 +16,8 @@
 
  LIMITATION: nslookup on Solaris 7 can return output over 2 lines, which will not 
  be picked up by this plugin
+ $Id$
 
 ******************************************************************************/
 
@@ -71,7 +73,7 @@ main (int argc, char **argv)
        }
 
        if (process_arguments (argc, argv) != OK) {
-               print_usage ();
+               usage (_("check_dns: could not parse arguments\n"));
                return STATE_UNKNOWN;
        }
 
@@ -105,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;
                        }
                }
@@ -207,12 +209,14 @@ main (int argc, char **argv)
                printf (_("DNS CRITICAL - %s\n"),
                        !strcmp (output, "") ? _(" Probably a non-existent host/domain") : output);
        else
-               printf (_("DNS problem - %s\n"),
+               printf (_("DNS UNKNOW - %s\n"),
                        !strcmp (output, "") ? _(" Probably a non-existent host/domain") : output);
 
        return result;
 }
 
+
+
 int
 error_scan (char *input_buffer)
 {
@@ -261,6 +265,8 @@ error_scan (char *input_buffer)
 
 }
 
+
+
 /* process command-line arguments */
 int
 process_arguments (int argc, char **argv)
@@ -320,7 +326,7 @@ process_arguments (int argc, char **argv)
                        /* TODO: this is_host check is probably unnecessary. */
                        /* Better to confirm nslookup response matches */
                        if (is_host (optarg) == FALSE) {
-                               printf (_("Invalid server name/address\n\n"));
+                               printf (_("Invalid hostname/address\n\n"));
                                print_usage ();
                                exit (STATE_UNKNOWN);
                        }
@@ -331,9 +337,7 @@ process_arguments (int argc, char **argv)
                case 'r': /* reverse server name */
                        /* TODO: Is this is_host necessary? */
                        if (is_host (optarg) == FALSE) {
-                               printf (_("Invalid host name/address\n\n"));
-                               print_usage ();
-                               exit (STATE_UNKNOWN);
+                               usage2 (_("Invalid hostname/address"), optarg);
                        }
                        if (strlen (optarg) >= ADDRESS_LENGTH)
                                die (STATE_UNKNOWN, _("Input buffer overflow\n"));
@@ -361,7 +365,7 @@ process_arguments (int argc, char **argv)
        if (strlen(dns_server)==0 && c<argc) {
                /* TODO: See -s option */
                if (is_host(argv[c]) == FALSE) {
-                       printf (_("Invalid name/address: %s\n\n"), argv[c]);
+                       printf (_("Invalid hostname/address: %s\n\n"), argv[c]);
                        return ERROR;
                }
                if (strlen(argv[c]) >= ADDRESS_LENGTH)
@@ -372,6 +376,8 @@ process_arguments (int argc, char **argv)
        return validate_arguments ();
 }
 
+
+
 int
 validate_arguments ()
 {
@@ -383,16 +389,13 @@ validate_arguments ()
 
 
 
-
-
-\f
 void
 print_help (void)
 {
        print_revision (progname, revision);
 
-       printf (_("Copyright (c) 1999 Ethan Galstad <nagios@nagios.org>\n"));
-       printf (_(COPYRIGHT), copyright, email);
+       printf ("Copyright (c) 1999 Ethan Galstad <nagios@nagios.org>\n");
+       printf (COPYRIGHT, copyright, email);
 
        print_usage ();
 
@@ -421,7 +424,6 @@ specified in /etc/resolv.conf will be used.\n"));
 
 
 
-
 void
 print_usage (void)
 {