summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f4e6b2a)
raw | patch | inline | side by side (parent: f4e6b2a)
author | Karl DeBisschop <kdebisschop@users.sourceforge.net> | |
Sat, 2 Aug 2003 16:42:57 +0000 (16:42 +0000) | ||
committer | Karl DeBisschop <kdebisschop@users.sourceforge.net> | |
Sat, 2 Aug 2003 16:42:57 +0000 (16:42 +0000) |
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@631 f882894a-f735-0410-b71e-b25c423dba1c
diff --git a/plugins/check_by_ssh.c b/plugins/check_by_ssh.c
index de106f229269a339766c2004f116c0bcfed86b3c..ae19253fad8853398741e4fd1474bd83da643035 100644 (file)
--- a/plugins/check_by_ssh.c
+++ b/plugins/check_by_ssh.c
print_usage ();
- printf (_(HELP_VRSN));
+ printf (_(UT_HELP_VRSN));
- printf (_(HOST_PORT), 'p', "none");
+ printf (_(UT_HOST_PORT), 'p', "none");
- printf (_(IPv46));
+ printf (_(UT_IPv46));
printf (_("\
-1, --proto1\n\
-n, --name=NAME\n\
short name of host in nagios configuration [optional]\n"));
- printf (_(WARN_CRIT_TO), DEFAULT_SOCKET_TIMEOUT);
+ printf (_(UT_WARN_CRIT));
+
+ printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
printf (_("\n\
The most common mode of use is to refer to a local identity file with\n\
diff --git a/plugins/check_dig.c b/plugins/check_dig.c
index a22a68ac196fbedfd7955d2f42f89e4ca1e82752..3d82298fe25546b0149bd08b055271260123869f 100644 (file)
--- a/plugins/check_dig.c
+++ b/plugins/check_dig.c
print_usage ();
- printf (_(HELP_VRSN));
+ printf (_(UT_HELP_VRSN));
- printf (_(HOST_PORT), 'P', myport);
+ printf (_(UT_HOST_PORT), 'P', myport);
printf (_("\
-l, --lookup=STRING\n\
machine name to lookup\n"));
- printf (_(WARN_CRIT_TO), DEFAULT_SOCKET_TIMEOUT);
+ printf (_(UT_WARN_CRIT));
- printf (_(VRBS));
+ printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
+
+ printf (_(UT_VERBOSE));
support ();
}
diff --git a/plugins/check_disk.c b/plugins/check_disk.c
index 9de3fad56e9664c09d1e9477aeb63ad7177f37cd..c758530e71c33ac5a307ef481d149791186b2903 100644 (file)
--- a/plugins/check_disk.c
+++ b/plugins/check_disk.c
print_usage ();
- printf (_(HELP_VRSN));
+ printf (_(UT_HELP_VRSN));
printf (_("\
-w, --warning=INTEGER\n\
-e, --errors-only\n\
Display only devices/mountpoints with errors\n"));
- printf (_(TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
+ printf (_(UT_WARN_CRIT));
- printf (_(VRBS));
+ printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
+
+ printf (_(UT_VERBOSE));
printf ("%s", _("Examples:\n\
check_disk -w 10% -c 5% -p /tmp -p /var -C -w 100000 -c 50000 -p /\n\
diff --git a/plugins/check_dns.c b/plugins/check_dns.c
index d96e9bbdc4c3df203b6c130822d393a7bfff3b0f..eae5880e5aec40b9f1d8300b78ed0a1e6b37050f 100644 (file)
--- a/plugins/check_dns.c
+++ b/plugins/check_dns.c
print_usage ();
- printf (_(HELP_VRSN));
+ printf (_(UT_HELP_VRSN));
printf (_("\
-H, --hostname=HOST\n\
-a, --expected-address=IP-ADDRESS\n\
Optional IP address you expect the DNS server to return\n"));
- printf (_(TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
+ printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
printf (_("\n\
This plugin uses the nslookup program to obtain the IP address\n\
if (strstr (input_buffer, ".in-addr.arpa")) {
if ((temp_buffer = strstr (input_buffer, "name = ")))
- address = strscpy (address, temp_buffer + 7);
+ address = strdup (temp_buffer + 7);
else {
- output = strscpy (output, _("Unknown error (plugin)"));
+ output = strdup (_("Unknown error (plugin)"));
result = STATE_WARNING;
}
}
result = error_scan (input_buffer);
if (result != STATE_OK) {
- output = strscpy (output, 1 + index (input_buffer, ':'));
+ output = strdup (1 + index (input_buffer, ':'));
strip (output);
break;
}
while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr)) {
if (error_scan (input_buffer) != STATE_OK) {
result = max_state (result, error_scan (input_buffer));
- output = strscpy (output, 1 + index (input_buffer, ':'));
+ output = strdup (1 + index (input_buffer, ':'));
strip (output);
}
}
if (spclose (child_process)) {
result = max_state (result, STATE_WARNING);
if (!strcmp (output, ""))
- output = strscpy (output, _("nslookup returned error status"));
+ output = strdup (_("nslookup returned error status"));
}
/* If we got here, we should have an address string,
strstr (input_buffer, "the `-sil[ent]' option to prevent this message from appearing."))
return STATE_OK;
- /* the DNS lookup timed out */
- else if (strstr (input_buffer, "Timed out"))
- terminate (STATE_WARNING, "Request timed out at server\n");
-
/* DNS server is not running... */
else if (strstr (input_buffer, "No response from server"))
- terminate (STATE_CRITICAL, "No response from name server %s\n", dns_server);
+ terminate (STATE_CRITICAL, _("No response from name server %s\n"), dns_server);
/* Host name is valid, but server doesn't have records... */
else if (strstr (input_buffer, "No records"))
- terminate (STATE_CRITICAL, "Name server %s has no records\n", dns_server);
+ terminate (STATE_CRITICAL, _("Name server %s has no records\n"), dns_server);
/* Connection was refused */
else if (strstr (input_buffer, "Connection refused") ||
(strstr (input_buffer, "** server can't find") &&
strstr (input_buffer, ": REFUSED")) ||
(strstr (input_buffer, "Refused")))
- terminate (STATE_CRITICAL, "Connection to name server %s was refused\n", dns_server);
+ terminate (STATE_CRITICAL, _("Connection to name server %s was refused\n"), dns_server);
/* Host or domain name does not exist */
else if (strstr (input_buffer, "Non-existent") ||
strstr (input_buffer, "** server can't find") ||
strstr (input_buffer,"NXDOMAIN"))
- terminate (STATE_CRITICAL, "Domain %s was not found by the server\n", query_address);
+ terminate (STATE_CRITICAL, _("Domain %s was not found by the server\n"), query_address);
/* Network is unreachable */
else if (strstr (input_buffer, "Network is unreachable"))
- terminate (STATE_CRITICAL, "Network is unreachable\n");
+ terminate (STATE_CRITICAL, _("Network is unreachable\n"));
/* Internal server failure */
else if (strstr (input_buffer, "Server failure"))
- terminate (STATE_CRITICAL, "Server failure for %s\n", dns_server);
+ terminate (STATE_CRITICAL, _("Server failure for %s\n"), dns_server);
- /* Request error */
- else if (strstr (input_buffer, "Format error"))
- terminate (STATE_WARNING, "Format error\n");
+ /* Request error or the DNS lookup timed out */
+ else if (strstr (input_buffer, "Format error") ||
+ strstr (input_buffer, "Timed out"))
+ return STATE_WARNING;
return STATE_OK;
diff --git a/plugins/check_dummy.c b/plugins/check_dummy.c
index c2f1f50d871be633be9b5baf324b7c3896c5303d..d90b1409874d0c56ce144f6642f0ed75396b1b26 100644 (file)
--- a/plugins/check_dummy.c
+++ b/plugins/check_dummy.c
print_usage ();
- printf (_(HELP_VRSN));
+ printf (_(UT_HELP_VRSN));
printf (_("\n\
This plugin will simply return the state corresponding to the numeric value\n\
of the <state> argument.\n"));
+
+ support ();
}
int
diff --git a/plugins/check_pgsql.c b/plugins/check_pgsql.c
index 2d2f6d31e356f6262c3d409156a808352befc146..2dce0b35d2ef533f254fec2f1f93ccc48b618a26 100644 (file)
--- a/plugins/check_pgsql.c
+++ b/plugins/check_pgsql.c
print_usage ();
- printf (_(HELP_VRSN));
+ printf (_(UT_HELP_VRSN));
- printf (_(HOST_PORT), 'P', myport);
+ printf (_(UT_HOST_PORT), 'P', myport);
- printf (_(IPv46));
+ printf (_(UT_IPv46));
printf (S_("\
-d, --database=STRING\n\
-p, --password = STRING\n\
Password (BIG SECURITY ISSUE)\n"), DEFAULT_DB);
- printf (_(WARN_CRIT_TO), DEFAULT_SOCKET_TIMEOUT);
+ printf (_(UT_WARN_CRIT));
- printf (_(VRBS));
+ printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
+
+ printf (_(UT_VERBOSE));
printf (S_("\nAll parameters are optional.\n\
\n\
diff --git a/plugins/check_swap.c b/plugins/check_swap.c
index 6dd2e086c5a89d86a2f85a9233f5665026586b29..65cd899c65915b97d683a8ef173c92a04103f782 100644 (file)
--- a/plugins/check_swap.c
+++ b/plugins/check_swap.c
print_usage ();
- printf (_(HELP_VRSN));
+ printf (_(UT_HELP_VRSN));
printf (_("\n\
-w, --warning=INTEGER\n\
diff --git a/plugins/check_tcp.c b/plugins/check_tcp.c
index 39f90222051f82a734d21fe903d30a8525c239e7..12fa40472741840fde55e5b12a69db31dd31c7f2 100644 (file)
--- a/plugins/check_tcp.c
+++ b/plugins/check_tcp.c
{
printf (_("\
Usage: %s -H host -p port [-w <warning time>] [-c <critical time>]\n\
- [-s <send string>] [-e <expect string>] [-q <quit string>]\n\
- [-m <maximum bytes>] [-d <delay>] [-t <timeout seconds>]\n\
- [-r <refuse state>] [-v] [-4|-6]\n"), progname);
+ [-s <send string>] [-e <expect string>] [-q <quit string>]\n\
+ [-m <maximum bytes>] [-d <delay>] [-t <timeout seconds>]\n\
+ [-r <refuse state>] [-v] [-4|-6]\n"), progname);
printf (" %s (-h|--help)\n", progname);
printf (" %s (-V|--version)\n", progname);
}
print_usage ();
- printf (_(HELP_VRSN));
+ printf (_(UT_HELP_VRSN));
- printf (_(HOST_PORT), 'p', "none");
+ printf (_(UT_HOST_PORT), 'p', "none");
- printf (_(IPv46));
+ printf (_(UT_IPv46));
printf (_("\
-s, --send=STRING\n\
-d, --delay=INTEGER\n\
Seconds to wait between sending string and polling for response\n"));
- printf (_(WARN_CRIT_TO), DEFAULT_SOCKET_TIMEOUT);
+ printf (_(UT_WARN_CRIT));
- printf (_(VRBS));
+ printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
+
+ printf (_(UT_VERBOSE));
support ();
}
diff --git a/plugins/utils.h b/plugins/utils.h
index d95422ad9ccb2e71a2721bd84c2324246057bbc5..b10f0e5af75f5c65254b0e0baaf36dd934c6df36 100644 (file)
--- a/plugins/utils.h
+++ b/plugins/utils.h
#define COPYRIGHT "Copyright (c) %s Nagios Plugin Development Team\n\
\t<%s>\n\n"
-#define HELP_VRSN "\
+#define UT_HELP_VRSN "\
\nOptions:\n\
-h, --help\n\
Print detailed help screen\n\
-V, --version\n\
Print version information\n"
-#define HOST_PORT "\
+#define UT_HOST_PORT "\
-H, --hostname=ADDRESS\n\
Host name or IP Address\n\
-%c, --port=INTEGER\n\
Port number (default: %s)\n"
-#define IPv46 "\
+#define UT_IPv46 "\
-4, --use-ipv4\n\
Use IPv4 connection\n\
-6, --use-ipv6\n\
Use IPv6 connection\n"
-#define VRBS "\
+#define UT_VERBOSE "\
-v, --verbose\n\
Show details for command-line debugging (Nagios may truncate output)\n"
-#define WARN_CRIT_TO "\
+#define UT_WARN_CRIT "\
-w, --warning=DOUBLE\n\
Response time to result in warning status (seconds)\n\
-c, --critical=DOUBLE\n\
- Response time to result in critical status (seconds)\n\
- -t, --timeout=INTEGER\n\
- Seconds before connection times out (default: %d)\n"
+ Response time to result in critical status (seconds)\n"
-#define TIMEOUT "\
+#define UT_TIMEOUT "\
-t, --timeout=INTEGER\n\
Seconds before connection times out (default: %d)\n"