diff options
-rw-r--r-- | plugins/check_by_ssh.c | 10 | ||||
-rw-r--r-- | plugins/check_dig.c | 10 | ||||
-rw-r--r-- | plugins/check_disk.c | 8 | ||||
-rw-r--r-- | plugins/check_dns.c | 37 | ||||
-rw-r--r-- | plugins/check_dummy.c | 4 | ||||
-rw-r--r-- | plugins/check_pgsql.c | 12 | ||||
-rw-r--r-- | plugins/check_swap.c | 2 | ||||
-rw-r--r-- | plugins/check_tcp.c | 18 | ||||
-rw-r--r-- | plugins/utils.h | 16 |
9 files changed, 62 insertions, 55 deletions
diff --git a/plugins/check_by_ssh.c b/plugins/check_by_ssh.c index de106f2..ae19253 100644 --- a/plugins/check_by_ssh.c +++ b/plugins/check_by_ssh.c | |||
@@ -49,11 +49,11 @@ print_help (void) | |||
49 | 49 | ||
50 | print_usage (); | 50 | print_usage (); |
51 | 51 | ||
52 | printf (_(HELP_VRSN)); | 52 | printf (_(UT_HELP_VRSN)); |
53 | 53 | ||
54 | printf (_(HOST_PORT), 'p', "none"); | 54 | printf (_(UT_HOST_PORT), 'p', "none"); |
55 | 55 | ||
56 | printf (_(IPv46)); | 56 | printf (_(UT_IPv46)); |
57 | 57 | ||
58 | printf (_("\ | 58 | printf (_("\ |
59 | -1, --proto1\n\ | 59 | -1, --proto1\n\ |
@@ -77,7 +77,9 @@ print_help (void) | |||
77 | -n, --name=NAME\n\ | 77 | -n, --name=NAME\n\ |
78 | short name of host in nagios configuration [optional]\n")); | 78 | short name of host in nagios configuration [optional]\n")); |
79 | 79 | ||
80 | printf (_(WARN_CRIT_TO), DEFAULT_SOCKET_TIMEOUT); | 80 | printf (_(UT_WARN_CRIT)); |
81 | |||
82 | printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT); | ||
81 | 83 | ||
82 | printf (_("\n\ | 84 | printf (_("\n\ |
83 | The most common mode of use is to refer to a local identity file with\n\ | 85 | 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 a22a68a..3d82298 100644 --- a/plugins/check_dig.c +++ b/plugins/check_dig.c | |||
@@ -62,17 +62,19 @@ print_help (void) | |||
62 | 62 | ||
63 | print_usage (); | 63 | print_usage (); |
64 | 64 | ||
65 | printf (_(HELP_VRSN)); | 65 | printf (_(UT_HELP_VRSN)); |
66 | 66 | ||
67 | printf (_(HOST_PORT), 'P', myport); | 67 | printf (_(UT_HOST_PORT), 'P', myport); |
68 | 68 | ||
69 | printf (_("\ | 69 | printf (_("\ |
70 | -l, --lookup=STRING\n\ | 70 | -l, --lookup=STRING\n\ |
71 | machine name to lookup\n")); | 71 | machine name to lookup\n")); |
72 | 72 | ||
73 | printf (_(WARN_CRIT_TO), DEFAULT_SOCKET_TIMEOUT); | 73 | printf (_(UT_WARN_CRIT)); |
74 | 74 | ||
75 | printf (_(VRBS)); | 75 | printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT); |
76 | |||
77 | printf (_(UT_VERBOSE)); | ||
76 | 78 | ||
77 | support (); | 79 | support (); |
78 | } | 80 | } |
diff --git a/plugins/check_disk.c b/plugins/check_disk.c index 9de3fad..c758530 100644 --- a/plugins/check_disk.c +++ b/plugins/check_disk.c | |||
@@ -59,7 +59,7 @@ and generates an alert if free space is less than one of the threshold values.") | |||
59 | 59 | ||
60 | print_usage (); | 60 | print_usage (); |
61 | 61 | ||
62 | printf (_(HELP_VRSN)); | 62 | printf (_(UT_HELP_VRSN)); |
63 | 63 | ||
64 | printf (_("\ | 64 | printf (_("\ |
65 | -w, --warning=INTEGER\n\ | 65 | -w, --warning=INTEGER\n\ |
@@ -95,9 +95,11 @@ and generates an alert if free space is less than one of the threshold values.") | |||
95 | -e, --errors-only\n\ | 95 | -e, --errors-only\n\ |
96 | Display only devices/mountpoints with errors\n")); | 96 | Display only devices/mountpoints with errors\n")); |
97 | 97 | ||
98 | printf (_(TIMEOUT), DEFAULT_SOCKET_TIMEOUT); | 98 | printf (_(UT_WARN_CRIT)); |
99 | 99 | ||
100 | printf (_(VRBS)); | 100 | printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT); |
101 | |||
102 | printf (_(UT_VERBOSE)); | ||
101 | 103 | ||
102 | printf ("%s", _("Examples:\n\ | 104 | printf ("%s", _("Examples:\n\ |
103 | check_disk -w 10% -c 5% -p /tmp -p /var -C -w 100000 -c 50000 -p /\n\ | 105 | 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 d96e9bb..eae5880 100644 --- a/plugins/check_dns.c +++ b/plugins/check_dns.c | |||
@@ -73,7 +73,7 @@ print_help (void) | |||
73 | 73 | ||
74 | print_usage (); | 74 | print_usage (); |
75 | 75 | ||
76 | printf (_(HELP_VRSN)); | 76 | printf (_(UT_HELP_VRSN)); |
77 | 77 | ||
78 | printf (_("\ | 78 | printf (_("\ |
79 | -H, --hostname=HOST\n\ | 79 | -H, --hostname=HOST\n\ |
@@ -83,7 +83,7 @@ print_help (void) | |||
83 | -a, --expected-address=IP-ADDRESS\n\ | 83 | -a, --expected-address=IP-ADDRESS\n\ |
84 | Optional IP address you expect the DNS server to return\n")); | 84 | Optional IP address you expect the DNS server to return\n")); |
85 | 85 | ||
86 | printf (_(TIMEOUT), DEFAULT_SOCKET_TIMEOUT); | 86 | printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT); |
87 | 87 | ||
88 | printf (_("\n\ | 88 | printf (_("\n\ |
89 | This plugin uses the nslookup program to obtain the IP address\n\ | 89 | This plugin uses the nslookup program to obtain the IP address\n\ |
@@ -155,9 +155,9 @@ main (int argc, char **argv) | |||
155 | 155 | ||
156 | if (strstr (input_buffer, ".in-addr.arpa")) { | 156 | if (strstr (input_buffer, ".in-addr.arpa")) { |
157 | if ((temp_buffer = strstr (input_buffer, "name = "))) | 157 | if ((temp_buffer = strstr (input_buffer, "name = "))) |
158 | address = strscpy (address, temp_buffer + 7); | 158 | address = strdup (temp_buffer + 7); |
159 | else { | 159 | else { |
160 | output = strscpy (output, _("Unknown error (plugin)")); | 160 | output = strdup (_("Unknown error (plugin)")); |
161 | result = STATE_WARNING; | 161 | result = STATE_WARNING; |
162 | } | 162 | } |
163 | } | 163 | } |
@@ -195,7 +195,7 @@ main (int argc, char **argv) | |||
195 | 195 | ||
196 | result = error_scan (input_buffer); | 196 | result = error_scan (input_buffer); |
197 | if (result != STATE_OK) { | 197 | if (result != STATE_OK) { |
198 | output = strscpy (output, 1 + index (input_buffer, ':')); | 198 | output = strdup (1 + index (input_buffer, ':')); |
199 | strip (output); | 199 | strip (output); |
200 | break; | 200 | break; |
201 | } | 201 | } |
@@ -206,7 +206,7 @@ main (int argc, char **argv) | |||
206 | while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr)) { | 206 | while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr)) { |
207 | if (error_scan (input_buffer) != STATE_OK) { | 207 | if (error_scan (input_buffer) != STATE_OK) { |
208 | result = max_state (result, error_scan (input_buffer)); | 208 | result = max_state (result, error_scan (input_buffer)); |
209 | output = strscpy (output, 1 + index (input_buffer, ':')); | 209 | output = strdup (1 + index (input_buffer, ':')); |
210 | strip (output); | 210 | strip (output); |
211 | } | 211 | } |
212 | } | 212 | } |
@@ -218,7 +218,7 @@ main (int argc, char **argv) | |||
218 | if (spclose (child_process)) { | 218 | if (spclose (child_process)) { |
219 | result = max_state (result, STATE_WARNING); | 219 | result = max_state (result, STATE_WARNING); |
220 | if (!strcmp (output, "")) | 220 | if (!strcmp (output, "")) |
221 | output = strscpy (output, _("nslookup returned error status")); | 221 | output = strdup (_("nslookup returned error status")); |
222 | } | 222 | } |
223 | 223 | ||
224 | /* If we got here, we should have an address string, | 224 | /* If we got here, we should have an address string, |
@@ -268,42 +268,39 @@ error_scan (char *input_buffer) | |||
268 | strstr (input_buffer, "the `-sil[ent]' option to prevent this message from appearing.")) | 268 | strstr (input_buffer, "the `-sil[ent]' option to prevent this message from appearing.")) |
269 | return STATE_OK; | 269 | return STATE_OK; |
270 | 270 | ||
271 | /* the DNS lookup timed out */ | ||
272 | else if (strstr (input_buffer, "Timed out")) | ||
273 | terminate (STATE_WARNING, "Request timed out at server\n"); | ||
274 | |||
275 | /* DNS server is not running... */ | 271 | /* DNS server is not running... */ |
276 | else if (strstr (input_buffer, "No response from server")) | 272 | else if (strstr (input_buffer, "No response from server")) |
277 | terminate (STATE_CRITICAL, "No response from name server %s\n", dns_server); | 273 | terminate (STATE_CRITICAL, _("No response from name server %s\n"), dns_server); |
278 | 274 | ||
279 | /* Host name is valid, but server doesn't have records... */ | 275 | /* Host name is valid, but server doesn't have records... */ |
280 | else if (strstr (input_buffer, "No records")) | 276 | else if (strstr (input_buffer, "No records")) |
281 | terminate (STATE_CRITICAL, "Name server %s has no records\n", dns_server); | 277 | terminate (STATE_CRITICAL, _("Name server %s has no records\n"), dns_server); |
282 | 278 | ||
283 | /* Connection was refused */ | 279 | /* Connection was refused */ |
284 | else if (strstr (input_buffer, "Connection refused") || | 280 | else if (strstr (input_buffer, "Connection refused") || |
285 | (strstr (input_buffer, "** server can't find") && | 281 | (strstr (input_buffer, "** server can't find") && |
286 | strstr (input_buffer, ": REFUSED")) || | 282 | strstr (input_buffer, ": REFUSED")) || |
287 | (strstr (input_buffer, "Refused"))) | 283 | (strstr (input_buffer, "Refused"))) |
288 | terminate (STATE_CRITICAL, "Connection to name server %s was refused\n", dns_server); | 284 | terminate (STATE_CRITICAL, _("Connection to name server %s was refused\n"), dns_server); |
289 | 285 | ||
290 | /* Host or domain name does not exist */ | 286 | /* Host or domain name does not exist */ |
291 | else if (strstr (input_buffer, "Non-existent") || | 287 | else if (strstr (input_buffer, "Non-existent") || |
292 | strstr (input_buffer, "** server can't find") || | 288 | strstr (input_buffer, "** server can't find") || |
293 | strstr (input_buffer,"NXDOMAIN")) | 289 | strstr (input_buffer,"NXDOMAIN")) |
294 | terminate (STATE_CRITICAL, "Domain %s was not found by the server\n", query_address); | 290 | terminate (STATE_CRITICAL, _("Domain %s was not found by the server\n"), query_address); |
295 | 291 | ||
296 | /* Network is unreachable */ | 292 | /* Network is unreachable */ |
297 | else if (strstr (input_buffer, "Network is unreachable")) | 293 | else if (strstr (input_buffer, "Network is unreachable")) |
298 | terminate (STATE_CRITICAL, "Network is unreachable\n"); | 294 | terminate (STATE_CRITICAL, _("Network is unreachable\n")); |
299 | 295 | ||
300 | /* Internal server failure */ | 296 | /* Internal server failure */ |
301 | else if (strstr (input_buffer, "Server failure")) | 297 | else if (strstr (input_buffer, "Server failure")) |
302 | terminate (STATE_CRITICAL, "Server failure for %s\n", dns_server); | 298 | terminate (STATE_CRITICAL, _("Server failure for %s\n"), dns_server); |
303 | 299 | ||
304 | /* Request error */ | 300 | /* Request error or the DNS lookup timed out */ |
305 | else if (strstr (input_buffer, "Format error")) | 301 | else if (strstr (input_buffer, "Format error") || |
306 | terminate (STATE_WARNING, "Format error\n"); | 302 | strstr (input_buffer, "Timed out")) |
303 | return STATE_WARNING; | ||
307 | 304 | ||
308 | return STATE_OK; | 305 | return STATE_OK; |
309 | 306 | ||
diff --git a/plugins/check_dummy.c b/plugins/check_dummy.c index c2f1f50..d90b140 100644 --- a/plugins/check_dummy.c +++ b/plugins/check_dummy.c | |||
@@ -57,11 +57,13 @@ print_help (void) | |||
57 | 57 | ||
58 | print_usage (); | 58 | print_usage (); |
59 | 59 | ||
60 | printf (_(HELP_VRSN)); | 60 | printf (_(UT_HELP_VRSN)); |
61 | 61 | ||
62 | printf (_("\n\ | 62 | printf (_("\n\ |
63 | This plugin will simply return the state corresponding to the numeric value\n\ | 63 | This plugin will simply return the state corresponding to the numeric value\n\ |
64 | of the <state> argument.\n")); | 64 | of the <state> argument.\n")); |
65 | |||
66 | support (); | ||
65 | } | 67 | } |
66 | 68 | ||
67 | int | 69 | int |
diff --git a/plugins/check_pgsql.c b/plugins/check_pgsql.c index 2d2f6d3..2dce0b3 100644 --- a/plugins/check_pgsql.c +++ b/plugins/check_pgsql.c | |||
@@ -136,11 +136,11 @@ print_help (void) | |||
136 | 136 | ||
137 | print_usage (); | 137 | print_usage (); |
138 | 138 | ||
139 | printf (_(HELP_VRSN)); | 139 | printf (_(UT_HELP_VRSN)); |
140 | 140 | ||
141 | printf (_(HOST_PORT), 'P', myport); | 141 | printf (_(UT_HOST_PORT), 'P', myport); |
142 | 142 | ||
143 | printf (_(IPv46)); | 143 | printf (_(UT_IPv46)); |
144 | 144 | ||
145 | printf (S_("\ | 145 | printf (S_("\ |
146 | -d, --database=STRING\n\ | 146 | -d, --database=STRING\n\ |
@@ -150,9 +150,11 @@ print_help (void) | |||
150 | -p, --password = STRING\n\ | 150 | -p, --password = STRING\n\ |
151 | Password (BIG SECURITY ISSUE)\n"), DEFAULT_DB); | 151 | Password (BIG SECURITY ISSUE)\n"), DEFAULT_DB); |
152 | 152 | ||
153 | printf (_(WARN_CRIT_TO), DEFAULT_SOCKET_TIMEOUT); | 153 | printf (_(UT_WARN_CRIT)); |
154 | 154 | ||
155 | printf (_(VRBS)); | 155 | printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT); |
156 | |||
157 | printf (_(UT_VERBOSE)); | ||
156 | 158 | ||
157 | printf (S_("\nAll parameters are optional.\n\ | 159 | printf (S_("\nAll parameters are optional.\n\ |
158 | \n\ | 160 | \n\ |
diff --git a/plugins/check_swap.c b/plugins/check_swap.c index 6dd2e08..65cd899 100644 --- a/plugins/check_swap.c +++ b/plugins/check_swap.c | |||
@@ -77,7 +77,7 @@ print_help (void) | |||
77 | 77 | ||
78 | print_usage (); | 78 | print_usage (); |
79 | 79 | ||
80 | printf (_(HELP_VRSN)); | 80 | printf (_(UT_HELP_VRSN)); |
81 | 81 | ||
82 | printf (_("\n\ | 82 | printf (_("\n\ |
83 | -w, --warning=INTEGER\n\ | 83 | -w, --warning=INTEGER\n\ |
diff --git a/plugins/check_tcp.c b/plugins/check_tcp.c index 39f9022..12fa404 100644 --- a/plugins/check_tcp.c +++ b/plugins/check_tcp.c | |||
@@ -98,9 +98,9 @@ print_usage (void) | |||
98 | { | 98 | { |
99 | printf (_("\ | 99 | printf (_("\ |
100 | Usage: %s -H host -p port [-w <warning time>] [-c <critical time>]\n\ | 100 | Usage: %s -H host -p port [-w <warning time>] [-c <critical time>]\n\ |
101 | [-s <send string>] [-e <expect string>] [-q <quit string>]\n\ | 101 | [-s <send string>] [-e <expect string>] [-q <quit string>]\n\ |
102 | [-m <maximum bytes>] [-d <delay>] [-t <timeout seconds>]\n\ | 102 | [-m <maximum bytes>] [-d <delay>] [-t <timeout seconds>]\n\ |
103 | [-r <refuse state>] [-v] [-4|-6]\n"), progname); | 103 | [-r <refuse state>] [-v] [-4|-6]\n"), progname); |
104 | printf (" %s (-h|--help)\n", progname); | 104 | printf (" %s (-h|--help)\n", progname); |
105 | printf (" %s (-V|--version)\n", progname); | 105 | printf (" %s (-V|--version)\n", progname); |
106 | } | 106 | } |
@@ -116,11 +116,11 @@ print_help (void) | |||
116 | 116 | ||
117 | print_usage (); | 117 | print_usage (); |
118 | 118 | ||
119 | printf (_(HELP_VRSN)); | 119 | printf (_(UT_HELP_VRSN)); |
120 | 120 | ||
121 | printf (_(HOST_PORT), 'p', "none"); | 121 | printf (_(UT_HOST_PORT), 'p', "none"); |
122 | 122 | ||
123 | printf (_(IPv46)); | 123 | printf (_(UT_IPv46)); |
124 | 124 | ||
125 | printf (_("\ | 125 | printf (_("\ |
126 | -s, --send=STRING\n\ | 126 | -s, --send=STRING\n\ |
@@ -138,9 +138,11 @@ print_help (void) | |||
138 | -d, --delay=INTEGER\n\ | 138 | -d, --delay=INTEGER\n\ |
139 | Seconds to wait between sending string and polling for response\n")); | 139 | Seconds to wait between sending string and polling for response\n")); |
140 | 140 | ||
141 | printf (_(WARN_CRIT_TO), DEFAULT_SOCKET_TIMEOUT); | 141 | printf (_(UT_WARN_CRIT)); |
142 | 142 | ||
143 | printf (_(VRBS)); | 143 | printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT); |
144 | |||
145 | printf (_(UT_VERBOSE)); | ||
144 | 146 | ||
145 | support (); | 147 | support (); |
146 | } | 148 | } |
diff --git a/plugins/utils.h b/plugins/utils.h index d95422a..b10f0e5 100644 --- a/plugins/utils.h +++ b/plugins/utils.h | |||
@@ -92,37 +92,35 @@ char *state_text (int result); | |||
92 | #define COPYRIGHT "Copyright (c) %s Nagios Plugin Development Team\n\ | 92 | #define COPYRIGHT "Copyright (c) %s Nagios Plugin Development Team\n\ |
93 | \t<%s>\n\n" | 93 | \t<%s>\n\n" |
94 | 94 | ||
95 | #define HELP_VRSN "\ | 95 | #define UT_HELP_VRSN "\ |
96 | \nOptions:\n\ | 96 | \nOptions:\n\ |
97 | -h, --help\n\ | 97 | -h, --help\n\ |
98 | Print detailed help screen\n\ | 98 | Print detailed help screen\n\ |
99 | -V, --version\n\ | 99 | -V, --version\n\ |
100 | Print version information\n" | 100 | Print version information\n" |
101 | 101 | ||
102 | #define HOST_PORT "\ | 102 | #define UT_HOST_PORT "\ |
103 | -H, --hostname=ADDRESS\n\ | 103 | -H, --hostname=ADDRESS\n\ |
104 | Host name or IP Address\n\ | 104 | Host name or IP Address\n\ |
105 | -%c, --port=INTEGER\n\ | 105 | -%c, --port=INTEGER\n\ |
106 | Port number (default: %s)\n" | 106 | Port number (default: %s)\n" |
107 | 107 | ||
108 | #define IPv46 "\ | 108 | #define UT_IPv46 "\ |
109 | -4, --use-ipv4\n\ | 109 | -4, --use-ipv4\n\ |
110 | Use IPv4 connection\n\ | 110 | Use IPv4 connection\n\ |
111 | -6, --use-ipv6\n\ | 111 | -6, --use-ipv6\n\ |
112 | Use IPv6 connection\n" | 112 | Use IPv6 connection\n" |
113 | 113 | ||
114 | #define VRBS "\ | 114 | #define UT_VERBOSE "\ |
115 | -v, --verbose\n\ | 115 | -v, --verbose\n\ |
116 | Show details for command-line debugging (Nagios may truncate output)\n" | 116 | Show details for command-line debugging (Nagios may truncate output)\n" |
117 | 117 | ||
118 | #define WARN_CRIT_TO "\ | 118 | #define UT_WARN_CRIT "\ |
119 | -w, --warning=DOUBLE\n\ | 119 | -w, --warning=DOUBLE\n\ |
120 | Response time to result in warning status (seconds)\n\ | 120 | Response time to result in warning status (seconds)\n\ |
121 | -c, --critical=DOUBLE\n\ | 121 | -c, --critical=DOUBLE\n\ |
122 | Response time to result in critical status (seconds)\n\ | 122 | Response time to result in critical status (seconds)\n" |
123 | -t, --timeout=INTEGER\n\ | ||
124 | Seconds before connection times out (default: %d)\n" | ||
125 | 123 | ||
126 | #define TIMEOUT "\ | 124 | #define UT_TIMEOUT "\ |
127 | -t, --timeout=INTEGER\n\ | 125 | -t, --timeout=INTEGER\n\ |
128 | Seconds before connection times out (default: %d)\n" | 126 | Seconds before connection times out (default: %d)\n" |