diff options
Diffstat (limited to 'plugins/check_fping.c')
| -rw-r--r-- | plugins/check_fping.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/plugins/check_fping.c b/plugins/check_fping.c index 86170d57..16e177ce 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\ | |||
| 88 | percentage of packet loss to trigger an alarm state.\n")); | 88 | percentage of packet loss to trigger an alarm state.\n")); |
| 89 | 89 | ||
| 90 | } | 90 | } |
| 91 | 91 | ||
| 92 | int textscan (char *buf); | 92 | int textscan (char *buf); |
| 93 | int process_arguments (int, char **); | 93 | int process_arguments (int, char **); |
| 94 | int get_threshold (char *arg, char *rv[2]); | 94 | int 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 | ||
