Code

tinderbox: Don't alter SunOS path if we're building off a repository tree
[nagiosplug.git] / plugins / check_pgsql.c
index 0563322858a5a7d77e421f4a3c9a1efe0b5cd01c..abe721bf696a5802d60e4922c7e7fd6896733f4c 100644 (file)
@@ -5,8 +5,6 @@
 * License: GPL
 * Copyright (c) 1999-2007 Nagios Plugins Development Team
 * 
-* Last Modified: $Date$
-* 
 * Description:
 * 
 * This file contains the check_pgsql plugin
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
-* $Id$
 * 
 *****************************************************************************/
 
 const char *progname = "check_pgsql";
-const char *revision = "$Revision$";
 const char *copyright = "1999-2007";
 const char *email = "nagiosplug-devel@lists.sourceforge.net";
 
@@ -150,6 +146,9 @@ main (int argc, char **argv)
        bindtextdomain (PACKAGE, LOCALEDIR);
        textdomain (PACKAGE);
 
+       /* Parse extra opts if any */
+       argv=np_extra_opts (&argc, argv, progname);
+
        if (process_arguments (argc, argv) == ERROR)
                usage4 (_("Could not parse arguments"));
 
@@ -183,7 +182,7 @@ main (int argc, char **argv)
                status = STATE_OK;
        }
        PQfinish (conn);
-       printf (_(" %s - database %s (%d sec.)|%s\n"), 
+       printf (_(" %s - database %s (%d sec.)|%s\n"),
                state_text(status), dbName, elapsed_time,
                fperfdata("time", elapsed_time, "s",
                         (int)twarn, twarn, (int)tcrit, tcrit, TRUE, 0, FALSE,0));
@@ -228,7 +227,7 @@ process_arguments (int argc, char **argv)
                        print_help ();
                        exit (STATE_OK);
                case 'V':     /* version */
-                       print_revision (progname, revision);
+                       print_revision (progname, NP_VERSION);
                        exit (STATE_OK);
                case 't':     /* timeout period */
                        if (!is_integer (optarg))
@@ -352,7 +351,7 @@ is_pg_dbname (char *dbname)
 
 /**
 
-the tango program should eventually create an entity here based on the 
+the tango program should eventually create an entity here based on the
 function prototype
 
 @@-
@@ -386,7 +385,7 @@ is_pg_logname (char *username)
 
 /******************************************************************************
 @@-
-</sect2> 
+</sect2>
 </sect1>
 </article>
 -@@
@@ -401,7 +400,7 @@ print_help (void)
 
        asprintf (&myport, "%d", DEFAULT_PORT);
 
-       print_revision (progname, revision);
+       print_revision (progname, NP_VERSION);
 
        printf (COPYRIGHT, copyright, email);
 
@@ -412,6 +411,7 @@ print_help (void)
        print_usage ();
 
        printf (_(UT_HELP_VRSN));
+       printf (_(UT_EXTRA_OPTS));
 
        printf (_(UT_HOST_PORT), 'P', myport);
 
@@ -438,13 +438,21 @@ print_help (void)
   printf (" %s\n", _("specified database, and then disconnects. If no database is specified, it"));
   printf (" %s\n", _("connects to the template1 database, which is present in every functioning"));
   printf (" %s\n\n", _("PostgreSQL DBMS."));
+
        printf (" %s\n", _("The plugin will connect to a local postmaster if no host is specified. To"));
   printf (" %s\n", _("connect to a remote host, be sure that the remote postmaster accepts TCP/IP"));
   printf (" %s\n\n", _("connections (start the postmaster with the -i option)."));
+
        printf (" %s\n", _("Typically, the nagios user (unless the --logname option is used) should be"));
   printf (" %s\n", _("able to connect to the database without a password. The plugin can also send"));
   printf (" %s\n", _("a password, but no effort is made to obsure or encrypt the password."));
 
+#ifdef NP_EXTRA_OPTS
+  printf ("\n");
+  printf ("%s\n", _("Notes:"));
+  printf (_(UT_EXTRA_OPTS_NOTES));
+#endif
+
        printf (_(UT_SUPPORT));
 }