From f9394308c9c372bcf419a311c61ba420247ae613 Mon Sep 17 00:00:00 2001 From: Benoit Mortier Date: Sun, 18 Jun 2006 19:36:48 +0000 Subject: [PATCH] updating help and usage and license git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1434 f882894a-f735-0410-b71e-b25c423dba1c --- plugins/check_disk.c | 53 ++++++++++------- plugins/check_time.c | 82 ++++++++++++++----------- plugins/check_udp.c | 78 ++++++++++++++---------- plugins/check_ups.c | 129 ++++++++++++++++++++-------------------- plugins/check_users.c | 72 +++++++++++++--------- plugins/gethostbyname.c | 55 ++++++++++------- plugins/gethostbyname.h | 54 ++++++++++------- plugins/negate.c | 83 +++++++++++++++----------- plugins/netutils.c | 12 ++-- plugins/popen.c | 42 ++++++++++--- plugins/runcmd.c | 26 +++++++- plugins/sslutils.c | 14 ++--- plugins/urlize.c | 39 ++++++------ plugins/utils.c | 2 +- 14 files changed, 439 insertions(+), 302 deletions(-) diff --git a/plugins/check_disk.c b/plugins/check_disk.c index 001800b..8a824c1 100644 --- a/plugins/check_disk.c +++ b/plugins/check_disk.c @@ -1,27 +1,40 @@ /****************************************************************************** - - The Nagios Plugins are free software; you can redistribute them - and/or modify them under the terms of the GNU General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - $Id$ - +* +* Nagios check_disk plugin +* +* License: GPL +* Copyright (c) 1999-2006 nagios-plugins team +* +* Last Modified: $Date$ +* +* Description: +* +* This file contains the check_disk plugin +* +* License Information: +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +* +* $Id$ +* *****************************************************************************/ const char *progname = "check_disk"; const char *program_name = "check_disk"; /* Required for coreutils libs */ const char *revision = "$Revision$"; -const char *copyright = "1999-2005"; +const char *copyright = "1999-2006"; const char *email = "nagiosplug-devel@lists.sourceforge.net"; /* @@ -704,8 +717,8 @@ print_help (void) printf ("Copyright (c) 1999 Ethan Galstad \n"); printf (COPYRIGHT, copyright, email); - printf (_("This plugin checks the amount of used disk space on a mounted file system")); - printf (_("and generates an alert if free space is less than one of the threshold values")); + printf ("%s\n", _("This plugin checks the amount of used disk space on a mounted file system")); + printf ("%s\n", _("and generates an alert if free space is less than one of the threshold values")); printf ("\n\n"); diff --git a/plugins/check_time.c b/plugins/check_time.c index ff94d9b..84cdcd5 100644 --- a/plugins/check_time.c +++ b/plugins/check_time.c @@ -1,26 +1,40 @@ /****************************************************************************** - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - $Id$ - +* +* Nagios check_time plugin +* +* License: GPL +* Copyright (c) 1999-2006 nagios-plugins team +* +* Last Modified: $Date$ +* +* Description: +* +* This file contains the check_time plugin +* +* License Information: +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +* +* +* $Id$ +* ******************************************************************************/ const char *progname = "check_time"; const char *revision = "$Revision$"; -const char *copyright = "1999-2004"; +const char *copyright = "1999-2006"; const char *email = "nagiosplug-devel@lists.sourceforge.net"; #include "common.h" @@ -324,7 +338,9 @@ print_help (void) printf ("Copyright (c) 1999 Ethan Galstad\n"); printf (COPYRIGHT, copyright, email); - printf (_("This plugin will check the time on the specified host.\n\n")); + printf ("%s\n", _("This plugin will check the time on the specified host.")); + + printf ("\n\n"); print_usage (); @@ -332,20 +348,18 @@ print_help (void) printf (_(UT_HOST_PORT), 'p', myport); - printf (_("\ - -u, --udp\n\ - Use UDP to connect, not TCP\n\ - -w, --warning-variance=INTEGER\n\ - Time difference (sec.) necessary to result in a warning status\n\ - -c, --critical-variance=INTEGER\n\ - Time difference (sec.) necessary to result in a critical status\n\ - -W, --warning-connect=INTEGER\n\ - Response time (sec.) necessary to result in warning status\n\ - -C, --critical-connect=INTEGER\n\ - Response time (sec.) necessary to result in critical status\n")); + printf (" %s\n", "-u, --udp"); + printf (" %s\n", _("Use UDP to connect, not TCP")); + printf (" %s\n", "-w, --warning-variance=INTEGER"); + printf (" %s\n", _("Time difference (sec.) necessary to result in a warning status")); + printf (" %s\n", "-c, --critical-variance=INTEGER"); + printf (" %s\n", _("Time difference (sec.) necessary to result in a critical status")); + printf (" %s\n", "-W, --warning-connect=INTEGER"); + printf (" %s\n", _("Response time (sec.) necessary to result in warning status")); + printf (" %s\n", "-C, --critical-connect=INTEGER"); + printf (" %s\n", _("Response time (sec.) necessary to result in critical status")); printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT); - printf (_(UT_SUPPORT)); } @@ -354,7 +368,7 @@ print_help (void) void print_usage (void) { - printf ("\ -Usage: %s -H [-p port] [-u] [-w variance] [-c variance]\n\ - [-W connect_time] [-C connect_time] [-t timeout]\n", progname); + printf (_("Usage:")); + printf ("%s -H [-p port] [-u] [-w variance] [-c variance]\n",progname); + printf (" [-W connect_time] [-C connect_time] [-t timeout]\n"); } diff --git a/plugins/check_udp.c b/plugins/check_udp.c index e7d5280..a712871 100644 --- a/plugins/check_udp.c +++ b/plugins/check_udp.c @@ -1,26 +1,39 @@ /****************************************************************************** - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - $Id$ - +* +* Nagios check_udp plugin +* +* License: GPL +* Copyright (c) 1999-2006 nagios-plugins team +* +* Last Modified: $Date$ +* +* Description: +* +* This file contains the check_udp plugin +* +* License Information: +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +* +* $Id$ +* *****************************************************************************/ const char *progname = "check_udp"; const char *revision = "$Revision$"; -const char *copyright = "1999-2004"; +const char *copyright = "1999-2006"; const char *email = "nagiosplug-devel@lists.sourceforge.net"; #include "common.h" @@ -222,8 +235,9 @@ print_help (void) printf ("Copyright (c) 1999 Ethan Galstad\n"); printf (COPYRIGHT, copyright, email); - printf (_("\ - This plugin tests an UDP connection with the specified host.\n\n")); + printf ("%s\n", _("This plugin tests an UDP connection with the specified host.")); + + printf ("\n\n"); print_usage (); @@ -231,11 +245,10 @@ print_help (void) printf (_(UT_HOST_PORT), 'p', "none"); - printf (_("\ - -e, --expect=STRING \n\ - String to expect in first line of server response\n\ - -s, --send=STRING \n\ - String to send to the server when initiating the connection\n")); + printf (" %s\n", "-e, --expect=STRING "); + printf (" %s\n", _("String to expect in first line of server response")); + printf (" %s\n", "-s, --send=STRING "); + printf (" %s\n", _("String to send to the server when initiating the connection")); printf (_(UT_WARN_CRIT)); @@ -243,11 +256,10 @@ print_help (void) printf (_(UT_VERBOSE)); - printf (_("\ -This plugin will attempt to connect to the specified port on the host.\n\ -Successful connects return STATE_OK, refusals and timeouts return\n\ -STATE_CRITICAL, other errors return STATE_UNKNOWN.\n\n")); - + printf ("%s\n", _("This plugin will attempt to connect to the specified port on the host.")); + printf (" %s\n", _("Successful connects return STATE_OK, refusals and timeouts return")); + printf (" %s\n", _("STATE_CRITICAL, other errors return STATE_UNKNOWN.")); + printf(_(UT_SUPPORT)); } @@ -258,7 +270,7 @@ STATE_CRITICAL, other errors return STATE_UNKNOWN.\n\n")); void print_usage (void) { - printf ("\ -Usage: %s -H [-p port] [-w warn_time] [-c crit_time]\n\ - [-e expect] [-s send] [-t to_sec] [-v]\n", progname); + printf (_("Usage:")); + printf ("%s -H [-p port] [-w warn_time] [-c crit_time]\n", progname); + printf (" [-e expect] [-s send] [-t to_sec] [-v]\n"); } diff --git a/plugins/check_ups.c b/plugins/check_ups.c index 786cedc..110ea0a 100644 --- a/plugins/check_ups.c +++ b/plugins/check_ups.c @@ -1,35 +1,42 @@ /****************************************************************************** - - check_ups - - Program: Network UPS Tools plugin for Nagios - License: GPL - Copyright (c) 2000 Tom Shields - 2004 Alain Richard - 2004 Arnaud Quette - - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or (at - your option) any later version. - - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - $Id$ - +* +* Nagios check_ups plugin +* +* License: GPL +* Copyright (c) 2000 Tom Shields +* 2004 Alain Richard +* 2004 Arnaud Quette +* Copyright (c) 2002-2006 nagios-plugins team +* +* Last Modified: $Date$ +* +* Description: +* +* This file contains Network UPS Tools plugin for Nagios +* +* License Information: +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +* +* $Id$ +* ******************************************************************************/ const char *progname = "check_ups"; const char *revision = "$Revision$"; -const char *copyright = "2000-2004"; +const char *copyright = "2000-2006"; const char *email = "nagiosplug-devel@lists.sourceforge.net"; #include "common.h" @@ -338,7 +345,7 @@ determine_status (void) res=get_ups_variable ("ups.status", recv_buffer, sizeof (recv_buffer)); if (res == NOSUCHVAR) return OK; if (res != STATE_OK) { - printf (_("Invalid response received from host\n")); + printf ("%s\n", _("Invalid response received from host")); return ERROR; } @@ -398,7 +405,7 @@ get_ups_variable (const char *varname, char *buf, size_t buflen) if (process_tcp_request (server_address, server_port, send_buffer, temp_buffer, sizeof (temp_buffer)) != STATE_OK) { - printf (_("Invalid response received from host\n")); + printf ("%s\n", _("Invalid response received from host")); return ERROR; } @@ -416,7 +423,7 @@ get_ups_variable (const char *varname, char *buf, size_t buflen) } if (strcmp (ptr, "ERR DATA-STALE") == 0) { - printf (_("CRITICAL - UPS data is stale\n")); + printf ("%s\n", _("CRITICAL - UPS data is stale")); return ERROR; } @@ -428,7 +435,7 @@ get_ups_variable (const char *varname, char *buf, size_t buflen) ptr = temp_buffer + strlen (varname) + strlen (ups_name) + 6; len = strlen(ptr); if (len < 2 || ptr[0] != '"' || ptr[len-1] != '"') { - printf (_("Error: unable to parse variable\n")); + printf ("%s\n", _("Error: unable to parse variable")); return ERROR; } strncpy (buf, ptr+1, len - 2); @@ -573,7 +580,7 @@ int validate_arguments (void) { if (! ups_name) { - printf (_("Error : no ups indicated\n")); + printf ("%s\n", _("Error : no ups indicated")); return ERROR; } return OK; @@ -593,9 +600,10 @@ print_help (void) printf ("Copyright (c) 2004 Arnaud Quette \n"); printf (COPYRIGHT, copyright, email); - printf (_("This plugin tests the UPS service on the specified host.\n\ -Network UPS Tools from www.networkupstools.org must be running for this\n\ -plugin to work.\n\n")); + printf ("%s\n", _("This plugin tests the UPS service on the specified host.Network UPS Tools ")); + printf ("%s\n", _("from www.networkupstools.org must be running for thisplugin to work.")); + + printf ("\n\n"); print_usage (); @@ -603,13 +611,10 @@ plugin to work.\n\n")); printf (_(UT_HOST_PORT), 'p', myport); - printf (_("\ - -u, --ups=STRING\n\ - Name of UPS\n")); - - printf (_("\ - -T, --temperature\n\ - Output of temperatures in Celsius\n")); + printf (" %s\n", "-u, --ups=STRING"); + printf (" %s\n", _("Name of UPS")); + printf (" %s\n", "-T, --temperature"); + printf (" %s\n", _("Output of temperatures in Celsius")); printf (_(UT_WARN_CRIT)); @@ -617,24 +622,23 @@ plugin to work.\n\n")); printf (_(UT_VERBOSE)); - printf (_("\ -This plugin attempts to determine the status of a UPS (Uninterruptible Power\n\ -Supply) on a local or remote host. If the UPS is online or calibrating, the\n\ -plugin will return an OK state. If the battery is on it will return a WARNING\n\ -state. If the UPS is off or has a low battery the plugin will return a CRITICAL\n\ -state.\n\n")); - - printf (_("\ -You may also specify a variable to check [such as temperature, utility voltage,\n\ -battery load, etc.] as well as warning and critical thresholds for the value of\n\ -that variable. If the remote host has multiple UPS that are being monitored you\n\ -will have to use the [ups] option to specify which UPS to check.\n\n")); - - printf (_("Notes:\n\n\ -This plugin requires that the UPSD daemon distributed with Russel Kroll's\n\ -Smart UPS Tools be installed on the remote host. If you do not have the\n\ -package installed on your system, you can download it from\n\ -http://www.networkupstools.org\n\n")); + printf ("\n"); + printf ("%s\n", _("Notes:")); + + printf ("%s\n", _("This plugin attempts to determine the status of a UPS (Uninterruptible Power")); + printf ("%s\n", _("Supply) on a local or remote host. If the UPS is online or calibrating, the")); + printf ("%s\n", _("plugin will return an OK state. If the battery is on it will return a WARNING")); + printf ("%s\n", _("state.If the UPS is off or has a low battery the plugin will return a CRITICAL")); + printf ("%s\n\n", _("state.")); + + printf ("%s\n", _("You may also specify a variable to check [such as temperature, utility voltage,")); + printf ("%s\n", _("battery load, etc.] as well as warning and critical thresholds for the value of")); + printf ("%s\n", _("that variable. If the remote host has multiple UPS that are being monitored you")); + printf ("%s\n", _("will have to use the [ups] option to specify which UPS to check.")); + + printf ("%s\n", _("This plugin requires that the UPSD daemon distributed with Russel Kroll's")); + printf ("%s\n", _("Smart UPS Tools be installed on the remote host. If you do not have the")); + printf ("%s\n", _("package installed on your system, you can download it from http://www.networkupstools.org")); printf (_(UT_SUPPORT)); } @@ -643,7 +647,6 @@ http://www.networkupstools.org\n\n")); void print_usage (void) { - printf ("\ -Usage: %s -H host -u ups [-p port] [-v variable]\n\ - [-wv warn_value] [-cv crit_value] [-to to_sec] [-T]\n", progname); + printf (_("Usage:")); + printf ("%s -H host -u ups [-p port] [-v variable] [-w warn_value] [-c crit_value] [-to to_sec] [-T]\n", progname); } diff --git a/plugins/check_users.c b/plugins/check_users.c index 25d04ed..34d4775 100644 --- a/plugins/check_users.c +++ b/plugins/check_users.c @@ -1,26 +1,39 @@ -/***************************************************************************** - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - $Id$ - +/****************************************************************************** +* +* Nagios check_users plugin +* +* License: GPL +* Copyright (c) 2002-2006 nagios-plugins team +* +* Last Modified: $Date$ +* +* Description: +* +* This file contains the check_users plugin +* +* License Information: +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +* +* $Id$ +* *****************************************************************************/ const char *progname = "check_users"; const char *revision = "$Revision$"; -const char *copyright = "2000-2004"; +const char *copyright = "2000-2006"; const char *email = "nagiosplug-devel@lists.sourceforge.net"; #include "common.h" @@ -98,7 +111,7 @@ main (int argc, char **argv) result = STATE_OK; if (result == STATE_UNKNOWN) - printf (_("Unable to read output\n")); + printf ("%s\n", _("Unable to read output")); else { asprintf(&perf, "%s", perfdata ("users", users, "", TRUE, wusers, @@ -190,19 +203,19 @@ print_help (void) printf ("Copyright (c) 1999 Ethan Galstad\n"); printf (COPYRIGHT, copyright, email); - printf (_("\ -This plugin checks the number of users currently logged in on the local\n\ -system and generates an error if the number exceeds the thresholds specified.\n")); + printf ("%s\n", _("This plugin checks the number of users currently logged in on the local")); + printf ("%s\n", _("system and generates an error if the number exceeds the thresholds specified.")); + + printf ("\n\n"); print_usage (); printf (_(UT_HELP_VRSN)); - printf (_("\ - -w, --warning=INTEGER\n\ - Set WARNING status if more than INTEGER users are logged in\n\ - -c, --critical=INTEGER\n\ - Set CRITICAL status if more than INTEGER users are logged in\n")); + printf (" %s\n", "-w, --warning=INTEGER"); + printf (" %s\n", _("Set WARNING status if more than INTEGER users are logged in")); + printf (" %s\n", "-c, --critical=INTEGER"); + printf (" %s\n", _("Set CRITICAL status if more than INTEGER users are logged in")); printf (_(UT_SUPPORT)); } @@ -211,5 +224,6 @@ system and generates an error if the number exceeds the thresholds specified.\n" void print_usage (void) { - printf ("Usage: %s -w -c \n", progname); + printf (_("Usage:")); + printf ("%s -w -c \n", progname); } diff --git a/plugins/gethostbyname.c b/plugins/gethostbyname.c index d1b768b..c8f39ed 100644 --- a/plugins/gethostbyname.c +++ b/plugins/gethostbyname.c @@ -1,25 +1,36 @@ -/* - * This file is a ghastly hack because nobody can agree on - * gethostbyname_r()'s prototype. - * - * Copyright (C) 2001,2002 Brian Stafford - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * $Id$ - */ +/****************************************************************************** +* +* Nagios gethostbyname_r()'s prototype. +* +* License: GPL +* Copyright (C) 2001,2002 Brian Stafford +* +* Last Modified: $Date$ +* +* Description: +* +* This file is a ghastly hack because nobody can agree on +* gethostbyname_r()'s prototype. +* +* License Information: +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +* +* $Id$ +* +*****************************************************************************/ #ifdef HAVE_CONFIG_H #include diff --git a/plugins/gethostbyname.h b/plugins/gethostbyname.h index e420837..d95ab26 100644 --- a/plugins/gethostbyname.h +++ b/plugins/gethostbyname.h @@ -1,25 +1,35 @@ -/* - * This file is a ghastly hack because nobody can agree on - * gethostbyname_r()'s prototype. - * - * Copyright (C) 2001,2002 Brian Stafford - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * $Id$ - */ +/****************************************************************************** +* +* Nagios gethostbyname_r()'s prototype. +* +* License: GPL +* Copyright (C) 2001,2002 Brian Stafford +* +* Last Modified: $Date$ +* +* Description: +* +* This file is a ghastly hack because nobody can agree on +* gethostbyname_r()'s prototype. +* +* License Information: +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +* +* $Id$ +*****************************************************************************/ /************************************************************************* Usage: diff --git a/plugins/negate.c b/plugins/negate.c index d08c3a3..76bb6bb 100644 --- a/plugins/negate.c +++ b/plugins/negate.c @@ -1,20 +1,33 @@ /****************************************************************************** - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - $Id$ +* +* Nagios negate plugin +* +* License: GPL +* Copyright (c) 2002-2006 nagios-plugins team +* +* Last Modified: $Date$ +* +* Description: +* +* This file contains the negate plugin +* +* License Information: +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +* +* $Id$ @@-
@@ -55,7 +68,7 @@ const char *progname = "negate"; const char *revision = "$Revision$"; -const char *copyright = "2002-2004"; +const char *copyright = "2002-2006"; const char *email = "nagiosplug-devel@lists.sourceforge.net"; #define DEFAULT_TIMEOUT 9 @@ -239,8 +252,9 @@ print_help (void) printf (COPYRIGHT, copyright, email); - printf (_("\ -Negates the status of a plugin (returns OK for CRITICAL, and vice-versa).\n\n")); + printf ("%s\n", _("Negates the status of a plugin (returns OK for CRITICAL, and vice-versa).")); + + printf ("\n\n"); print_usage (); @@ -248,20 +262,20 @@ Negates the status of a plugin (returns OK for CRITICAL, and vice-versa).\n\n")) printf (_(UT_TIMEOUT), DEFAULT_TIMEOUT); - printf (_("\ - [keep timeout than the plugin timeout to retain CRITICAL status]\n")); - - printf (_("\ - negate \"/usr/local/nagios/libexec/check_ping -H host\"\n\ - Run check_ping and invert result. Must use full path to plugin\n\ - negate \"/usr/local/nagios/libexec/check_procs -a 'vi negate.c'\"\n\ - Use single quotes if you need to retain spaces\n")); - - printf (_("\ -This plugin is a wrapper to take the output of another plugin and invert it.\n\ -If the wrapped plugin returns STATE_OK, the wrapper will return STATE_CRITICAL.\n\ -If the wrapped plugin returns STATE_CRITICAL, the wrapper will return STATE_OK.\n\ -Otherwise, the output state of the wrapped plugin is unchanged.\n")); + printf (" %s\n", _("[keep timeout than the plugin timeout to retain CRITICAL status]")); + printf ("\n"); + printf ("%s\n", _("Examples:")); + printf (" %s\n", "negate \"/usr/local/nagios/libexec/check_ping -H host\""); + printf (" %s\n", _("Run check_ping and invert result. Must use full path to plugin")); + printf (" %s\n", "negate \"/usr/local/nagios/libexec/check_procs -a 'vi negate.c'\""); + printf (" %s\n", _("Use single quotes if you need to retain spaces")); + printf (_(UT_VERBOSE)); + printf ("\n"); + printf ("%s\n", _("Notes:")); + printf ("%s\n", _("This plugin is a wrapper to take the output of another plugin and invert it.")); + printf ("%s\n", _("If the wrapped plugin returns STATE_OK, the wrapper will return STATE_CRITICAL.")); + printf ("%s\n", _("If the wrapped plugin returns STATE_CRITICAL, the wrapper will return STATE_OK.")); + printf ("%s\n", _("Otherwise, the output state of the wrapped plugin is unchanged.")); printf (_(UT_SUPPORT)); } @@ -271,5 +285,6 @@ Otherwise, the output state of the wrapped plugin is unchanged.\n")); void print_usage (void) { - printf ("Usage: %s [-t timeout] \n",progname); + printf (_("Usage:")); + printf ("%s [-t timeout] \n",progname); } diff --git a/plugins/netutils.c b/plugins/netutils.c index b4c3944..a3a241d 100644 --- a/plugins/netutils.c +++ b/plugins/netutils.c @@ -76,7 +76,7 @@ process_tcp_request2 (const char *server_address, int server_port, send_result = send (sd, send_buffer, strlen (send_buffer), 0); if (send_result<0 || (size_t)send_result!=strlen(send_buffer)) { - printf (_("Send failed\n")); + printf ("%s\n", _("Send failed")); result = STATE_WARNING; } @@ -93,7 +93,7 @@ process_tcp_request2 (const char *server_address, int server_port, if (!FD_ISSET (sd, &readfds)) { /* it hasn't */ if (!recv_length) { strcpy (recv_buffer, ""); - printf (_("No data was received from host!\n")); + printf ("%s\n", _("No data was received from host!")); result = STATE_WARNING; } 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) *sd = socket (r->ai_family, socktype, r->ai_protocol); if (*sd < 0) { - printf (_("Socket creation failed\n")); + printf ("%s\n", _("Socket creation failed")); freeaddrinfo (r); return STATE_UNKNOWN; } @@ -267,7 +267,7 @@ send_request (int sd, int proto, const char *send_buffer, char *recv_buffer, int send_result = send (sd, send_buffer, strlen (send_buffer), 0); if (send_result<0 || (size_t)send_result!=strlen(send_buffer)) { - printf (_("Send failed\n")); + printf ("%s\n", _("Send failed")); result = STATE_WARNING; } @@ -282,7 +282,7 @@ send_request (int sd, int proto, const char *send_buffer, char *recv_buffer, int /* make sure some data has arrived */ if (!FD_ISSET (sd, &readfds)) { strcpy (recv_buffer, ""); - printf (_("No data was received from host!\n")); + printf ("%s\n", _("No data was received from host!")); result = STATE_WARNING; } @@ -291,7 +291,7 @@ send_request (int sd, int proto, const char *send_buffer, char *recv_buffer, int if (recv_result == -1) { strcpy (recv_buffer, ""); if (proto != IPPROTO_TCP) - printf (_("Receive failed\n")); + printf ("%s\n", _("Receive failed")); result = STATE_WARNING; } else diff --git a/plugins/popen.c b/plugins/popen.c index 5da12a0..80a7119 100644 --- a/plugins/popen.c +++ b/plugins/popen.c @@ -1,13 +1,21 @@ -/****************************************************************************** - * popen.c +/**************************************************************************** + * + * Nagios plugins popen + * + * License: GPL + * Copyright (c) 2005 nagios-plugins team + * + * Last Modified: $Date$ + * + * Description: * * A safe alternative to popen * * Provides spopen and spclose - -FILE * spopen(const char *); -int spclose(FILE *); - + * + * FILE * spopen(const char *); + * int spclose(FILE *); + * * * Code taken with liitle modification from "Advanced Programming for the Unix * Environment" by W. Richard Stevens @@ -16,6 +24,22 @@ int spclose(FILE *); * path passed to the exec'd program are esstially empty. (popen create a shell * and passes the environment to it). * + * License Information: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * * $Id$ * ******************************************************************************/ @@ -121,7 +145,7 @@ spopen (const char *cmdstring) argv = malloc (sizeof(char*)*argc); if (argv == NULL) { - printf (_("Could not malloc argv array in popen()\n")); + printf ("%s\n", _("Could not malloc argv array in popen()")); return NULL; } @@ -131,7 +155,7 @@ spopen (const char *cmdstring) str += strspn (str, " \t\r\n"); /* trim any leading whitespace */ if (i >= argc - 2) { - printf (_("CRITICAL - You need more args!!!\n")); + printf ("%s\n",_("CRITICAL - You need more args!!!")); return (NULL); } @@ -278,7 +302,7 @@ popen_timeout_alarm_handler (int signo) printf (_("CRITICAL - Plugin timed out after %d seconds\n"), timeout_interval); } else { - printf (_("CRITICAL - popen timeout received, but no child process\n")); + printf ("%s\n", _("CRITICAL - popen timeout received, but no child process")); } exit (STATE_CRITICAL); } diff --git a/plugins/runcmd.c b/plugins/runcmd.c index bc4ee08..af12d22 100644 --- a/plugins/runcmd.c +++ b/plugins/runcmd.c @@ -1,6 +1,13 @@ -/* +/**************************************************************************** + * Nagios run command utilities + * + * License: GPL + * Copyright (c) 2005 nagios-plugins team + * * $Id$ * + * Description : + * * A simple interface to executing programs from other programs, using an * optimized and safe popen()-like implementation. It is considered safe * in that no shell needs to be spawned and the environment passed to the @@ -14,6 +21,21 @@ * function which isn't is np_runcmd_init() which it doesn't make sense to * call twice anyway, so the api as a whole should be considered async-safe. * + * License Information: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #define NAGIOSPLUG_API_C 1 @@ -137,7 +159,7 @@ np_runcmd_open(const char *cmdstring, int *pfd, int *pfderr) argv = calloc(sizeof(char *), argc); if (argv == NULL) { - printf (_("Could not malloc argv array in popen()\n")); + printf ("%s\n", _("Could not malloc argv array in popen()")); return -1; } diff --git a/plugins/sslutils.c b/plugins/sslutils.c index 66c7299..09d58b0 100644 --- a/plugins/sslutils.c +++ b/plugins/sslutils.c @@ -47,7 +47,7 @@ int np_net_ssl_init (int sd){ SSL_load_error_strings (); OpenSSL_add_all_algorithms(); if ((c = SSL_CTX_new (m)) == NULL) { - printf (_("CRITICAL - Cannot create SSL context.\n")); + printf ("%s\n", _("CRITICAL - Cannot create SSL context.")); return STATE_CRITICAL; } if ((s = SSL_new (c)) != NULL){ @@ -55,13 +55,13 @@ int np_net_ssl_init (int sd){ if (SSL_connect(s) == 1){ return OK; } else { - printf (_("CRITICAL - Cannot make SSL connection ")); + printf ("%s\n", _("CRITICAL - Cannot make SSL connection ")); # ifdef USE_OPENSSL /* XXX look into ERR_error_string */ ERR_print_errors_fp (stdout); # endif /* USE_OPENSSL */ } } else { - printf (_("CRITICAL - Cannot initiate SSL handshake.\n")); + printf ("%s\n", _("CRITICAL - Cannot initiate SSL handshake.")); } return STATE_CRITICAL; } @@ -93,7 +93,7 @@ int np_net_ssl_check_cert(int days_till_exp){ certificate=SSL_get_peer_certificate(s); if(! certificate){ - printf (_("CRITICAL - Cannot retrieve server certificate.\n")); + printf ("%s\n",_("CRITICAL - Cannot retrieve server certificate.")); return STATE_CRITICAL; } @@ -103,7 +103,7 @@ int np_net_ssl_check_cert(int days_till_exp){ /* Generate tm structure to process timestamp */ if (tm->type == V_ASN1_UTCTIME) { if (tm->length < 10) { - printf (_("CRITICAL - Wrong time format in certificate.\n")); + printf ("%s\n", _("CRITICAL - Wrong time format in certificate.")); return STATE_CRITICAL; } else { 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){ } } else { if (tm->length < 12) { - printf (_("CRITICAL - Wrong time format in certificate.\n")); + printf ("%s\n", _("CRITICAL - Wrong time format in certificate.")); return STATE_CRITICAL; } else { stamp.tm_year = @@ -155,7 +155,7 @@ int np_net_ssl_check_cert(int days_till_exp){ X509_free (certificate); return STATE_OK; # else /* ifndef USE_OPENSSL */ - printf (_("WARNING - Plugin does not support checking certificates.\n")); + printf ("%s\n", _("WARNING - Plugin does not support checking certificates.")); return STATE_WARNING; # endif /* USE_OPENSSL */ } diff --git a/plugins/urlize.c b/plugins/urlize.c index 13ab14e..d4d00dd 100644 --- a/plugins/urlize.c +++ b/plugins/urlize.c @@ -20,7 +20,7 @@ const char *progname = "urlize"; const char *revision = "$Revision$"; -const char *copyright = "2000-2004"; +const char *copyright = "2000-2006"; const char *email = "nagiosplug-devel@lists.sourceforge.net"; #include "common.h" @@ -149,27 +149,25 @@ print_help (void) printf ("Copyright (c) 2000 Karl DeBisschop \n"); printf (COPYRIGHT, copyright, email); - printf (_("\n\ -This plugin wraps the text output of another command (plugin) in HTML\n\ - tags, thus displaying the plugin output in as a clickable link in\n\ -the Nagios status screen. The return status is the same as the invoked\n\ -plugin.\n\n")); + printf ("%s\n", _("This plugin wraps the text output of another command (plugin)")); + printf ("%s\n", _("in HTML tags, thus displaying the plugin output in as a clickable link in")); + printf ("%s\n", _("the Nagios status screen. The return status is the same as the invoked plugin.")); + + printf ("\n\n"); print_usage (); - printf (_("\n\ -Pay close attention to quoting to ensure that the shell passes the expected\n\ -data to the plugin. For example, in:\n\ -\n\ - urlize http://example.com/ check_http -H example.com -r 'two words'\n\ -\n\ -the shell will remove the single quotes and urlize will see:\n\ -\n\ - urlize http://example.com/ check_http -H example.com -r two words\n\ -\n\ -You probably want:\n\ -\n\ - urlize http://example.com/ \"check_http -H example.com -r 'two words'\"\n")); + printf (_(UT_HELP_VRSN)); + + printf ("\n"); + printf ("%s\n", _("Examples:")); + printf ("%s\n", _("Pay close attention to quoting to ensure that the shell passes the expected")); + printf ("%s\n\n", _("data to the plugin. For example, in:")); + printf (" %s\n\n", _("urlize http://example.com/ check_http -H example.com -r 'two words'")); + printf (" %s\n", _("the shell will remove the single quotes and urlize will see:")); + printf (" %s\n\n", _("urlize http://example.com/ check_http -H example.com -r two words")); + printf (" %s\n\n", _("You probably want:")); + printf (" %s\n", _("urlize http://example.com/ \"check_http -H example.com -r 'two words'\"")); printf (_(UT_SUPPORT)); } @@ -179,5 +177,6 @@ You probably want:\n\ void print_usage (void) { - printf ("Usage:\n %s ... \n", progname); + printf (_("Usage:")); + printf ("%s ... \n", progname); } diff --git a/plugins/utils.c b/plugins/utils.c index f2593a1..a455f22 100644 --- a/plugins/utils.c +++ b/plugins/utils.c @@ -360,7 +360,7 @@ set_thresholds(thresholds **my_thresholds, char *warn_string, char *critical_str if (_set_thresholds(my_thresholds, warn_string, critical_string) == 0) { return; } else { - usage("Range format incorrect"); + usage(_("Range format incorrect")); } } -- 2.30.2