diff options
Diffstat (limited to 'plugins/check_pgsql.c')
-rw-r--r-- | plugins/check_pgsql.c | 62 |
1 files changed, 23 insertions, 39 deletions
diff --git a/plugins/check_pgsql.c b/plugins/check_pgsql.c index dea39cf9..b532d681 100644 --- a/plugins/check_pgsql.c +++ b/plugins/check_pgsql.c | |||
@@ -23,13 +23,6 @@ | |||
23 | * | 23 | * |
24 | *****************************************************************************/ | 24 | *****************************************************************************/ |
25 | 25 | ||
26 | const char *progname = "check_pgsql"; | ||
27 | #define REVISION "$Revision$" | ||
28 | #define COPYRIGHT "1999-2001" | ||
29 | #define AUTHOR "Karl DeBisschop" | ||
30 | #define EMAIL "kdebisschop@users.sourceforge.net" | ||
31 | #define SUMMARY "Tests to see if a PostgreSQL DBMS is accepting connections.\n" | ||
32 | |||
33 | #define DEFAULT_DB "template1" | 26 | #define DEFAULT_DB "template1" |
34 | #define DEFAULT_HOST "127.0.0.1" | 27 | #define DEFAULT_HOST "127.0.0.1" |
35 | 28 | ||
@@ -65,6 +58,11 @@ int tcrit = DEFAULT_CRIT; | |||
65 | 58 | ||
66 | PGconn *conn; | 59 | PGconn *conn; |
67 | /*PGresult *res;*/ | 60 | /*PGresult *res;*/ |
61 | |||
62 | const char *progname = "check_pgsql"; | ||
63 | const char *revision = "$Revision$"; | ||
64 | const char *copyright = "1999-2003"; | ||
65 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
68 | 66 | ||
69 | 67 | ||
70 | /****************************************************************************** | 68 | /****************************************************************************** |
@@ -127,22 +125,18 @@ Please note that all tags must be lowercase to use the DocBook XML DTD. | |||
127 | void | 125 | void |
128 | print_help (void) | 126 | print_help (void) |
129 | { | 127 | { |
130 | print_revision (progname, REVISION); | 128 | print_revision (progname, revision); |
131 | printf | 129 | |
132 | ("Copyright (c) %s %s <%s>\n\n%s\n", | 130 | printf (_(COPYRIGHT), copyright, email); |
133 | COPYRIGHT, AUTHOR, EMAIL, SUMMARY); | 131 | |
132 | printf (_("Test whether a PostgreSQL DBMS is accepting connections.\n\n")); | ||
133 | |||
134 | print_usage (); | 134 | print_usage (); |
135 | printf (_("\ | 135 | |
136 | \nOptions:\n\ | 136 | printf (_(HELP_VRSN)); |
137 | -H, --hostname=ADDRESS\n\ | 137 | |
138 | Host name argument for servers using host headers (use numeric\n\ | 138 | printf (_(HOST_PORT_46), 'P', "5432"); |
139 | address if possible to bypass DNS lookup).\n\ | 139 | |
140 | -P, --port=INTEGER\n\ | ||
141 | Port number (default: %d)\n\ | ||
142 | -4, --use-ipv4\n\ | ||
143 | Use IPv4 connection\n\ | ||
144 | -6, --use-ipv6\n\ | ||
145 | Use IPv6 connection\n"), DEFAULT_PORT); | ||
146 | printf (S_("\ | 140 | printf (S_("\ |
147 | -d, --database=STRING\n\ | 141 | -d, --database=STRING\n\ |
148 | Database to check (default: %s)\n\ | 142 | Database to check (default: %s)\n\ |
@@ -150,22 +144,12 @@ print_help (void) | |||
150 | Login name of user\n\ | 144 | Login name of user\n\ |
151 | -p, --password = STRING\n\ | 145 | -p, --password = STRING\n\ |
152 | Password (BIG SECURITY ISSUE)\n\n"), DEFAULT_DB); | 146 | Password (BIG SECURITY ISSUE)\n\n"), DEFAULT_DB); |
153 | printf (S_("\nOptions:\n\ | 147 | |
154 | -c, --critical=INTEGER\n\ | 148 | printf (_(WARN_CRIT_TO), DEFAULT_SOCKET_TIMEOUT); |
155 | Exit STATE_CRITICAL if connection time exceeds threshold (default: %d)\n\ | 149 | |
156 | -w, --warning=INTEGER\n\ | 150 | printf (_(VRBS)); |
157 | Exit STATE_WARNING if connection time exceeds threshold (default: %d)\n\ | 151 | |
158 | -t, --timeout=INTEGER\n\ | 152 | printf (S_("\nAll parameters are optional.\n\ |
159 | Terminate test if timeout limit is exceeded (default: %d)\n"), | ||
160 | DEFAULT_WARN, DEFAULT_CRIT, DEFAULT_TIMEOUT); | ||
161 | printf (_("\ | ||
162 | -v, --verbose\n\ | ||
163 | Show details for command-line debugging (Nagios may truncate output)\n\ | ||
164 | -h, --help\n\ | ||
165 | Print detailed help screen\n\ | ||
166 | -V, --version\n\ | ||
167 | Print version information\n\n")); | ||
168 | printf (S_("All parameters are optional.\n\ | ||
169 | \n\ | 153 | \n\ |
170 | This plugin tests a PostgreSQL DBMS to determine whether it is active and\n\ | 154 | This plugin tests a PostgreSQL DBMS to determine whether it is active and\n\ |
171 | accepting queries. In its current operation, it simply connects to the\n\ | 155 | accepting queries. In its current operation, it simply connects to the\n\ |
@@ -290,7 +274,7 @@ process_arguments (int argc, char **argv) | |||
290 | print_help (); | 274 | print_help (); |
291 | exit (STATE_OK); | 275 | exit (STATE_OK); |
292 | case 'V': /* version */ | 276 | case 'V': /* version */ |
293 | print_revision (progname, REVISION); | 277 | print_revision (progname, revision); |
294 | exit (STATE_OK); | 278 | exit (STATE_OK); |
295 | case 't': /* timeout period */ | 279 | case 't': /* timeout period */ |
296 | if (!is_integer (optarg)) | 280 | if (!is_integer (optarg)) |