diff options
| -rw-r--r-- | plugins/check_disk.c | 53 | ||||
| -rw-r--r-- | plugins/check_time.c | 82 | ||||
| -rw-r--r-- | plugins/check_udp.c | 78 | ||||
| -rw-r--r-- | plugins/check_ups.c | 129 | ||||
| -rw-r--r-- | plugins/check_users.c | 72 | ||||
| -rw-r--r-- | plugins/gethostbyname.c | 55 | ||||
| -rw-r--r-- | plugins/gethostbyname.h | 54 | ||||
| -rw-r--r-- | plugins/negate.c | 83 | ||||
| -rw-r--r-- | plugins/netutils.c | 12 | ||||
| -rw-r--r-- | plugins/popen.c | 42 | ||||
| -rw-r--r-- | plugins/runcmd.c | 26 | ||||
| -rw-r--r-- | plugins/sslutils.c | 14 | ||||
| -rw-r--r-- | plugins/urlize.c | 39 | ||||
| -rw-r--r-- | plugins/utils.c | 2 |
14 files changed, 439 insertions, 302 deletions
diff --git a/plugins/check_disk.c b/plugins/check_disk.c index 001800b1..8a824c1f 100644 --- a/plugins/check_disk.c +++ b/plugins/check_disk.c | |||
| @@ -1,27 +1,40 @@ | |||
| 1 | /****************************************************************************** | 1 | /****************************************************************************** |
| 2 | 2 | * | |
| 3 | The Nagios Plugins are free software; you can redistribute them | 3 | * Nagios check_disk plugin |
| 4 | and/or modify them under the terms of the GNU General Public | 4 | * |
| 5 | License as published by the Free Software Foundation; either | 5 | * License: GPL |
| 6 | version 2 of the License, or (at your option) any later version. | 6 | * Copyright (c) 1999-2006 nagios-plugins team |
| 7 | 7 | * | |
| 8 | This program is distributed in the hope that it will be useful, | 8 | * Last Modified: $Date$ |
| 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 | * |
| 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 | * Description: |
| 11 | GNU General Public License for more details. | 11 | * |
| 12 | 12 | * This file contains the check_disk plugin | |
| 13 | You should have received a copy of the GNU General Public License | 13 | * |
| 14 | along with this program; if not, write to the Free Software | 14 | * License Information: |
| 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 15 | * |
| 16 | 16 | * This program is free software; you can redistribute it and/or modify | |
| 17 | $Id$ | 17 | * it under the terms of the GNU General Public License as published by |
| 18 | 18 | * the Free Software Foundation; either version 2 of the License, or | |
| 19 | * (at your option) any later version. | ||
| 20 | * | ||
| 21 | * This program is distributed in the hope that it will be useful, | ||
| 22 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 23 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 24 | * GNU General Public License for more details. | ||
| 25 | * | ||
| 26 | * You should have received a copy of the GNU General Public License | ||
| 27 | * along with this program; if not, write to the Free Software | ||
| 28 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 29 | * | ||
| 30 | * $Id$ | ||
| 31 | * | ||
| 19 | *****************************************************************************/ | 32 | *****************************************************************************/ |
| 20 | 33 | ||
| 21 | const char *progname = "check_disk"; | 34 | const char *progname = "check_disk"; |
| 22 | const char *program_name = "check_disk"; /* Required for coreutils libs */ | 35 | const char *program_name = "check_disk"; /* Required for coreutils libs */ |
| 23 | const char *revision = "$Revision$"; | 36 | const char *revision = "$Revision$"; |
| 24 | const char *copyright = "1999-2005"; | 37 | const char *copyright = "1999-2006"; |
| 25 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | 38 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; |
| 26 | 39 | ||
| 27 | /* | 40 | /* |
| @@ -704,8 +717,8 @@ print_help (void) | |||
| 704 | printf ("Copyright (c) 1999 Ethan Galstad <nagios@nagios.org>\n"); | 717 | printf ("Copyright (c) 1999 Ethan Galstad <nagios@nagios.org>\n"); |
| 705 | printf (COPYRIGHT, copyright, email); | 718 | printf (COPYRIGHT, copyright, email); |
| 706 | 719 | ||
| 707 | printf (_("This plugin checks the amount of used disk space on a mounted file system")); | 720 | printf ("%s\n", _("This plugin checks the amount of used disk space on a mounted file system")); |
| 708 | printf (_("and generates an alert if free space is less than one of the threshold values")); | 721 | printf ("%s\n", _("and generates an alert if free space is less than one of the threshold values")); |
| 709 | 722 | ||
| 710 | printf ("\n\n"); | 723 | printf ("\n\n"); |
| 711 | 724 | ||
diff --git a/plugins/check_time.c b/plugins/check_time.c index ff94d9b3..84cdcd53 100644 --- a/plugins/check_time.c +++ b/plugins/check_time.c | |||
| @@ -1,26 +1,40 @@ | |||
| 1 | /****************************************************************************** | 1 | /****************************************************************************** |
| 2 | 2 | * | |
| 3 | This program is free software; you can redistribute it and/or modify | 3 | * Nagios check_time plugin |
| 4 | it under the terms of the GNU General Public License as published by | 4 | * |
| 5 | the Free Software Foundation; either version 2 of the License, or | 5 | * License: GPL |
| 6 | (at your option) any later version. | 6 | * Copyright (c) 1999-2006 nagios-plugins team |
| 7 | 7 | * | |
| 8 | This program is distributed in the hope that it will be useful, | 8 | * Last Modified: $Date$ |
| 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 | * |
| 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 | * Description: |
| 11 | GNU General Public License for more details. | 11 | * |
| 12 | 12 | * This file contains the check_time plugin | |
| 13 | You should have received a copy of the GNU General Public License | 13 | * |
| 14 | along with this program; if not, write to the Free Software | 14 | * License Information: |
| 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 15 | * |
| 16 | 16 | * This program is free software; you can redistribute it and/or modify | |
| 17 | $Id$ | 17 | * it under the terms of the GNU General Public License as published by |
| 18 | 18 | * the Free Software Foundation; either version 2 of the License, or | |
| 19 | * (at your option) any later version. | ||
| 20 | * | ||
| 21 | * This program is distributed in the hope that it will be useful, | ||
| 22 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 23 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 24 | * GNU General Public License for more details. | ||
| 25 | * | ||
| 26 | * You should have received a copy of the GNU General Public License | ||
| 27 | * along with this program; if not, write to the Free Software | ||
| 28 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 29 | * | ||
| 30 | * | ||
| 31 | * $Id$ | ||
| 32 | * | ||
| 19 | ******************************************************************************/ | 33 | ******************************************************************************/ |
| 20 | 34 | ||
| 21 | const char *progname = "check_time"; | 35 | const char *progname = "check_time"; |
| 22 | const char *revision = "$Revision$"; | 36 | const char *revision = "$Revision$"; |
| 23 | const char *copyright = "1999-2004"; | 37 | const char *copyright = "1999-2006"; |
| 24 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | 38 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; |
| 25 | 39 | ||
| 26 | #include "common.h" | 40 | #include "common.h" |
| @@ -324,7 +338,9 @@ print_help (void) | |||
| 324 | printf ("Copyright (c) 1999 Ethan Galstad\n"); | 338 | printf ("Copyright (c) 1999 Ethan Galstad\n"); |
| 325 | printf (COPYRIGHT, copyright, email); | 339 | printf (COPYRIGHT, copyright, email); |
| 326 | 340 | ||
| 327 | printf (_("This plugin will check the time on the specified host.\n\n")); | 341 | printf ("%s\n", _("This plugin will check the time on the specified host.")); |
| 342 | |||
| 343 | printf ("\n\n"); | ||
| 328 | 344 | ||
| 329 | print_usage (); | 345 | print_usage (); |
| 330 | 346 | ||
| @@ -332,20 +348,18 @@ print_help (void) | |||
| 332 | 348 | ||
| 333 | printf (_(UT_HOST_PORT), 'p', myport); | 349 | printf (_(UT_HOST_PORT), 'p', myport); |
| 334 | 350 | ||
| 335 | printf (_("\ | 351 | printf (" %s\n", "-u, --udp"); |
| 336 | -u, --udp\n\ | 352 | printf (" %s\n", _("Use UDP to connect, not TCP")); |
| 337 | Use UDP to connect, not TCP\n\ | 353 | printf (" %s\n", "-w, --warning-variance=INTEGER"); |
| 338 | -w, --warning-variance=INTEGER\n\ | 354 | printf (" %s\n", _("Time difference (sec.) necessary to result in a warning status")); |
| 339 | Time difference (sec.) necessary to result in a warning status\n\ | 355 | printf (" %s\n", "-c, --critical-variance=INTEGER"); |
| 340 | -c, --critical-variance=INTEGER\n\ | 356 | printf (" %s\n", _("Time difference (sec.) necessary to result in a critical status")); |
| 341 | Time difference (sec.) necessary to result in a critical status\n\ | 357 | printf (" %s\n", "-W, --warning-connect=INTEGER"); |
| 342 | -W, --warning-connect=INTEGER\n\ | 358 | printf (" %s\n", _("Response time (sec.) necessary to result in warning status")); |
| 343 | Response time (sec.) necessary to result in warning status\n\ | 359 | printf (" %s\n", "-C, --critical-connect=INTEGER"); |
| 344 | -C, --critical-connect=INTEGER\n\ | 360 | printf (" %s\n", _("Response time (sec.) necessary to result in critical status")); |
| 345 | Response time (sec.) necessary to result in critical status\n")); | ||
| 346 | 361 | ||
| 347 | printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT); | 362 | printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT); |
| 348 | |||
| 349 | printf (_(UT_SUPPORT)); | 363 | printf (_(UT_SUPPORT)); |
| 350 | } | 364 | } |
| 351 | 365 | ||
| @@ -354,7 +368,7 @@ print_help (void) | |||
| 354 | void | 368 | void |
| 355 | print_usage (void) | 369 | print_usage (void) |
| 356 | { | 370 | { |
| 357 | printf ("\ | 371 | printf (_("Usage:")); |
| 358 | Usage: %s -H <host_address> [-p port] [-u] [-w variance] [-c variance]\n\ | 372 | printf ("%s -H <host_address> [-p port] [-u] [-w variance] [-c variance]\n",progname); |
| 359 | [-W connect_time] [-C connect_time] [-t timeout]\n", progname); | 373 | printf (" [-W connect_time] [-C connect_time] [-t timeout]\n"); |
| 360 | } | 374 | } |
diff --git a/plugins/check_udp.c b/plugins/check_udp.c index e7d5280c..a712871c 100644 --- a/plugins/check_udp.c +++ b/plugins/check_udp.c | |||
| @@ -1,26 +1,39 @@ | |||
| 1 | /****************************************************************************** | 1 | /****************************************************************************** |
| 2 | 2 | * | |
| 3 | This program is free software; you can redistribute it and/or modify | 3 | * Nagios check_udp plugin |
| 4 | it under the terms of the GNU General Public License as published by | 4 | * |
| 5 | the Free Software Foundation; either version 2 of the License, or | 5 | * License: GPL |
| 6 | (at your option) any later version. | 6 | * Copyright (c) 1999-2006 nagios-plugins team |
| 7 | 7 | * | |
| 8 | This program is distributed in the hope that it will be useful, | 8 | * Last Modified: $Date$ |
| 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 | * |
| 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 | * Description: |
| 11 | GNU General Public License for more details. | 11 | * |
| 12 | 12 | * This file contains the check_udp plugin | |
| 13 | You should have received a copy of the GNU General Public License | 13 | * |
| 14 | along with this program; if not, write to the Free Software | 14 | * License Information: |
| 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 15 | * |
| 16 | 16 | * This program is free software; you can redistribute it and/or modify | |
| 17 | $Id$ | 17 | * it under the terms of the GNU General Public License as published by |
| 18 | 18 | * the Free Software Foundation; either version 2 of the License, or | |
| 19 | * (at your option) any later version. | ||
| 20 | * | ||
| 21 | * This program is distributed in the hope that it will be useful, | ||
| 22 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 23 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 24 | * GNU General Public License for more details. | ||
| 25 | * | ||
| 26 | * You should have received a copy of the GNU General Public License | ||
| 27 | * along with this program; if not, write to the Free Software | ||
| 28 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 29 | * | ||
| 30 | * $Id$ | ||
| 31 | * | ||
| 19 | *****************************************************************************/ | 32 | *****************************************************************************/ |
| 20 | 33 | ||
| 21 | const char *progname = "check_udp"; | 34 | const char *progname = "check_udp"; |
| 22 | const char *revision = "$Revision$"; | 35 | const char *revision = "$Revision$"; |
| 23 | const char *copyright = "1999-2004"; | 36 | const char *copyright = "1999-2006"; |
| 24 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | 37 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; |
| 25 | 38 | ||
| 26 | #include "common.h" | 39 | #include "common.h" |
| @@ -222,8 +235,9 @@ print_help (void) | |||
| 222 | printf ("Copyright (c) 1999 Ethan Galstad\n"); | 235 | printf ("Copyright (c) 1999 Ethan Galstad\n"); |
| 223 | printf (COPYRIGHT, copyright, email); | 236 | printf (COPYRIGHT, copyright, email); |
| 224 | 237 | ||
| 225 | printf (_("\ | 238 | printf ("%s\n", _("This plugin tests an UDP connection with the specified host.")); |
| 226 | This plugin tests an UDP connection with the specified host.\n\n")); | 239 | |
| 240 | printf ("\n\n"); | ||
| 227 | 241 | ||
| 228 | print_usage (); | 242 | print_usage (); |
| 229 | 243 | ||
| @@ -231,11 +245,10 @@ print_help (void) | |||
| 231 | 245 | ||
| 232 | printf (_(UT_HOST_PORT), 'p', "none"); | 246 | printf (_(UT_HOST_PORT), 'p', "none"); |
| 233 | 247 | ||
| 234 | printf (_("\ | 248 | printf (" %s\n", "-e, --expect=STRING <optional>"); |
| 235 | -e, --expect=STRING <optional>\n\ | 249 | printf (" %s\n", _("String to expect in first line of server response")); |
| 236 | String to expect in first line of server response\n\ | 250 | printf (" %s\n", "-s, --send=STRING <optional>"); |
| 237 | -s, --send=STRING <optional>\n\ | 251 | printf (" %s\n", _("String to send to the server when initiating the connection")); |
| 238 | String to send to the server when initiating the connection\n")); | ||
| 239 | 252 | ||
| 240 | printf (_(UT_WARN_CRIT)); | 253 | printf (_(UT_WARN_CRIT)); |
| 241 | 254 | ||
| @@ -243,11 +256,10 @@ print_help (void) | |||
| 243 | 256 | ||
| 244 | printf (_(UT_VERBOSE)); | 257 | printf (_(UT_VERBOSE)); |
| 245 | 258 | ||
| 246 | printf (_("\ | 259 | printf ("%s\n", _("This plugin will attempt to connect to the specified port on the host.")); |
| 247 | This plugin will attempt to connect to the specified port on the host.\n\ | 260 | printf (" %s\n", _("Successful connects return STATE_OK, refusals and timeouts return")); |
| 248 | Successful connects return STATE_OK, refusals and timeouts return\n\ | 261 | printf (" %s\n", _("STATE_CRITICAL, other errors return STATE_UNKNOWN.")); |
| 249 | STATE_CRITICAL, other errors return STATE_UNKNOWN.\n\n")); | 262 | |
| 250 | |||
| 251 | printf(_(UT_SUPPORT)); | 263 | printf(_(UT_SUPPORT)); |
| 252 | } | 264 | } |
| 253 | 265 | ||
| @@ -258,7 +270,7 @@ STATE_CRITICAL, other errors return STATE_UNKNOWN.\n\n")); | |||
| 258 | void | 270 | void |
| 259 | print_usage (void) | 271 | print_usage (void) |
| 260 | { | 272 | { |
| 261 | printf ("\ | 273 | printf (_("Usage:")); |
| 262 | Usage: %s -H <host_address> [-p port] [-w warn_time] [-c crit_time]\n\ | 274 | printf ("%s -H <host_address> [-p port] [-w warn_time] [-c crit_time]\n", progname); |
| 263 | [-e expect] [-s send] [-t to_sec] [-v]\n", progname); | 275 | printf (" [-e expect] [-s send] [-t to_sec] [-v]\n"); |
| 264 | } | 276 | } |
diff --git a/plugins/check_ups.c b/plugins/check_ups.c index 786cedcc..110ea0a2 100644 --- a/plugins/check_ups.c +++ b/plugins/check_ups.c | |||
| @@ -1,35 +1,42 @@ | |||
| 1 | /****************************************************************************** | 1 | /****************************************************************************** |
| 2 | 2 | * | |
| 3 | check_ups | 3 | * Nagios check_ups plugin |
| 4 | 4 | * | |
| 5 | Program: Network UPS Tools plugin for Nagios | 5 | * License: GPL |
| 6 | License: GPL | 6 | * Copyright (c) 2000 Tom Shields |
| 7 | Copyright (c) 2000 Tom Shields | 7 | * 2004 Alain Richard <alain.richard@equation.fr> |
| 8 | 2004 Alain Richard <alain.richard@equation.fr> | 8 | * 2004 Arnaud Quette <arnaud.quette@mgeups.com> |
| 9 | 2004 Arnaud Quette <arnaud.quette@mgeups.com> | 9 | * Copyright (c) 2002-2006 nagios-plugins team |
| 10 | 10 | * | |
| 11 | 11 | * Last Modified: $Date$ | |
| 12 | This program is free software; you can redistribute it and/or modify | 12 | * |
| 13 | it under the terms of the GNU General Public License as published by | 13 | * Description: |
| 14 | the Free Software Foundation; either version 2 of the License, or (at | 14 | * |
| 15 | your option) any later version. | 15 | * This file contains Network UPS Tools plugin for Nagios |
| 16 | 16 | * | |
| 17 | This program is distributed in the hope that it will be useful, but | 17 | * License Information: |
| 18 | WITHOUT ANY WARRANTY; without even the implied warranty of | 18 | * |
| 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 19 | * This program is free software; you can redistribute it and/or modify |
| 20 | General Public License for more details. | 20 | * it under the terms of the GNU General Public License as published by |
| 21 | 21 | * the Free Software Foundation; either version 2 of the License, or | |
| 22 | You should have received a copy of the GNU General Public License | 22 | * (at your option) any later version. |
| 23 | along with this program; if not, write to the Free Software | 23 | * |
| 24 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 24 | * This program is distributed in the hope that it will be useful, |
| 25 | 25 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 26 | $Id$ | 26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 27 | 27 | * GNU General Public License for more details. | |
| 28 | * | ||
| 29 | * You should have received a copy of the GNU General Public License | ||
| 30 | * along with this program; if not, write to the Free Software | ||
| 31 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 32 | * | ||
| 33 | * $Id$ | ||
| 34 | * | ||
| 28 | ******************************************************************************/ | 35 | ******************************************************************************/ |
| 29 | 36 | ||
| 30 | const char *progname = "check_ups"; | 37 | const char *progname = "check_ups"; |
| 31 | const char *revision = "$Revision$"; | 38 | const char *revision = "$Revision$"; |
| 32 | const char *copyright = "2000-2004"; | 39 | const char *copyright = "2000-2006"; |
| 33 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | 40 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; |
| 34 | 41 | ||
| 35 | #include "common.h" | 42 | #include "common.h" |
| @@ -338,7 +345,7 @@ determine_status (void) | |||
| 338 | res=get_ups_variable ("ups.status", recv_buffer, sizeof (recv_buffer)); | 345 | res=get_ups_variable ("ups.status", recv_buffer, sizeof (recv_buffer)); |
| 339 | if (res == NOSUCHVAR) return OK; | 346 | if (res == NOSUCHVAR) return OK; |
| 340 | if (res != STATE_OK) { | 347 | if (res != STATE_OK) { |
| 341 | printf (_("Invalid response received from host\n")); | 348 | printf ("%s\n", _("Invalid response received from host")); |
| 342 | return ERROR; | 349 | return ERROR; |
| 343 | } | 350 | } |
| 344 | 351 | ||
| @@ -398,7 +405,7 @@ get_ups_variable (const char *varname, char *buf, size_t buflen) | |||
| 398 | if (process_tcp_request | 405 | if (process_tcp_request |
| 399 | (server_address, server_port, send_buffer, temp_buffer, | 406 | (server_address, server_port, send_buffer, temp_buffer, |
| 400 | sizeof (temp_buffer)) != STATE_OK) { | 407 | sizeof (temp_buffer)) != STATE_OK) { |
| 401 | printf (_("Invalid response received from host\n")); | 408 | printf ("%s\n", _("Invalid response received from host")); |
| 402 | return ERROR; | 409 | return ERROR; |
| 403 | } | 410 | } |
| 404 | 411 | ||
| @@ -416,7 +423,7 @@ get_ups_variable (const char *varname, char *buf, size_t buflen) | |||
| 416 | } | 423 | } |
| 417 | 424 | ||
| 418 | if (strcmp (ptr, "ERR DATA-STALE") == 0) { | 425 | if (strcmp (ptr, "ERR DATA-STALE") == 0) { |
| 419 | printf (_("CRITICAL - UPS data is stale\n")); | 426 | printf ("%s\n", _("CRITICAL - UPS data is stale")); |
| 420 | return ERROR; | 427 | return ERROR; |
| 421 | } | 428 | } |
| 422 | 429 | ||
| @@ -428,7 +435,7 @@ get_ups_variable (const char *varname, char *buf, size_t buflen) | |||
| 428 | ptr = temp_buffer + strlen (varname) + strlen (ups_name) + 6; | 435 | ptr = temp_buffer + strlen (varname) + strlen (ups_name) + 6; |
| 429 | len = strlen(ptr); | 436 | len = strlen(ptr); |
| 430 | if (len < 2 || ptr[0] != '"' || ptr[len-1] != '"') { | 437 | if (len < 2 || ptr[0] != '"' || ptr[len-1] != '"') { |
| 431 | printf (_("Error: unable to parse variable\n")); | 438 | printf ("%s\n", _("Error: unable to parse variable")); |
| 432 | return ERROR; | 439 | return ERROR; |
| 433 | } | 440 | } |
| 434 | strncpy (buf, ptr+1, len - 2); | 441 | strncpy (buf, ptr+1, len - 2); |
| @@ -573,7 +580,7 @@ int | |||
| 573 | validate_arguments (void) | 580 | validate_arguments (void) |
| 574 | { | 581 | { |
| 575 | if (! ups_name) { | 582 | if (! ups_name) { |
| 576 | printf (_("Error : no ups indicated\n")); | 583 | printf ("%s\n", _("Error : no ups indicated")); |
| 577 | return ERROR; | 584 | return ERROR; |
| 578 | } | 585 | } |
| 579 | return OK; | 586 | return OK; |
| @@ -593,9 +600,10 @@ print_help (void) | |||
| 593 | printf ("Copyright (c) 2004 Arnaud Quette <arnaud.quette@mgeups.com>\n"); | 600 | printf ("Copyright (c) 2004 Arnaud Quette <arnaud.quette@mgeups.com>\n"); |
| 594 | printf (COPYRIGHT, copyright, email); | 601 | printf (COPYRIGHT, copyright, email); |
| 595 | 602 | ||
| 596 | printf (_("This plugin tests the UPS service on the specified host.\n\ | 603 | printf ("%s\n", _("This plugin tests the UPS service on the specified host.Network UPS Tools ")); |
| 597 | Network UPS Tools from www.networkupstools.org must be running for this\n\ | 604 | printf ("%s\n", _("from www.networkupstools.org must be running for thisplugin to work.")); |
| 598 | plugin to work.\n\n")); | 605 | |
| 606 | printf ("\n\n"); | ||
| 599 | 607 | ||
| 600 | print_usage (); | 608 | print_usage (); |
| 601 | 609 | ||
| @@ -603,13 +611,10 @@ plugin to work.\n\n")); | |||
| 603 | 611 | ||
| 604 | printf (_(UT_HOST_PORT), 'p', myport); | 612 | printf (_(UT_HOST_PORT), 'p', myport); |
| 605 | 613 | ||
| 606 | printf (_("\ | 614 | printf (" %s\n", "-u, --ups=STRING"); |
| 607 | -u, --ups=STRING\n\ | 615 | printf (" %s\n", _("Name of UPS")); |
| 608 | Name of UPS\n")); | 616 | printf (" %s\n", "-T, --temperature"); |
| 609 | 617 | printf (" %s\n", _("Output of temperatures in Celsius")); | |
| 610 | printf (_("\ | ||
| 611 | -T, --temperature\n\ | ||
| 612 | Output of temperatures in Celsius\n")); | ||
| 613 | 618 | ||
| 614 | printf (_(UT_WARN_CRIT)); | 619 | printf (_(UT_WARN_CRIT)); |
| 615 | 620 | ||
| @@ -617,24 +622,23 @@ plugin to work.\n\n")); | |||
| 617 | 622 | ||
| 618 | printf (_(UT_VERBOSE)); | 623 | printf (_(UT_VERBOSE)); |
| 619 | 624 | ||
| 620 | printf (_("\ | 625 | printf ("\n"); |
| 621 | This plugin attempts to determine the status of a UPS (Uninterruptible Power\n\ | 626 | printf ("%s\n", _("Notes:")); |
| 622 | Supply) on a local or remote host. If the UPS is online or calibrating, the\n\ | 627 | |
| 623 | plugin will return an OK state. If the battery is on it will return a WARNING\n\ | 628 | printf ("%s\n", _("This plugin attempts to determine the status of a UPS (Uninterruptible Power")); |
| 624 | state. If the UPS is off or has a low battery the plugin will return a CRITICAL\n\ | 629 | printf ("%s\n", _("Supply) on a local or remote host. If the UPS is online or calibrating, the")); |
| 625 | state.\n\n")); | 630 | printf ("%s\n", _("plugin will return an OK state. If the battery is on it will return a WARNING")); |
| 626 | 631 | printf ("%s\n", _("state.If the UPS is off or has a low battery the plugin will return a CRITICAL")); | |
| 627 | printf (_("\ | 632 | printf ("%s\n\n", _("state.")); |
| 628 | You may also specify a variable to check [such as temperature, utility voltage,\n\ | 633 | |
| 629 | battery load, etc.] as well as warning and critical thresholds for the value of\n\ | 634 | printf ("%s\n", _("You may also specify a variable to check [such as temperature, utility voltage,")); |
| 630 | that variable. If the remote host has multiple UPS that are being monitored you\n\ | 635 | printf ("%s\n", _("battery load, etc.] as well as warning and critical thresholds for the value of")); |
| 631 | will have to use the [ups] option to specify which UPS to check.\n\n")); | 636 | printf ("%s\n", _("that variable. If the remote host has multiple UPS that are being monitored you")); |
| 632 | 637 | printf ("%s\n", _("will have to use the [ups] option to specify which UPS to check.")); | |
| 633 | printf (_("Notes:\n\n\ | 638 | |
| 634 | This plugin requires that the UPSD daemon distributed with Russel Kroll's\n\ | 639 | printf ("%s\n", _("This plugin requires that the UPSD daemon distributed with Russel Kroll's")); |
| 635 | Smart UPS Tools be installed on the remote host. If you do not have the\n\ | 640 | printf ("%s\n", _("Smart UPS Tools be installed on the remote host. If you do not have the")); |
| 636 | package installed on your system, you can download it from\n\ | 641 | printf ("%s\n", _("package installed on your system, you can download it from http://www.networkupstools.org")); |
| 637 | http://www.networkupstools.org\n\n")); | ||
| 638 | 642 | ||
| 639 | printf (_(UT_SUPPORT)); | 643 | printf (_(UT_SUPPORT)); |
| 640 | } | 644 | } |
| @@ -643,7 +647,6 @@ http://www.networkupstools.org\n\n")); | |||
| 643 | void | 647 | void |
| 644 | print_usage (void) | 648 | print_usage (void) |
| 645 | { | 649 | { |
| 646 | printf ("\ | 650 | printf (_("Usage:")); |
| 647 | Usage: %s -H host -u ups [-p port] [-v variable]\n\ | 651 | printf ("%s -H host -u ups [-p port] [-v variable] [-w warn_value] [-c crit_value] [-to to_sec] [-T]\n", progname); |
| 648 | [-wv warn_value] [-cv crit_value] [-to to_sec] [-T]\n", progname); | ||
| 649 | } | 652 | } |
diff --git a/plugins/check_users.c b/plugins/check_users.c index 25d04ed0..34d47752 100644 --- a/plugins/check_users.c +++ b/plugins/check_users.c | |||
| @@ -1,26 +1,39 @@ | |||
| 1 | /***************************************************************************** | 1 | /****************************************************************************** |
| 2 | 2 | * | |
| 3 | This program is free software; you can redistribute it and/or modify | 3 | * Nagios check_users plugin |
| 4 | it under the terms of the GNU General Public License as published by | 4 | * |
| 5 | the Free Software Foundation; either version 2 of the License, or | 5 | * License: GPL |
| 6 | (at your option) any later version. | 6 | * Copyright (c) 2002-2006 nagios-plugins team |
| 7 | 7 | * | |
| 8 | This program is distributed in the hope that it will be useful, | 8 | * Last Modified: $Date$ |
| 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 | * |
| 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 | * Description: |
| 11 | GNU General Public License for more details. | 11 | * |
| 12 | 12 | * This file contains the check_users plugin | |
| 13 | You should have received a copy of the GNU General Public License | 13 | * |
| 14 | along with this program; if not, write to the Free Software | 14 | * License Information: |
| 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 15 | * |
| 16 | 16 | * This program is free software; you can redistribute it and/or modify | |
| 17 | $Id$ | 17 | * it under the terms of the GNU General Public License as published by |
| 18 | 18 | * the Free Software Foundation; either version 2 of the License, or | |
| 19 | * (at your option) any later version. | ||
| 20 | * | ||
| 21 | * This program is distributed in the hope that it will be useful, | ||
| 22 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 23 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 24 | * GNU General Public License for more details. | ||
| 25 | * | ||
| 26 | * You should have received a copy of the GNU General Public License | ||
| 27 | * along with this program; if not, write to the Free Software | ||
| 28 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 29 | * | ||
| 30 | * $Id$ | ||
| 31 | * | ||
| 19 | *****************************************************************************/ | 32 | *****************************************************************************/ |
| 20 | 33 | ||
| 21 | const char *progname = "check_users"; | 34 | const char *progname = "check_users"; |
| 22 | const char *revision = "$Revision$"; | 35 | const char *revision = "$Revision$"; |
| 23 | const char *copyright = "2000-2004"; | 36 | const char *copyright = "2000-2006"; |
| 24 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | 37 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; |
| 25 | 38 | ||
| 26 | #include "common.h" | 39 | #include "common.h" |
| @@ -98,7 +111,7 @@ main (int argc, char **argv) | |||
| 98 | result = STATE_OK; | 111 | result = STATE_OK; |
| 99 | 112 | ||
| 100 | if (result == STATE_UNKNOWN) | 113 | if (result == STATE_UNKNOWN) |
| 101 | printf (_("Unable to read output\n")); | 114 | printf ("%s\n", _("Unable to read output")); |
| 102 | else { | 115 | else { |
| 103 | asprintf(&perf, "%s", perfdata ("users", users, "", | 116 | asprintf(&perf, "%s", perfdata ("users", users, "", |
| 104 | TRUE, wusers, | 117 | TRUE, wusers, |
| @@ -190,19 +203,19 @@ print_help (void) | |||
| 190 | printf ("Copyright (c) 1999 Ethan Galstad\n"); | 203 | printf ("Copyright (c) 1999 Ethan Galstad\n"); |
| 191 | printf (COPYRIGHT, copyright, email); | 204 | printf (COPYRIGHT, copyright, email); |
| 192 | 205 | ||
| 193 | printf (_("\ | 206 | printf ("%s\n", _("This plugin checks the number of users currently logged in on the local")); |
| 194 | This plugin checks the number of users currently logged in on the local\n\ | 207 | printf ("%s\n", _("system and generates an error if the number exceeds the thresholds specified.")); |
| 195 | system and generates an error if the number exceeds the thresholds specified.\n")); | 208 | |
| 209 | printf ("\n\n"); | ||
| 196 | 210 | ||
| 197 | print_usage (); | 211 | print_usage (); |
| 198 | 212 | ||
| 199 | printf (_(UT_HELP_VRSN)); | 213 | printf (_(UT_HELP_VRSN)); |
| 200 | 214 | ||
| 201 | printf (_("\ | 215 | printf (" %s\n", "-w, --warning=INTEGER"); |
| 202 | -w, --warning=INTEGER\n\ | 216 | printf (" %s\n", _("Set WARNING status if more than INTEGER users are logged in")); |
| 203 | Set WARNING status if more than INTEGER users are logged in\n\ | 217 | printf (" %s\n", "-c, --critical=INTEGER"); |
| 204 | -c, --critical=INTEGER\n\ | 218 | printf (" %s\n", _("Set CRITICAL status if more than INTEGER users are logged in")); |
| 205 | Set CRITICAL status if more than INTEGER users are logged in\n")); | ||
| 206 | 219 | ||
| 207 | printf (_(UT_SUPPORT)); | 220 | printf (_(UT_SUPPORT)); |
| 208 | } | 221 | } |
| @@ -211,5 +224,6 @@ system and generates an error if the number exceeds the thresholds specified.\n" | |||
| 211 | void | 224 | void |
| 212 | print_usage (void) | 225 | print_usage (void) |
| 213 | { | 226 | { |
| 214 | printf ("Usage: %s -w <users> -c <users>\n", progname); | 227 | printf (_("Usage:")); |
| 228 | printf ("%s -w <users> -c <users>\n", progname); | ||
| 215 | } | 229 | } |
diff --git a/plugins/gethostbyname.c b/plugins/gethostbyname.c index d1b768bc..c8f39edc 100644 --- a/plugins/gethostbyname.c +++ b/plugins/gethostbyname.c | |||
| @@ -1,25 +1,36 @@ | |||
| 1 | /* | 1 | /****************************************************************************** |
| 2 | * This file is a ghastly hack because nobody can agree on | 2 | * |
| 3 | * gethostbyname_r()'s prototype. | 3 | * Nagios gethostbyname_r()'s prototype. |
| 4 | * | 4 | * |
| 5 | * Copyright (C) 2001,2002 Brian Stafford <brian@stafford.uklinux.net> | 5 | * License: GPL |
| 6 | * | 6 | * Copyright (C) 2001,2002 Brian Stafford <brian@stafford.uklinux.net> |
| 7 | * This library is free software; you can redistribute it and/or | 7 | * |
| 8 | * modify it under the terms of the GNU Lesser General Public | 8 | * Last Modified: $Date$ |
| 9 | * License as published by the Free Software Foundation; either | 9 | * |
| 10 | * version 2.1 of the License, or (at your option) any later version. | 10 | * Description: |
| 11 | * | 11 | * |
| 12 | * This library is distributed in the hope that it will be useful, | 12 | * This file is a ghastly hack because nobody can agree on |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | * gethostbyname_r()'s prototype. |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 | * |
| 15 | * Lesser General Public License for more details. | 15 | * License Information: |
| 16 | * | 16 | * |
| 17 | * You should have received a copy of the GNU Lesser General Public | 17 | * This program is free software; you can redistribute it and/or modify |
| 18 | * License along with this library; if not, write to the Free Software | 18 | * it under the terms of the GNU General Public License as published by |
| 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 19 | * the Free Software Foundation; either version 2 of the License, or |
| 20 | * | 20 | * (at your option) any later version. |
| 21 | * $Id$ | 21 | * |
| 22 | */ | 22 | * This program is distributed in the hope that it will be useful, |
| 23 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 25 | * GNU General Public License for more details. | ||
| 26 | * | ||
| 27 | * You should have received a copy of the GNU General Public License | ||
| 28 | * along with this program; if not, write to the Free Software | ||
| 29 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 30 | * | ||
| 31 | * $Id$ | ||
| 32 | * | ||
| 33 | *****************************************************************************/ | ||
| 23 | 34 | ||
| 24 | #ifdef HAVE_CONFIG_H | 35 | #ifdef HAVE_CONFIG_H |
| 25 | #include <config.h> | 36 | #include <config.h> |
diff --git a/plugins/gethostbyname.h b/plugins/gethostbyname.h index e420837d..d95ab26d 100644 --- a/plugins/gethostbyname.h +++ b/plugins/gethostbyname.h | |||
| @@ -1,25 +1,35 @@ | |||
| 1 | /* | 1 | /****************************************************************************** |
| 2 | * This file is a ghastly hack because nobody can agree on | 2 | * |
| 3 | * gethostbyname_r()'s prototype. | 3 | * Nagios gethostbyname_r()'s prototype. |
| 4 | * | 4 | * |
| 5 | * Copyright (C) 2001,2002 Brian Stafford <brian@stafford.uklinux.net> | 5 | * License: GPL |
| 6 | * | 6 | * Copyright (C) 2001,2002 Brian Stafford <brian@stafford.uklinux.net> |
| 7 | * This library is free software; you can redistribute it and/or | 7 | * |
| 8 | * modify it under the terms of the GNU Lesser General Public | 8 | * Last Modified: $Date$ |
| 9 | * License as published by the Free Software Foundation; either | 9 | * |
| 10 | * version 2.1 of the License, or (at your option) any later version. | 10 | * Description: |
| 11 | * | 11 | * |
| 12 | * This library is distributed in the hope that it will be useful, | 12 | * This file is a ghastly hack because nobody can agree on |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | * gethostbyname_r()'s prototype. |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 | * |
| 15 | * Lesser General Public License for more details. | 15 | * License Information: |
| 16 | * | 16 | * |
| 17 | * You should have received a copy of the GNU Lesser General Public | 17 | * This program is free software; you can redistribute it and/or modify |
| 18 | * License along with this library; if not, write to the Free Software | 18 | * it under the terms of the GNU General Public License as published by |
| 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 19 | * the Free Software Foundation; either version 2 of the License, or |
| 20 | * | 20 | * (at your option) any later version. |
| 21 | * $Id$ | 21 | * |
| 22 | */ | 22 | * This program is distributed in the hope that it will be useful, |
| 23 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 25 | * GNU General Public License for more details. | ||
| 26 | * | ||
| 27 | * You should have received a copy of the GNU General Public License | ||
| 28 | * along with this program; if not, write to the Free Software | ||
| 29 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 30 | * | ||
| 31 | * $Id$ | ||
| 32 | *****************************************************************************/ | ||
| 23 | 33 | ||
| 24 | /************************************************************************* | 34 | /************************************************************************* |
| 25 | Usage: | 35 | Usage: |
diff --git a/plugins/negate.c b/plugins/negate.c index d08c3a30..76bb6bbb 100644 --- a/plugins/negate.c +++ b/plugins/negate.c | |||
| @@ -1,20 +1,33 @@ | |||
| 1 | /****************************************************************************** | 1 | /****************************************************************************** |
| 2 | 2 | * | |
| 3 | This program is free software; you can redistribute it and/or modify | 3 | * Nagios negate plugin |
| 4 | it under the terms of the GNU General Public License as published by | 4 | * |
| 5 | the Free Software Foundation; either version 2 of the License, or | 5 | * License: GPL |
| 6 | (at your option) any later version. | 6 | * Copyright (c) 2002-2006 nagios-plugins team |
| 7 | 7 | * | |
| 8 | This program is distributed in the hope that it will be useful, | 8 | * Last Modified: $Date$ |
| 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 | * |
| 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 | * Description: |
| 11 | GNU General Public License for more details. | 11 | * |
| 12 | 12 | * This file contains the negate plugin | |
| 13 | You should have received a copy of the GNU General Public License | 13 | * |
| 14 | along with this program; if not, write to the Free Software | 14 | * License Information: |
| 15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 15 | * |
| 16 | 16 | * This program is free software; you can redistribute it and/or modify | |
| 17 | $Id$ | 17 | * it under the terms of the GNU General Public License as published by |
| 18 | * the Free Software Foundation; either version 2 of the License, or | ||
| 19 | * (at your option) any later version. | ||
| 20 | * | ||
| 21 | * This program is distributed in the hope that it will be useful, | ||
| 22 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 23 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 24 | * GNU General Public License for more details. | ||
| 25 | * | ||
| 26 | * You should have received a copy of the GNU General Public License | ||
| 27 | * along with this program; if not, write to the Free Software | ||
| 28 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 29 | * | ||
| 30 | * $Id$ | ||
| 18 | 31 | ||
| 19 | @@-<article> | 32 | @@-<article> |
| 20 | 33 | ||
| @@ -55,7 +68,7 @@ | |||
| 55 | 68 | ||
| 56 | const char *progname = "negate"; | 69 | const char *progname = "negate"; |
| 57 | const char *revision = "$Revision$"; | 70 | const char *revision = "$Revision$"; |
| 58 | const char *copyright = "2002-2004"; | 71 | const char *copyright = "2002-2006"; |
| 59 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | 72 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; |
| 60 | 73 | ||
| 61 | #define DEFAULT_TIMEOUT 9 | 74 | #define DEFAULT_TIMEOUT 9 |
| @@ -239,8 +252,9 @@ print_help (void) | |||
| 239 | 252 | ||
| 240 | printf (COPYRIGHT, copyright, email); | 253 | printf (COPYRIGHT, copyright, email); |
| 241 | 254 | ||
| 242 | printf (_("\ | 255 | printf ("%s\n", _("Negates the status of a plugin (returns OK for CRITICAL, and vice-versa).")); |
| 243 | Negates the status of a plugin (returns OK for CRITICAL, and vice-versa).\n\n")); | 256 | |
| 257 | printf ("\n\n"); | ||
| 244 | 258 | ||
| 245 | print_usage (); | 259 | print_usage (); |
| 246 | 260 | ||
| @@ -248,20 +262,20 @@ Negates the status of a plugin (returns OK for CRITICAL, and vice-versa).\n\n")) | |||
| 248 | 262 | ||
| 249 | printf (_(UT_TIMEOUT), DEFAULT_TIMEOUT); | 263 | printf (_(UT_TIMEOUT), DEFAULT_TIMEOUT); |
| 250 | 264 | ||
| 251 | printf (_("\ | 265 | printf (" %s\n", _("[keep timeout than the plugin timeout to retain CRITICAL status]")); |
| 252 | [keep timeout than the plugin timeout to retain CRITICAL status]\n")); | 266 | printf ("\n"); |
| 253 | 267 | printf ("%s\n", _("Examples:")); | |
| 254 | printf (_("\ | 268 | printf (" %s\n", "negate \"/usr/local/nagios/libexec/check_ping -H host\""); |
| 255 | negate \"/usr/local/nagios/libexec/check_ping -H host\"\n\ | 269 | printf (" %s\n", _("Run check_ping and invert result. Must use full path to plugin")); |
| 256 | Run check_ping and invert result. Must use full path to plugin\n\ | 270 | printf (" %s\n", "negate \"/usr/local/nagios/libexec/check_procs -a 'vi negate.c'\""); |
| 257 | negate \"/usr/local/nagios/libexec/check_procs -a 'vi negate.c'\"\n\ | 271 | printf (" %s\n", _("Use single quotes if you need to retain spaces")); |
| 258 | Use single quotes if you need to retain spaces\n")); | 272 | printf (_(UT_VERBOSE)); |
| 259 | 273 | printf ("\n"); | |
| 260 | printf (_("\ | 274 | printf ("%s\n", _("Notes:")); |
| 261 | This plugin is a wrapper to take the output of another plugin and invert it.\n\ | 275 | printf ("%s\n", _("This plugin is a wrapper to take the output of another plugin and invert it.")); |
| 262 | If the wrapped plugin returns STATE_OK, the wrapper will return STATE_CRITICAL.\n\ | 276 | printf ("%s\n", _("If the wrapped plugin returns STATE_OK, the wrapper will return STATE_CRITICAL.")); |
| 263 | If the wrapped plugin returns STATE_CRITICAL, the wrapper will return STATE_OK.\n\ | 277 | printf ("%s\n", _("If the wrapped plugin returns STATE_CRITICAL, the wrapper will return STATE_OK.")); |
| 264 | Otherwise, the output state of the wrapped plugin is unchanged.\n")); | 278 | printf ("%s\n", _("Otherwise, the output state of the wrapped plugin is unchanged.")); |
| 265 | 279 | ||
| 266 | printf (_(UT_SUPPORT)); | 280 | printf (_(UT_SUPPORT)); |
| 267 | } | 281 | } |
| @@ -271,5 +285,6 @@ Otherwise, the output state of the wrapped plugin is unchanged.\n")); | |||
| 271 | void | 285 | void |
| 272 | print_usage (void) | 286 | print_usage (void) |
| 273 | { | 287 | { |
| 274 | printf ("Usage: %s [-t timeout] <definition of wrapped plugin>\n",progname); | 288 | printf (_("Usage:")); |
| 289 | printf ("%s [-t timeout] <definition of wrapped plugin>\n",progname); | ||
| 275 | } | 290 | } |
diff --git a/plugins/netutils.c b/plugins/netutils.c index b4c3944b..a3a241d2 100644 --- a/plugins/netutils.c +++ b/plugins/netutils.c | |||
| @@ -76,7 +76,7 @@ process_tcp_request2 (const char *server_address, int server_port, | |||
| 76 | 76 | ||
| 77 | send_result = send (sd, send_buffer, strlen (send_buffer), 0); | 77 | send_result = send (sd, send_buffer, strlen (send_buffer), 0); |
| 78 | if (send_result<0 || (size_t)send_result!=strlen(send_buffer)) { | 78 | if (send_result<0 || (size_t)send_result!=strlen(send_buffer)) { |
| 79 | printf (_("Send failed\n")); | 79 | printf ("%s\n", _("Send failed")); |
| 80 | result = STATE_WARNING; | 80 | result = STATE_WARNING; |
| 81 | } | 81 | } |
| 82 | 82 | ||
| @@ -93,7 +93,7 @@ process_tcp_request2 (const char *server_address, int server_port, | |||
| 93 | if (!FD_ISSET (sd, &readfds)) { /* it hasn't */ | 93 | if (!FD_ISSET (sd, &readfds)) { /* it hasn't */ |
| 94 | if (!recv_length) { | 94 | if (!recv_length) { |
| 95 | strcpy (recv_buffer, ""); | 95 | strcpy (recv_buffer, ""); |
| 96 | printf (_("No data was received from host!\n")); | 96 | printf ("%s\n", _("No data was received from host!")); |
| 97 | result = STATE_WARNING; | 97 | result = STATE_WARNING; |
| 98 | } | 98 | } |
| 99 | else { /* this one failed, but previous ones worked */ | 99 | else { /* this one failed, but previous ones worked */ |
| @@ -190,7 +190,7 @@ np_net_connect (const char *host_name, int port, int *sd, int proto) | |||
| 190 | *sd = socket (r->ai_family, socktype, r->ai_protocol); | 190 | *sd = socket (r->ai_family, socktype, r->ai_protocol); |
| 191 | 191 | ||
| 192 | if (*sd < 0) { | 192 | if (*sd < 0) { |
| 193 | printf (_("Socket creation failed\n")); | 193 | printf ("%s\n", _("Socket creation failed")); |
| 194 | freeaddrinfo (r); | 194 | freeaddrinfo (r); |
| 195 | return STATE_UNKNOWN; | 195 | return STATE_UNKNOWN; |
| 196 | } | 196 | } |
| @@ -267,7 +267,7 @@ send_request (int sd, int proto, const char *send_buffer, char *recv_buffer, int | |||
| 267 | 267 | ||
| 268 | send_result = send (sd, send_buffer, strlen (send_buffer), 0); | 268 | send_result = send (sd, send_buffer, strlen (send_buffer), 0); |
| 269 | if (send_result<0 || (size_t)send_result!=strlen(send_buffer)) { | 269 | if (send_result<0 || (size_t)send_result!=strlen(send_buffer)) { |
| 270 | printf (_("Send failed\n")); | 270 | printf ("%s\n", _("Send failed")); |
| 271 | result = STATE_WARNING; | 271 | result = STATE_WARNING; |
| 272 | } | 272 | } |
| 273 | 273 | ||
| @@ -282,7 +282,7 @@ send_request (int sd, int proto, const char *send_buffer, char *recv_buffer, int | |||
| 282 | /* make sure some data has arrived */ | 282 | /* make sure some data has arrived */ |
| 283 | if (!FD_ISSET (sd, &readfds)) { | 283 | if (!FD_ISSET (sd, &readfds)) { |
| 284 | strcpy (recv_buffer, ""); | 284 | strcpy (recv_buffer, ""); |
| 285 | printf (_("No data was received from host!\n")); | 285 | printf ("%s\n", _("No data was received from host!")); |
| 286 | result = STATE_WARNING; | 286 | result = STATE_WARNING; |
| 287 | } | 287 | } |
| 288 | 288 | ||
| @@ -291,7 +291,7 @@ send_request (int sd, int proto, const char *send_buffer, char *recv_buffer, int | |||
| 291 | if (recv_result == -1) { | 291 | if (recv_result == -1) { |
| 292 | strcpy (recv_buffer, ""); | 292 | strcpy (recv_buffer, ""); |
| 293 | if (proto != IPPROTO_TCP) | 293 | if (proto != IPPROTO_TCP) |
| 294 | printf (_("Receive failed\n")); | 294 | printf ("%s\n", _("Receive failed")); |
| 295 | result = STATE_WARNING; | 295 | result = STATE_WARNING; |
| 296 | } | 296 | } |
| 297 | else | 297 | else |
diff --git a/plugins/popen.c b/plugins/popen.c index 5da12a02..80a7119b 100644 --- a/plugins/popen.c +++ b/plugins/popen.c | |||
| @@ -1,13 +1,21 @@ | |||
| 1 | /****************************************************************************** | 1 | /**************************************************************************** |
| 2 | * popen.c | 2 | * |
| 3 | * Nagios plugins popen | ||
| 4 | * | ||
| 5 | * License: GPL | ||
| 6 | * Copyright (c) 2005 nagios-plugins team | ||
| 7 | * | ||
| 8 | * Last Modified: $Date$ | ||
| 9 | * | ||
| 10 | * Description: | ||
| 3 | * | 11 | * |
| 4 | * A safe alternative to popen | 12 | * A safe alternative to popen |
| 5 | * | 13 | * |
| 6 | * Provides spopen and spclose | 14 | * Provides spopen and spclose |
| 7 | 15 | * | |
| 8 | FILE * spopen(const char *); | 16 | * FILE * spopen(const char *); |
| 9 | int spclose(FILE *); | 17 | * int spclose(FILE *); |
| 10 | 18 | * | |
| 11 | * | 19 | * |
| 12 | * Code taken with liitle modification from "Advanced Programming for the Unix | 20 | * Code taken with liitle modification from "Advanced Programming for the Unix |
| 13 | * Environment" by W. Richard Stevens | 21 | * Environment" by W. Richard Stevens |
| @@ -16,6 +24,22 @@ int spclose(FILE *); | |||
| 16 | * path passed to the exec'd program are esstially empty. (popen create a shell | 24 | * path passed to the exec'd program are esstially empty. (popen create a shell |
| 17 | * and passes the environment to it). | 25 | * and passes the environment to it). |
| 18 | * | 26 | * |
| 27 | * License Information: | ||
| 28 | * | ||
| 29 | * This program is free software; you can redistribute it and/or modify | ||
| 30 | * it under the terms of the GNU General Public License as published by | ||
| 31 | * the Free Software Foundation; either version 2 of the License, or | ||
| 32 | * (at your option) any later version. | ||
| 33 | * | ||
| 34 | * This program is distributed in the hope that it will be useful, | ||
| 35 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 36 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 37 | * GNU General Public License for more details. | ||
| 38 | * | ||
| 39 | * You should have received a copy of the GNU General Public License | ||
| 40 | * along with this program; if not, write to the Free Software | ||
| 41 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 42 | * | ||
| 19 | * $Id$ | 43 | * $Id$ |
| 20 | * | 44 | * |
| 21 | ******************************************************************************/ | 45 | ******************************************************************************/ |
| @@ -121,7 +145,7 @@ spopen (const char *cmdstring) | |||
| 121 | argv = malloc (sizeof(char*)*argc); | 145 | argv = malloc (sizeof(char*)*argc); |
| 122 | 146 | ||
| 123 | if (argv == NULL) { | 147 | if (argv == NULL) { |
| 124 | printf (_("Could not malloc argv array in popen()\n")); | 148 | printf ("%s\n", _("Could not malloc argv array in popen()")); |
| 125 | return NULL; | 149 | return NULL; |
| 126 | } | 150 | } |
| 127 | 151 | ||
| @@ -131,7 +155,7 @@ spopen (const char *cmdstring) | |||
| 131 | str += strspn (str, " \t\r\n"); /* trim any leading whitespace */ | 155 | str += strspn (str, " \t\r\n"); /* trim any leading whitespace */ |
| 132 | 156 | ||
| 133 | if (i >= argc - 2) { | 157 | if (i >= argc - 2) { |
| 134 | printf (_("CRITICAL - You need more args!!!\n")); | 158 | printf ("%s\n",_("CRITICAL - You need more args!!!")); |
| 135 | return (NULL); | 159 | return (NULL); |
| 136 | } | 160 | } |
| 137 | 161 | ||
| @@ -278,7 +302,7 @@ popen_timeout_alarm_handler (int signo) | |||
| 278 | printf (_("CRITICAL - Plugin timed out after %d seconds\n"), | 302 | printf (_("CRITICAL - Plugin timed out after %d seconds\n"), |
| 279 | timeout_interval); | 303 | timeout_interval); |
| 280 | } else { | 304 | } else { |
| 281 | printf (_("CRITICAL - popen timeout received, but no child process\n")); | 305 | printf ("%s\n", _("CRITICAL - popen timeout received, but no child process")); |
| 282 | } | 306 | } |
| 283 | exit (STATE_CRITICAL); | 307 | exit (STATE_CRITICAL); |
| 284 | } | 308 | } |
diff --git a/plugins/runcmd.c b/plugins/runcmd.c index bc4ee08d..af12d224 100644 --- a/plugins/runcmd.c +++ b/plugins/runcmd.c | |||
| @@ -1,6 +1,13 @@ | |||
| 1 | /* | 1 | /**************************************************************************** |
| 2 | * Nagios run command utilities | ||
| 3 | * | ||
| 4 | * License: GPL | ||
| 5 | * Copyright (c) 2005 nagios-plugins team | ||
| 6 | * | ||
| 2 | * $Id$ | 7 | * $Id$ |
| 3 | * | 8 | * |
| 9 | * Description : | ||
| 10 | * | ||
| 4 | * A simple interface to executing programs from other programs, using an | 11 | * A simple interface to executing programs from other programs, using an |
| 5 | * optimized and safe popen()-like implementation. It is considered safe | 12 | * optimized and safe popen()-like implementation. It is considered safe |
| 6 | * in that no shell needs to be spawned and the environment passed to the | 13 | * in that no shell needs to be spawned and the environment passed to the |
| @@ -14,6 +21,21 @@ | |||
| 14 | * function which isn't is np_runcmd_init() which it doesn't make sense to | 21 | * function which isn't is np_runcmd_init() which it doesn't make sense to |
| 15 | * call twice anyway, so the api as a whole should be considered async-safe. | 22 | * call twice anyway, so the api as a whole should be considered async-safe. |
| 16 | * | 23 | * |
| 24 | * License Information: | ||
| 25 | * | ||
| 26 | * This program is free software; you can redistribute it and/or modify | ||
| 27 | * it under the terms of the GNU General Public License as published by | ||
| 28 | * the Free Software Foundation; either version 2 of the License, or | ||
| 29 | * (at your option) any later version. | ||
| 30 | * | ||
| 31 | * This program is distributed in the hope that it will be useful, | ||
| 32 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 33 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 34 | * GNU General Public License for more details. | ||
| 35 | * | ||
| 36 | * You should have received a copy of the GNU General Public License | ||
| 37 | * along with this program; if not, write to the Free Software | ||
| 38 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 17 | */ | 39 | */ |
| 18 | 40 | ||
| 19 | #define NAGIOSPLUG_API_C 1 | 41 | #define NAGIOSPLUG_API_C 1 |
| @@ -137,7 +159,7 @@ np_runcmd_open(const char *cmdstring, int *pfd, int *pfderr) | |||
| 137 | argv = calloc(sizeof(char *), argc); | 159 | argv = calloc(sizeof(char *), argc); |
| 138 | 160 | ||
| 139 | if (argv == NULL) { | 161 | if (argv == NULL) { |
| 140 | printf (_("Could not malloc argv array in popen()\n")); | 162 | printf ("%s\n", _("Could not malloc argv array in popen()")); |
| 141 | return -1; | 163 | return -1; |
| 142 | } | 164 | } |
| 143 | 165 | ||
diff --git a/plugins/sslutils.c b/plugins/sslutils.c index 66c72995..09d58b0f 100644 --- a/plugins/sslutils.c +++ b/plugins/sslutils.c | |||
| @@ -47,7 +47,7 @@ int np_net_ssl_init (int sd){ | |||
| 47 | SSL_load_error_strings (); | 47 | SSL_load_error_strings (); |
| 48 | OpenSSL_add_all_algorithms(); | 48 | OpenSSL_add_all_algorithms(); |
| 49 | if ((c = SSL_CTX_new (m)) == NULL) { | 49 | if ((c = SSL_CTX_new (m)) == NULL) { |
| 50 | printf (_("CRITICAL - Cannot create SSL context.\n")); | 50 | printf ("%s\n", _("CRITICAL - Cannot create SSL context.")); |
| 51 | return STATE_CRITICAL; | 51 | return STATE_CRITICAL; |
| 52 | } | 52 | } |
| 53 | if ((s = SSL_new (c)) != NULL){ | 53 | if ((s = SSL_new (c)) != NULL){ |
| @@ -55,13 +55,13 @@ int np_net_ssl_init (int sd){ | |||
| 55 | if (SSL_connect(s) == 1){ | 55 | if (SSL_connect(s) == 1){ |
| 56 | return OK; | 56 | return OK; |
| 57 | } else { | 57 | } else { |
| 58 | printf (_("CRITICAL - Cannot make SSL connection ")); | 58 | printf ("%s\n", _("CRITICAL - Cannot make SSL connection ")); |
| 59 | # ifdef USE_OPENSSL /* XXX look into ERR_error_string */ | 59 | # ifdef USE_OPENSSL /* XXX look into ERR_error_string */ |
| 60 | ERR_print_errors_fp (stdout); | 60 | ERR_print_errors_fp (stdout); |
| 61 | # endif /* USE_OPENSSL */ | 61 | # endif /* USE_OPENSSL */ |
| 62 | } | 62 | } |
| 63 | } else { | 63 | } else { |
| 64 | printf (_("CRITICAL - Cannot initiate SSL handshake.\n")); | 64 | printf ("%s\n", _("CRITICAL - Cannot initiate SSL handshake.")); |
| 65 | } | 65 | } |
| 66 | return STATE_CRITICAL; | 66 | return STATE_CRITICAL; |
| 67 | } | 67 | } |
| @@ -93,7 +93,7 @@ int np_net_ssl_check_cert(int days_till_exp){ | |||
| 93 | 93 | ||
| 94 | certificate=SSL_get_peer_certificate(s); | 94 | certificate=SSL_get_peer_certificate(s); |
| 95 | if(! certificate){ | 95 | if(! certificate){ |
| 96 | printf (_("CRITICAL - Cannot retrieve server certificate.\n")); | 96 | printf ("%s\n",_("CRITICAL - Cannot retrieve server certificate.")); |
| 97 | return STATE_CRITICAL; | 97 | return STATE_CRITICAL; |
| 98 | } | 98 | } |
| 99 | 99 | ||
| @@ -103,7 +103,7 @@ int np_net_ssl_check_cert(int days_till_exp){ | |||
| 103 | /* Generate tm structure to process timestamp */ | 103 | /* Generate tm structure to process timestamp */ |
| 104 | if (tm->type == V_ASN1_UTCTIME) { | 104 | if (tm->type == V_ASN1_UTCTIME) { |
| 105 | if (tm->length < 10) { | 105 | if (tm->length < 10) { |
| 106 | printf (_("CRITICAL - Wrong time format in certificate.\n")); | 106 | printf ("%s\n", _("CRITICAL - Wrong time format in certificate.")); |
| 107 | return STATE_CRITICAL; | 107 | return STATE_CRITICAL; |
| 108 | } else { | 108 | } else { |
| 109 | stamp.tm_year = (tm->data[0] - '0') * 10 + (tm->data[1] - '0'); | 109 | stamp.tm_year = (tm->data[0] - '0') * 10 + (tm->data[1] - '0'); |
| @@ -113,7 +113,7 @@ int np_net_ssl_check_cert(int days_till_exp){ | |||
| 113 | } | 113 | } |
| 114 | } else { | 114 | } else { |
| 115 | if (tm->length < 12) { | 115 | if (tm->length < 12) { |
| 116 | printf (_("CRITICAL - Wrong time format in certificate.\n")); | 116 | printf ("%s\n", _("CRITICAL - Wrong time format in certificate.")); |
| 117 | return STATE_CRITICAL; | 117 | return STATE_CRITICAL; |
| 118 | } else { | 118 | } else { |
| 119 | stamp.tm_year = | 119 | stamp.tm_year = |
| @@ -155,7 +155,7 @@ int np_net_ssl_check_cert(int days_till_exp){ | |||
| 155 | X509_free (certificate); | 155 | X509_free (certificate); |
| 156 | return STATE_OK; | 156 | return STATE_OK; |
| 157 | # else /* ifndef USE_OPENSSL */ | 157 | # else /* ifndef USE_OPENSSL */ |
| 158 | printf (_("WARNING - Plugin does not support checking certificates.\n")); | 158 | printf ("%s\n", _("WARNING - Plugin does not support checking certificates.")); |
| 159 | return STATE_WARNING; | 159 | return STATE_WARNING; |
| 160 | # endif /* USE_OPENSSL */ | 160 | # endif /* USE_OPENSSL */ |
| 161 | } | 161 | } |
diff --git a/plugins/urlize.c b/plugins/urlize.c index 13ab14ee..d4d00dd6 100644 --- a/plugins/urlize.c +++ b/plugins/urlize.c | |||
| @@ -20,7 +20,7 @@ | |||
| 20 | 20 | ||
| 21 | const char *progname = "urlize"; | 21 | const char *progname = "urlize"; |
| 22 | const char *revision = "$Revision$"; | 22 | const char *revision = "$Revision$"; |
| 23 | const char *copyright = "2000-2004"; | 23 | const char *copyright = "2000-2006"; |
| 24 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | 24 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; |
| 25 | 25 | ||
| 26 | #include "common.h" | 26 | #include "common.h" |
| @@ -149,27 +149,25 @@ print_help (void) | |||
| 149 | printf ("Copyright (c) 2000 Karl DeBisschop <kdebisschop@users.sourceforge.net>\n"); | 149 | printf ("Copyright (c) 2000 Karl DeBisschop <kdebisschop@users.sourceforge.net>\n"); |
| 150 | printf (COPYRIGHT, copyright, email); | 150 | printf (COPYRIGHT, copyright, email); |
| 151 | 151 | ||
| 152 | printf (_("\n\ | 152 | printf ("%s\n", _("This plugin wraps the text output of another command (plugin)")); |
| 153 | This plugin wraps the text output of another command (plugin) in HTML\n\ | 153 | printf ("%s\n", _("in HTML <A> tags, thus displaying the plugin output in as a clickable link in")); |
| 154 | <A> tags, thus displaying the plugin output in as a clickable link in\n\ | 154 | printf ("%s\n", _("the Nagios status screen. The return status is the same as the invoked plugin.")); |
| 155 | the Nagios status screen. The return status is the same as the invoked\n\ | 155 | |
| 156 | plugin.\n\n")); | 156 | printf ("\n\n"); |
| 157 | 157 | ||
| 158 | print_usage (); | 158 | print_usage (); |
| 159 | 159 | ||
| 160 | printf (_("\n\ | 160 | printf (_(UT_HELP_VRSN)); |
| 161 | Pay close attention to quoting to ensure that the shell passes the expected\n\ | 161 | |
| 162 | data to the plugin. For example, in:\n\ | 162 | printf ("\n"); |
| 163 | \n\ | 163 | printf ("%s\n", _("Examples:")); |
| 164 | urlize http://example.com/ check_http -H example.com -r 'two words'\n\ | 164 | printf ("%s\n", _("Pay close attention to quoting to ensure that the shell passes the expected")); |
| 165 | \n\ | 165 | printf ("%s\n\n", _("data to the plugin. For example, in:")); |
| 166 | the shell will remove the single quotes and urlize will see:\n\ | 166 | printf (" %s\n\n", _("urlize http://example.com/ check_http -H example.com -r 'two words'")); |
| 167 | \n\ | 167 | printf (" %s\n", _("the shell will remove the single quotes and urlize will see:")); |
| 168 | urlize http://example.com/ check_http -H example.com -r two words\n\ | 168 | printf (" %s\n\n", _("urlize http://example.com/ check_http -H example.com -r two words")); |
| 169 | \n\ | 169 | printf (" %s\n\n", _("You probably want:")); |
| 170 | You probably want:\n\ | 170 | printf (" %s\n", _("urlize http://example.com/ \"check_http -H example.com -r 'two words'\"")); |
| 171 | \n\ | ||
| 172 | urlize http://example.com/ \"check_http -H example.com -r 'two words'\"\n")); | ||
| 173 | 171 | ||
| 174 | printf (_(UT_SUPPORT)); | 172 | printf (_(UT_SUPPORT)); |
| 175 | } | 173 | } |
| @@ -179,5 +177,6 @@ You probably want:\n\ | |||
| 179 | void | 177 | void |
| 180 | print_usage (void) | 178 | print_usage (void) |
| 181 | { | 179 | { |
| 182 | printf ("Usage:\n %s <url> <plugin> <arg1> ... <argN>\n", progname); | 180 | printf (_("Usage:")); |
| 181 | printf ("%s <url> <plugin> <arg1> ... <argN>\n", progname); | ||
| 183 | } | 182 | } |
diff --git a/plugins/utils.c b/plugins/utils.c index f2593a16..a455f225 100644 --- a/plugins/utils.c +++ b/plugins/utils.c | |||
| @@ -360,7 +360,7 @@ set_thresholds(thresholds **my_thresholds, char *warn_string, char *critical_str | |||
| 360 | if (_set_thresholds(my_thresholds, warn_string, critical_string) == 0) { | 360 | if (_set_thresholds(my_thresholds, warn_string, critical_string) == 0) { |
| 361 | return; | 361 | return; |
| 362 | } else { | 362 | } else { |
| 363 | usage("Range format incorrect"); | 363 | usage(_("Range format incorrect")); |
| 364 | } | 364 | } |
| 365 | } | 365 | } |
| 366 | 366 | ||
