summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/check_fping.c36
-rw-r--r--plugins/check_game.c90
-rw-r--r--plugins/check_mysql.c108
-rw-r--r--plugins/check_snmp.c48
-rw-r--r--plugins/utils.h4
5 files changed, 137 insertions, 149 deletions
diff --git a/plugins/check_fping.c b/plugins/check_fping.c
index 86170d5..16e177c 100644
--- a/plugins/check_fping.c
+++ b/plugins/check_fping.c
@@ -88,7 +88,7 @@ time (ms) which triggers a WARNING or CRITICAL state, and <pl> is the\n\
88percentage of packet loss to trigger an alarm state.\n")); 88percentage of packet loss to trigger an alarm state.\n"));
89 89
90} 90}
91 91
92int textscan (char *buf); 92int textscan (char *buf);
93int process_arguments (int, char **); 93int process_arguments (int, char **);
94int get_threshold (char *arg, char *rv[2]); 94int get_threshold (char *arg, char *rv[2]);
@@ -112,7 +112,7 @@ main (int argc, char **argv)
112 input_buffer = malloc (MAX_INPUT_BUFFER); 112 input_buffer = malloc (MAX_INPUT_BUFFER);
113 113
114 if (process_arguments (argc, argv) == ERROR) 114 if (process_arguments (argc, argv) == ERROR)
115 usage ("Could not parse arguments\n"); 115 usage (_("Could not parse arguments\n"));
116 116
117 server = strscpy (server, server_name); 117 server = strscpy (server, server_name);
118 118
@@ -126,13 +126,13 @@ main (int argc, char **argv)
126 /* run the command */ 126 /* run the command */
127 child_process = spopen (command_line); 127 child_process = spopen (command_line);
128 if (child_process == NULL) { 128 if (child_process == NULL) {
129 printf ("Unable to open pipe: %s\n", command_line); 129 printf (_("Unable to open pipe: %s\n"), command_line);
130 return STATE_UNKNOWN; 130 return STATE_UNKNOWN;
131 } 131 }
132 132
133 child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r"); 133 child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r");
134 if (child_stderr == NULL) { 134 if (child_stderr == NULL) {
135 printf ("Could not open stderr for %s\n", command_line); 135 printf (_("Could not open stderr for %s\n"), command_line);
136 } 136 }
137 137
138 while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) { 138 while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) {
@@ -173,16 +173,16 @@ textscan (char *buf)
173 int status = STATE_UNKNOWN; 173 int status = STATE_UNKNOWN;
174 174
175 if (strstr (buf, "not found")) { 175 if (strstr (buf, "not found")) {
176 terminate (STATE_CRITICAL, "FPING unknown - %s not found\n", server_name); 176 terminate (STATE_CRITICAL, _("FPING unknown - %s not found\n"), server_name);
177 177
178 } 178 }
179 else if (strstr (buf, "is unreachable") || strstr (buf, "Unreachable")) { 179 else if (strstr (buf, "is unreachable") || strstr (buf, "Unreachable")) {
180 terminate (STATE_CRITICAL, "FPING critical - %s is unreachable\n", 180 terminate (STATE_CRITICAL, _("FPING critical - %s is unreachable\n"),
181 "host"); 181 "host");
182 182
183 } 183 }
184 else if (strstr (buf, "is down")) { 184 else if (strstr (buf, "is down")) {
185 terminate (STATE_CRITICAL, "FPING critical - %s is down\n", server_name); 185 terminate (STATE_CRITICAL, _("FPING critical - %s is down\n"), server_name);
186 186
187 } 187 }
188 else if (strstr (buf, "is alive")) { 188 else if (strstr (buf, "is alive")) {
@@ -208,7 +208,7 @@ textscan (char *buf)
208 status = STATE_WARNING; 208 status = STATE_WARNING;
209 else 209 else
210 status = STATE_OK; 210 status = STATE_OK;
211 terminate (status, "FPING %s - %s (loss=%f%%, rta=%f ms)\n", 211 terminate (status, _("FPING %s - %s (loss=%f%%, rta=%f ms)\n"),
212 state_text (status), server_name, loss, rta); 212 state_text (status), server_name, loss, rta);
213 213
214 } 214 }
@@ -227,7 +227,7 @@ textscan (char *buf)
227 else 227 else
228 status = STATE_OK; 228 status = STATE_OK;
229 229
230 terminate (status, "FPING %s - %s (loss=%f%% )\n", 230 terminate (status, _("FPING %s - %s (loss=%f%% )\n"),
231 state_text (status), server_name, loss ); 231 state_text (status), server_name, loss );
232 232
233 } 233 }
@@ -237,7 +237,7 @@ textscan (char *buf)
237 237
238 return status; 238 return status;
239} 239}
240 240
241 241
242 242
243 243
@@ -282,21 +282,21 @@ process_arguments (int argc, char **argv)
282 282
283 switch (c) { 283 switch (c) {
284 case '?': /* print short usage statement if args not parsable */ 284 case '?': /* print short usage statement if args not parsable */
285 printf ("%s: Unknown argument: %s\n\n", progname, optarg); 285 printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
286 print_usage (); 286 print_usage ();
287 exit (STATE_UNKNOWN); 287 exit (STATE_UNKNOWN);
288 case 'h': /* help */ 288 case 'h': /* help */
289 print_help (); 289 print_help ();
290 exit (STATE_OK); 290 exit (STATE_OK);
291 case 'V': /* version */ 291 case 'V': /* version */
292 print_revision (progname, "$Revision$"); 292 print_revision (progname, revision);
293 exit (STATE_OK); 293 exit (STATE_OK);
294 case 'v': /* verbose mode */ 294 case 'v': /* verbose mode */
295 verbose = TRUE; 295 verbose = TRUE;
296 break; 296 break;
297 case 'H': /* hostname */ 297 case 'H': /* hostname */
298 if (is_host (optarg) == FALSE) { 298 if (is_host (optarg) == FALSE) {
299 printf ("Invalid host name/address\n\n"); 299 printf (_("Invalid host name/address\n\n"));
300 print_usage (); 300 print_usage ();
301 exit (STATE_UNKNOWN); 301 exit (STATE_UNKNOWN);
302 } 302 }
@@ -328,20 +328,20 @@ process_arguments (int argc, char **argv)
328 if (is_intpos (optarg)) 328 if (is_intpos (optarg))
329 packet_size = atoi (optarg); 329 packet_size = atoi (optarg);
330 else 330 else
331 usage ("Packet size must be a positive integer"); 331 usage (_("Packet size must be a positive integer"));
332 break; 332 break;
333 case 'n': /* number of packets */ 333 case 'n': /* number of packets */
334 if (is_intpos (optarg)) 334 if (is_intpos (optarg))
335 packet_count = atoi (optarg); 335 packet_count = atoi (optarg);
336 else 336 else
337 usage ("Packet count must be a positive integer"); 337 usage (_("Packet count must be a positive integer"));
338 break; 338 break;
339 } 339 }
340 } 340 }
341 341
342 342
343 if (server_name == NULL) 343 if (server_name == NULL)
344 usage ("Host name was not supplied\n\n"); 344 usage (_("Host name was not supplied\n\n"));
345 345
346 return OK; 346 return OK;
347} 347}
@@ -364,11 +364,11 @@ get_threshold (char *arg, char *rv[2])
364 arg1[strcspn (arg1, ",:")] = 0; 364 arg1[strcspn (arg1, ",:")] = 0;
365 if (strstr (arg1, "%") && strstr (arg2, "%")) 365 if (strstr (arg1, "%") && strstr (arg2, "%"))
366 terminate (STATE_UNKNOWN, 366 terminate (STATE_UNKNOWN,
367 "%s: Only one threshold may be packet loss (%s)\n", progname, 367 _("%s: Only one threshold may be packet loss (%s)\n"), progname,
368 arg); 368 arg);
369 if (!strstr (arg1, "%") && !strstr (arg2, "%")) 369 if (!strstr (arg1, "%") && !strstr (arg2, "%"))
370 terminate (STATE_UNKNOWN, 370 terminate (STATE_UNKNOWN,
371 "%s: Only one threshold must be packet loss (%s)\n", 371 _("%s: Only one threshold must be packet loss (%s)\n"),
372 progname, arg); 372 progname, arg);
373 } 373 }
374 374
diff --git a/plugins/check_game.c b/plugins/check_game.c
index db28dfd..811da27 100644
--- a/plugins/check_game.c
+++ b/plugins/check_game.c
@@ -19,34 +19,52 @@
19const char *progname = "check_game"; 19const char *progname = "check_game";
20const char *revision = "$Revision$"; 20const char *revision = "$Revision$";
21const char *copyright = "2002-2003"; 21const char *copyright = "2002-2003";
22const char *authors = "Nagios Plugin Development Team";
23const char *email = "nagiosplug-devel@lists.sourceforge.net"; 22const char *email = "nagiosplug-devel@lists.sourceforge.net";
24 23
25const char *summary = "\ 24#include "common.h"
26This plugin tests %s connections with the specified host.\n"; 25#include "popen.h"
26#include "utils.h"
27 27
28const char *option_summary = "\ 28void
29%s <game> <ip_address> [-p port] [-gf game_field] [-mf map_field] [-pf ping_field]\n"; 29print_usage (void)
30{
31 printf (_("\
32Usage: %s <game> <ip_address> [-p port] [-gf game_field] [-mf map_field]\n\
33 [-pf ping_field]\n"), progname);
34 printf (_(UT_HLP_VRS), progname, progname);
35}
30 36
31const char *options = "\ 37void
38print_help (void)
39{
40 print_revision (progname, revision);
41
42 printf (_(COPYRIGHT), copyright, email);
43
44 printf (_("This plugin tests %s connections with the specified host."), progname);
45
46 print_usage ();
47
48 printf (_(UT_HELP_VRSN));
49
50 printf (_("\
32<game> = Game type that is recognised by qstat (without the leading dash)\n\ 51<game> = Game type that is recognised by qstat (without the leading dash)\n\
33<ip_address> = The IP address of the device you wish to query\n\ 52<ip_address> = The IP address of the device you wish to query\n\
34 [port] = Optional port of which to connect\n\ 53 [port] = Optional port of which to connect\n\
35 [game_field] = Field number in raw qstat output that contains game name\n\ 54 [game_field] = Field number in raw qstat output that contains game name\n\
36 [map_field] = Field number in raw qstat output that contains map name\n\ 55 [map_field] = Field number in raw qstat output that contains map name\n\
37 [ping_field] = Field number in raw qstat output that contains ping time\n\ 56 [ping_field] = Field number in raw qstat output that contains ping time\n"),
38\n\ 57 DEFAULT_SOCKET_TIMEOUT);
58
59 printf (_("\n\
39Notes:\n\ 60Notes:\n\
40- This plugin uses the 'qstat' command, the popular game server status query tool .\n\ 61- This plugin uses the 'qstat' command, the popular game server status query tool .\n\
41 If you don't have the package installed, you will need to download it from\n\ 62 If you don't have the package installed, you will need to download it from\n\
42 http://www.activesw.com/people/steve/qstat.html before you can use this plugin.\n"; 63 http://www.activesw.com/people/steve/qstat.html before you can use this plugin.\n"));
43 64
44#include "common.h" 65 printf (_(UT_SUPPORT));
45#include "popen.h" 66}
46#include "utils.h" 67
47
48void print_usage (void);
49void print_help (void);
50int process_arguments (int, char **); 68int process_arguments (int, char **);
51int validate_arguments (void); 69int validate_arguments (void);
52 70
@@ -83,11 +101,11 @@ main (int argc, char **argv)
83 result = process_arguments (argc, argv); 101 result = process_arguments (argc, argv);
84 102
85 if (result != OK) { 103 if (result != OK) {
86 printf ("Incorrect arguments supplied\n"); 104 printf (_("Incorrect arguments supplied\n"));
87 printf ("\n"); 105 printf ("\n");
88 print_revision (argv[0], "$Revision$"); 106 print_revision (progname, revision);
89 printf ("Copyright (c) 1999 Ian Cass, Knowledge Matters Limited\n"); 107 printf (_("Copyright (c) 1999 Ian Cass, Knowledge Matters Limited\n"));
90 printf ("License: GPL\n"); 108 printf (_("License: GPL\n"));
91 printf ("\n"); 109 printf ("\n");
92 return STATE_UNKNOWN; 110 return STATE_UNKNOWN;
93 } 111 }
@@ -107,7 +125,7 @@ main (int argc, char **argv)
107 /* run the command */ 125 /* run the command */
108 fp = spopen (command_line); 126 fp = spopen (command_line);
109 if (fp == NULL) { 127 if (fp == NULL) {
110 printf ("Error - Could not open pipe: %s\n", command_line); 128 printf (_("Error - Could not open pipe: %s\n"), command_line);
111 return STATE_UNKNOWN; 129 return STATE_UNKNOWN;
112 } 130 }
113 131
@@ -127,7 +145,7 @@ main (int argc, char **argv)
127 */ 145 */
128 146
129 if (!strncmp (input_buffer, "unknown option", 14)) { 147 if (!strncmp (input_buffer, "unknown option", 14)) {
130 printf ("ERROR: Host type parameter incorrect!\n"); 148 printf (_("ERROR: Host type parameter incorrect!\n"));
131 result = STATE_CRITICAL; 149 result = STATE_CRITICAL;
132 return result; 150 return result;
133 } 151 }
@@ -217,7 +235,7 @@ process_arguments (int argc, char **argv)
217 235
218 switch (c) { 236 switch (c) {
219 case '?': /* args not parsable */ 237 case '?': /* args not parsable */
220 printf ("%s: Unknown argument: %s\n\n", progname, optarg); 238 printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
221 print_usage (); 239 print_usage ();
222 exit (STATE_UNKNOWN); 240 exit (STATE_UNKNOWN);
223 case 'h': /* help */ 241 case 'h': /* help */
@@ -234,7 +252,7 @@ process_arguments (int argc, char **argv)
234 break; 252 break;
235 case 'H': /* hostname */ 253 case 'H': /* hostname */
236 if (strlen (optarg) >= MAX_HOST_ADDRESS_LENGTH) 254 if (strlen (optarg) >= MAX_HOST_ADDRESS_LENGTH)
237 terminate (STATE_UNKNOWN, "Input buffer overflow\n"); 255 terminate (STATE_UNKNOWN, _("Input buffer overflow\n"));
238 server_ip = strdup (optarg); 256 server_ip = strdup (optarg);
239 break; 257 break;
240 case 'P': /* port */ 258 case 'P': /* port */
@@ -242,7 +260,7 @@ process_arguments (int argc, char **argv)
242 break; 260 break;
243 case 'G': /* hostname */ 261 case 'G': /* hostname */
244 if (strlen (optarg) >= MAX_INPUT_BUFFER) 262 if (strlen (optarg) >= MAX_INPUT_BUFFER)
245 terminate (STATE_UNKNOWN, "Input buffer overflow\n"); 263 terminate (STATE_UNKNOWN, _("Input buffer overflow\n"));
246 game_type = strdup (optarg); 264 game_type = strdup (optarg);
247 break; 265 break;
248 case 'p': /* index of ping field */ 266 case 'p': /* index of ping field */
@@ -290,27 +308,3 @@ validate_arguments (void)
290{ 308{
291 return OK; 309 return OK;
292} 310}
293
294
295void
296print_help (void)
297{
298 print_revision (progname, revision);
299 printf ("Copyright (c) %s %s\n\t<%s>\n\n",
300 copyright, authors, email);
301 printf (summary, progname);
302 print_usage ();
303 printf ("\nOptions:\n");
304 printf (options, DEFAULT_SOCKET_TIMEOUT);
305 support ();
306}
307
308void
309print_usage (void)
310{
311 printf
312 ("Usage: %s %s\n"
313 " %s (-h|--help)\n"
314 " %s (-V|--version)\n", progname, option_summary, progname, progname);
315}
316
diff --git a/plugins/check_mysql.c b/plugins/check_mysql.c
index 3074814..a18397d 100644
--- a/plugins/check_mysql.c
+++ b/plugins/check_mysql.c
@@ -15,25 +15,66 @@
15******************************************************************************/ 15******************************************************************************/
16 16
17const char *progname = "check_mysql"; 17const char *progname = "check_mysql";
18#define REVISION "$Revision$" 18const char *revision = "$Revision$";
19#define COPYRIGHT "1999-2002" 19const char *copyright = "1999-2002";
20const char *email = "nagiosplug-devel@lists.sourceforge.net";
20 21
21#include "common.h" 22#include "common.h"
22#include "utils.h" 23#include "utils.h"
23 24#include "netutils.h"
24#include <mysql/mysql.h> 25#include <mysql/mysql.h>
25#include <mysql/errmsg.h> 26#include <mysql/errmsg.h>
26 27
28unsigned int db_port = MYSQL_PORT;
29
30void
31print_usage (void)
32{
33 printf (_("\
34Usage: %s [-d database] [-H host] [-P port] [-u user] [-p password]\n"),
35 progname);
36 printf (_(UT_HLP_VRS), progname, progname);
37}
38
39void
40print_help (void)
41{
42 print_revision (progname, revision);
43
44 printf (_(COPYRIGHT), copyright, email);
45
46 printf (_("This program tests connections to a mysql server\n"));
47
48 print_usage ();
49
50 printf (_(UT_HELP_VRSN));
51
52 printf (_(UT_HOST_PORT), 'P', atoi(MYSQL_PORT));
53
54 printf (_("\
55 -d, --database=STRING\n\
56 Check database with indicated name\n\
57 -u, --username=STRING\n\
58 Connect using the indicated username\n\
59 -p, --password=STRING\n\
60 Use the indicated password to authenticate the connection\n\
61 ==> IMPORTANT: THIS FORM OF AUTHENTICATION IS NOT SECURE!!! <==\n\
62 Your clear-text password will be visible as a process table entry\n"));
63
64 printf (_("\n\
65There are no required arguments. By default, the local database with\n\
66a server listening on MySQL standard port %d will be checked\n"), MYSQL_PORT);
67
68 printf (_(UT_SUPPORT));
69}
70
27char *db_user = ""; 71char *db_user = "";
28char *db_host = ""; 72char *db_host = "";
29char *db_pass = ""; 73char *db_pass = "";
30char *db = ""; 74char *db = "";
31unsigned int db_port = MYSQL_PORT;
32 75
33int process_arguments (int, char **); 76int process_arguments (int, char **);
34int validate_arguments (void); 77int validate_arguments (void);
35void print_help (void);
36void print_usage (void);
37 78
38int 79int
39main (int argc, char **argv) 80main (int argc, char **argv)
@@ -43,7 +84,7 @@ main (int argc, char **argv)
43 char result[1024]; 84 char result[1024];
44 85
45 if (process_arguments (argc, argv) != OK) 86 if (process_arguments (argc, argv) != OK)
46 usage ("Invalid command arguments supplied\n"); 87 usage (_("Invalid command arguments supplied\n"));
47 88
48 /* initialize mysql */ 89 /* initialize mysql */
49 mysql_init (&mysql); 90 mysql_init (&mysql);
@@ -154,7 +195,7 @@ process_arguments (int argc, char **argv)
154 db_host = optarg; 195 db_host = optarg;
155 } 196 }
156 else { 197 else {
157 usage ("Invalid host name\n"); 198 usage (_("Invalid host name\n"));
158 } 199 }
159 break; 200 break;
160 case 'd': /* hostname */ 201 case 'd': /* hostname */
@@ -170,13 +211,13 @@ process_arguments (int argc, char **argv)
170 db_port = atoi (optarg); 211 db_port = atoi (optarg);
171 break; 212 break;
172 case 'V': /* version */ 213 case 'V': /* version */
173 print_revision (progname, REVISION); 214 print_revision (progname, revision);
174 exit (STATE_OK); 215 exit (STATE_OK);
175 case 'h': /* help */ 216 case 'h': /* help */
176 print_help (); 217 print_help ();
177 exit (STATE_OK); 218 exit (STATE_OK);
178 case '?': /* help */ 219 case '?': /* help */
179 usage ("Invalid argument\n"); 220 usage (_("Invalid argument\n"));
180 } 221 }
181 } 222 }
182 223
@@ -215,50 +256,3 @@ validate_arguments (void)
215{ 256{
216 return OK; 257 return OK;
217} 258}
218
219
220
221
222
223void
224print_help (void)
225{
226 print_revision (progname, REVISION);
227 printf
228 ("Copyright (c) 2000 Didi Rieder/Karl DeBisschop\n\n"
229 "This plugin is for testing a mysql server.\n");
230 print_usage ();
231 printf
232 ("\nThere are no required arguments. By default, the local database with\n"
233 "a server listening on MySQL standard port %d will be checked\n\n"
234 "Options:\n"
235 " -d, --database=STRING\n"
236 " Check database with indicated name\n"
237 " -H, --hostname=STRING or IPADDRESS\n"
238 " Check server on the indicated host\n"
239 " -P, --port=INTEGER\n"
240 " Make connection on the indicated port\n"
241 " -u, --username=STRING\n"
242 " Connect using the indicated username\n"
243 " -p, --password=STRING\n"
244 " Use the indicated password to authenticate the connection\n"
245 " ==> IMPORTANT: THIS FORM OF AUTHENTICATION IS NOT SECURE!!! <==\n"
246 " Your clear-text password will be visible as a process table entry\n"
247 " -h, --help\n"
248 " Print detailed help screen\n"
249 " -V, --version\n" " Print version information\n\n", MYSQL_PORT);
250 support ();
251}
252
253
254
255
256
257void
258print_usage (void)
259{
260 printf
261 ("Usage: %s [-d database] [-H host] [-P port] [-u user] [-p password]\n"
262 " %s --help\n"
263 " %s --version\n", progname, progname, progname);
264}
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index 821f10e..68ffaf5 100644
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
@@ -43,18 +43,14 @@ const char *email = "nagiosplug-devel@lists.sourceforge.net";
43void 43void
44print_usage (void) 44print_usage (void)
45{ 45{
46 printf ("\ 46 printf (_("\
47Usage: %s -H <ip_address> -o <OID> [-w warn_range] [-c crit_range] \n\ 47Usage: %s -H <ip_address> -o <OID> [-w warn_range] [-c crit_range] \n\
48 [-C community] [-s string] [-r regex] [-R regexi] [-t timeout]\n\ 48 [-C community] [-s string] [-r regex] [-R regexi] [-t timeout]\n\
49 [-l label] [-u units] [-p port-number] [-d delimiter]\n\ 49 [-l label] [-u units] [-p port-number] [-d delimiter]\n\
50 [-D output-delimiter] [-m miblist] [-P snmp version]\n\ 50 [-D output-delimiter] [-m miblist] [-P snmp version]\n\
51 [-L seclevel] [-U secname] [-a authproto] [-A authpasswd]\n\ 51 [-L seclevel] [-U secname] [-a authproto] [-A authpasswd]\n\
52 [-X privpasswd]\n", 52 [-X privpasswd]\n"), progname);
53 progname); 53 printf (_(UT_HLP_VRS), progname, progname);
54 printf ("\
55 %s (-h | --help) for detailed help\n\
56 %s (-V | --version) for version information\n",
57 progname, progname);
58} 54}
59 55
60void 56void
@@ -160,7 +156,7 @@ Check status of remote machines and obtain sustem information via SNMP\n\n"));
160- All evaluation methods other than PR, STR, and SUBSTR expect that the value\n\ 156- All evaluation methods other than PR, STR, and SUBSTR expect that the value\n\
161 returned from the SNMP query is an unsigned integer.\n")); 157 returned from the SNMP query is an unsigned integer.\n"));
162 158
163 support (); 159 printf (_(UT_SUPPORT));
164} 160}
165 161
166 162
@@ -271,7 +267,7 @@ main (int argc, char **argv)
271 i = 0; 267 i = 0;
272 268
273 if (process_arguments (argc, argv) == ERROR) 269 if (process_arguments (argc, argv) == ERROR)
274 usage ("Incorrect arguments supplied\n"); 270 usage (_("Incorrect arguments supplied\n"));
275 271
276 /* create the command line to execute */ 272 /* create the command line to execute */
277 asprintf (&command_line, "%s -t 1 -r %d -m %s -v %s %s %s:%s %s", 273 asprintf (&command_line, "%s -t 1 -r %d -m %s -v %s %s %s:%s %s",
@@ -283,13 +279,13 @@ main (int argc, char **argv)
283 /* run the command */ 279 /* run the command */
284 child_process = spopen (command_line); 280 child_process = spopen (command_line);
285 if (child_process == NULL) { 281 if (child_process == NULL) {
286 printf ("Could not open pipe: %s\n", command_line); 282 printf (_("Could not open pipe: %s\n"), command_line);
287 exit (STATE_UNKNOWN); 283 exit (STATE_UNKNOWN);
288 } 284 }
289 285
290 child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r"); 286 child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r");
291 if (child_stderr == NULL) { 287 if (child_stderr == NULL) {
292 printf ("Could not open stderr for %s\n", command_line); 288 printf (_("Could not open stderr for %s\n"), command_line);
293 } 289 }
294 290
295 while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) 291 while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process))
@@ -388,14 +384,14 @@ main (int argc, char **argv)
388 } 384 }
389 else if (excode != REG_NOMATCH) { 385 else if (excode != REG_NOMATCH) {
390 regerror (excode, &preg, errbuf, MAX_INPUT_BUFFER); 386 regerror (excode, &preg, errbuf, MAX_INPUT_BUFFER);
391 printf ("Execute Error: %s\n", errbuf); 387 printf (_("Execute Error: %s\n"), errbuf);
392 exit (STATE_CRITICAL); 388 exit (STATE_CRITICAL);
393 } 389 }
394 else { 390 else {
395 iresult = STATE_CRITICAL; 391 iresult = STATE_CRITICAL;
396 } 392 }
397#else 393#else
398 printf ("%s UNKNOWN: call for regex which was not a compiled option", label); 394 printf (_("%s UNKNOWN: call for regex which was not a compiled option"), label);
399 exit (STATE_UNKNOWN); 395 exit (STATE_UNKNOWN);
400#endif 396#endif
401 } 397 }
@@ -433,7 +429,7 @@ main (int argc, char **argv)
433 if (found == 0) 429 if (found == 0)
434 terminate 430 terminate
435 (STATE_UNKNOWN, 431 (STATE_UNKNOWN,
436 "%s problem - No data recieved from host\nCMD: %s\n", 432 _("%s problem - No data recieved from host\nCMD: %s\n"),
437 label, command_line); 433 label, command_line);
438 434
439 /* WARNING if output found on stderr */ 435 /* WARNING if output found on stderr */
@@ -554,14 +550,14 @@ process_arguments (int argc, char **argv)
554 break; 550 break;
555 case 't': /* timeout period */ 551 case 't': /* timeout period */
556 if (!is_integer (optarg)) 552 if (!is_integer (optarg))
557 usage2 ("Timeout Interval must be an integer", optarg); 553 usage2 (_("Timeout Interval must be an integer"), optarg);
558 timeout_interval = atoi (optarg); 554 timeout_interval = atoi (optarg);
559 break; 555 break;
560 556
561 /* Test parameters */ 557 /* Test parameters */
562 case 'c': /* critical time threshold */ 558 case 'c': /* critical time threshold */
563 if (strspn (optarg, "0123456789:,") < strlen (optarg)) { 559 if (strspn (optarg, "0123456789:,") < strlen (optarg)) {
564 printf ("Invalid critical threshold: %s\n", optarg); 560 printf (_("Invalid critical threshold: %s\n"), optarg);
565 print_usage (); 561 print_usage ();
566 exit (STATE_UNKNOWN); 562 exit (STATE_UNKNOWN);
567 } 563 }
@@ -575,7 +571,7 @@ process_arguments (int argc, char **argv)
575 break; 571 break;
576 case 'w': /* warning time threshold */ 572 case 'w': /* warning time threshold */
577 if (strspn (optarg, "0123456789:,") < strlen (optarg)) { 573 if (strspn (optarg, "0123456789:,") < strlen (optarg)) {
578 printf ("Invalid warning threshold: %s\n", optarg); 574 printf (_("Invalid warning threshold: %s\n"), optarg);
579 print_usage (); 575 print_usage ();
580 exit (STATE_UNKNOWN); 576 exit (STATE_UNKNOWN);
581 } 577 }
@@ -622,13 +618,13 @@ process_arguments (int argc, char **argv)
622 errcode = regcomp (&preg, regex_expect, cflags); 618 errcode = regcomp (&preg, regex_expect, cflags);
623 if (errcode != 0) { 619 if (errcode != 0) {
624 regerror (errcode, &preg, errbuf, MAX_INPUT_BUFFER); 620 regerror (errcode, &preg, errbuf, MAX_INPUT_BUFFER);
625 printf ("Could Not Compile Regular Expression"); 621 printf (_("Could Not Compile Regular Expression"));
626 return ERROR; 622 return ERROR;
627 } 623 }
628 eval_method[jj++] = CRIT_REGEX; 624 eval_method[jj++] = CRIT_REGEX;
629 ii++; 625 ii++;
630#else 626#else
631 printf ("%s UNKNOWN: call for regex which was not a compiled option", label); 627 printf (_("%s UNKNOWN: call for regex which was not a compiled option"), label);
632 exit (STATE_UNKNOWN); 628 exit (STATE_UNKNOWN);
633#endif 629#endif
634 break; 630 break;
@@ -648,7 +644,7 @@ process_arguments (int argc, char **argv)
648 labels = realloc (labels, labels_size); 644 labels = realloc (labels, labels_size);
649 if (labels == NULL) 645 if (labels == NULL)
650 terminate (STATE_UNKNOWN, 646 terminate (STATE_UNKNOWN,
651 "Could not realloc() labels[%d]", nlabels); 647 _("Could not realloc() labels[%d]"), nlabels);
652 } 648 }
653 labels[nlabels - 1] = optarg; 649 labels[nlabels - 1] = optarg;
654 ptr = thisarg (optarg); 650 ptr = thisarg (optarg);
@@ -661,7 +657,7 @@ process_arguments (int argc, char **argv)
661 labels_size += 8; 657 labels_size += 8;
662 labels = realloc (labels, labels_size); 658 labels = realloc (labels, labels_size);
663 if (labels == NULL) 659 if (labels == NULL)
664 terminate (STATE_UNKNOWN, "Could not realloc() labels\n"); 660 terminate (STATE_UNKNOWN, _("Could not realloc() labels\n"));
665 } 661 }
666 labels++; 662 labels++;
667 ptr = thisarg (ptr); 663 ptr = thisarg (ptr);
@@ -679,7 +675,7 @@ process_arguments (int argc, char **argv)
679 unitv = realloc (unitv, unitv_size); 675 unitv = realloc (unitv, unitv_size);
680 if (unitv == NULL) 676 if (unitv == NULL)
681 terminate (STATE_UNKNOWN, 677 terminate (STATE_UNKNOWN,
682 "Could not realloc() units [%d]\n", nunits); 678 _("Could not realloc() units [%d]\n"), nunits);
683 } 679 }
684 unitv[nunits - 1] = optarg; 680 unitv[nunits - 1] = optarg;
685 ptr = thisarg (optarg); 681 ptr = thisarg (optarg);
@@ -692,7 +688,7 @@ process_arguments (int argc, char **argv)
692 unitv_size += 8; 688 unitv_size += 8;
693 unitv = realloc (unitv, unitv_size); 689 unitv = realloc (unitv, unitv_size);
694 if (units == NULL) 690 if (units == NULL)
695 terminate (STATE_UNKNOWN, "Could not realloc() units\n"); 691 terminate (STATE_UNKNOWN, _("Could not realloc() units\n"));
696 } 692 }
697 nunits++; 693 nunits++;
698 ptr = thisarg (ptr); 694 ptr = thisarg (ptr);
@@ -759,7 +755,7 @@ validate_arguments ()
759 } 755 }
760 else if ( strcmp(seclevel, "authNoPriv") == 0 ) { 756 else if ( strcmp(seclevel, "authNoPriv") == 0 ) {
761 if ( secname == NULL || authpasswd == NULL) { 757 if ( secname == NULL || authpasswd == NULL) {
762 printf ("Missing secname (%s) or authpassword (%s) ! \n",secname, authpasswd ); 758 printf (_("Missing secname (%s) or authpassword (%s) ! \n)"),secname, authpasswd );
763 print_usage (); 759 print_usage ();
764 exit (STATE_UNKNOWN); 760 exit (STATE_UNKNOWN);
765 } 761 }
@@ -767,7 +763,7 @@ validate_arguments ()
767 } 763 }
768 else if ( strcmp(seclevel, "authPriv") == 0 ) { 764 else if ( strcmp(seclevel, "authPriv") == 0 ) {
769 if ( secname == NULL || authpasswd == NULL || privpasswd == NULL ) { 765 if ( secname == NULL || authpasswd == NULL || privpasswd == NULL ) {
770 printf ("Missing secname (%s), authpassword (%s), or privpasswd (%s)! \n",secname, authpasswd,privpasswd ); 766 printf (("Missing secname (%s), authpassword (%s), or privpasswd (%s)! \n"),secname, authpasswd,privpasswd );
771 print_usage (); 767 print_usage ();
772 exit (STATE_UNKNOWN); 768 exit (STATE_UNKNOWN);
773 } 769 }
@@ -777,7 +773,7 @@ validate_arguments ()
777 773
778 } 774 }
779 else { 775 else {
780 printf ("Invalid SNMP version: %s\n", proto); 776 printf (_("Invalid SNMP version: %s\n"), proto);
781 print_usage (); 777 print_usage ();
782 exit (STATE_UNKNOWN); 778 exit (STATE_UNKNOWN);
783 } 779 }
diff --git a/plugins/utils.h b/plugins/utils.h
index e581afa..83793e4 100644
--- a/plugins/utils.h
+++ b/plugins/utils.h
@@ -97,6 +97,10 @@ char *state_text (int result);
97#define COPYRIGHT "Copyright (c) %s Nagios Plugin Development Team\n\ 97#define COPYRIGHT "Copyright (c) %s Nagios Plugin Development Team\n\
98\t<%s>\n\n" 98\t<%s>\n\n"
99 99
100#define UT_HLP_VRS "\
101 %s (-h | --help) for detailed help\n\
102 %s (-V | --version) for version information\n"
103
100#define UT_HELP_VRSN "\ 104#define UT_HELP_VRSN "\
101\nOptions:\n\ 105\nOptions:\n\
102 -h, --help\n\ 106 -h, --help\n\