summaryrefslogtreecommitdiffstats
path: root/plugins/check_mysql_query.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/check_mysql_query.c')
-rw-r--r--plugins/check_mysql_query.c453
1 files changed, 214 insertions, 239 deletions
diff --git a/plugins/check_mysql_query.c b/plugins/check_mysql_query.c
index 842b7a2f..5e04a94b 100644
--- a/plugins/check_mysql_query.c
+++ b/plugins/check_mysql_query.c
@@ -1,157 +1,151 @@
1/***************************************************************************** 1/*****************************************************************************
2* 2 *
3* Monitoring check_mysql_query plugin 3 * Monitoring check_mysql_query plugin
4* 4 *
5* License: GPL 5 * License: GPL
6* Copyright (c) 2006-2009 Monitoring Plugins Development Team 6 * Copyright (c) 2006-2024 Monitoring Plugins Development Team
7* Original code from check_mysql, copyright 1999 Didi Rieder 7 * Original code from check_mysql, copyright 1999 Didi Rieder
8* 8 *
9* Description: 9 * Description:
10* 10 *
11* This file contains the check_mysql_query plugin 11 * This file contains the check_mysql_query plugin
12* 12 *
13* This plugin is for running arbitrary SQL and checking the results 13 * This plugin is for running arbitrary SQL and checking the results
14* 14 *
15* 15 *
16* This program is free software: you can redistribute it and/or modify 16 * This program is free software: you can redistribute it and/or modify
17* it under the terms of the GNU General Public License as published by 17 * it under the terms of the GNU General Public License as published by
18* the Free Software Foundation, either version 3 of the License, or 18 * the Free Software Foundation, either version 3 of the License, or
19* (at your option) any later version. 19 * (at your option) any later version.
20* 20 *
21* This program is distributed in the hope that it will be useful, 21 * This program is distributed in the hope that it will be useful,
22* but WITHOUT ANY WARRANTY; without even the implied warranty of 22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24* GNU General Public License for more details. 24 * GNU General Public License for more details.
25* 25 *
26* You should have received a copy of the GNU General Public License 26 * You should have received a copy of the GNU General Public License
27* along with this program. If not, see <http://www.gnu.org/licenses/>. 27 * along with this program. If not, see <http://www.gnu.org/licenses/>.
28* 28 *
29* 29 *
30*****************************************************************************/ 30 *****************************************************************************/
31 31
32const char *progname = "check_mysql_query"; 32const char *progname = "check_mysql_query";
33const char *copyright = "1999-2007"; 33const char *copyright = "1999-2024";
34const char *email = "devel@monitoring-plugins.org"; 34const char *email = "devel@monitoring-plugins.org";
35 35
36#include "common.h" 36#include "common.h"
37#include "utils.h" 37#include "utils.h"
38#include "utils_base.h" 38#include "utils_base.h"
39#include "netutils.h" 39#include "netutils.h"
40#include "check_mysql_query.d/config.h"
40 41
41#include <mysql.h> 42#include <mysql.h>
42#include <errmsg.h> 43#include <errmsg.h>
43 44
44char *db_user = NULL; 45typedef struct {
45char *db_host = NULL; 46 int errorcode;
46char *db_socket = NULL; 47 check_mysql_query_config config;
47char *db_pass = NULL; 48} check_mysql_query_config_wrapper;
48char *db = NULL; 49static check_mysql_query_config_wrapper process_arguments(int /*argc*/, char ** /*argv*/);
49char *opt_file = NULL; 50static check_mysql_query_config_wrapper validate_arguments(check_mysql_query_config_wrapper /*config_wrapper*/);
50char *opt_group = NULL; 51static void print_help(void);
51unsigned int db_port = MYSQL_PORT; 52void print_usage(void);
52 53
53int process_arguments (int, char **); 54static int verbose = 0;
54int validate_arguments (void);
55void print_help (void);
56void print_usage (void);
57 55
58char *sql_query = NULL; 56int main(int argc, char **argv) {
59int verbose = 0; 57 setlocale(LC_ALL, "");
60thresholds *my_thresholds = NULL; 58 bindtextdomain(PACKAGE, LOCALEDIR);
61 59 textdomain(PACKAGE);
62
63int
64main (int argc, char **argv)
65{
66
67 MYSQL mysql;
68 MYSQL_RES *res;
69 MYSQL_ROW row;
70
71 double value;
72 char *error = NULL;
73 int status;
74
75 setlocale (LC_ALL, "");
76 bindtextdomain (PACKAGE, LOCALEDIR);
77 textdomain (PACKAGE);
78 60
79 /* Parse extra opts if any */ 61 /* Parse extra opts if any */
80 argv=np_extra_opts (&argc, argv, progname); 62 argv = np_extra_opts(&argc, argv, progname);
81 63
82 if (process_arguments (argc, argv) == ERROR) 64 check_mysql_query_config_wrapper tmp_config = process_arguments(argc, argv);
83 usage4 (_("Could not parse arguments")); 65 if (tmp_config.errorcode == ERROR) {
66 usage4(_("Could not parse arguments"));
67 }
84 68
69 const check_mysql_query_config config = tmp_config.config;
70
71 MYSQL mysql;
85 /* initialize mysql */ 72 /* initialize mysql */
86 mysql_init (&mysql); 73 mysql_init(&mysql);
87 74
88 if (opt_file != NULL) 75 if (config.opt_file != NULL) {
89 mysql_options(&mysql,MYSQL_READ_DEFAULT_FILE,opt_file); 76 mysql_options(&mysql, MYSQL_READ_DEFAULT_FILE, config.opt_file);
77 }
90 78
91 if (opt_group != NULL) 79 if (config.opt_group != NULL) {
92 mysql_options(&mysql,MYSQL_READ_DEFAULT_GROUP,opt_group); 80 mysql_options(&mysql, MYSQL_READ_DEFAULT_GROUP, config.opt_group);
93 else 81 } else {
94 mysql_options(&mysql,MYSQL_READ_DEFAULT_GROUP,"client"); 82 mysql_options(&mysql, MYSQL_READ_DEFAULT_GROUP, "client");
83 }
95 84
96 /* establish a connection to the server and error checking */ 85 /* establish a connection to the server and error checking */
97 if (!mysql_real_connect(&mysql,db_host,db_user,db_pass,db,db_port,db_socket,0)) { 86 if (!mysql_real_connect(&mysql, config.db_host, config.db_user, config.db_pass, config.db, config.db_port, config.db_socket, 0)) {
98 if (mysql_errno (&mysql) == CR_UNKNOWN_HOST) 87 if (mysql_errno(&mysql) == CR_UNKNOWN_HOST) {
99 die (STATE_WARNING, "QUERY %s: %s\n", _("WARNING"), mysql_error (&mysql)); 88 die(STATE_WARNING, "QUERY %s: %s\n", _("WARNING"), mysql_error(&mysql));
100 else if (mysql_errno (&mysql) == CR_VERSION_ERROR) 89 } else if (mysql_errno(&mysql) == CR_VERSION_ERROR) {
101 die (STATE_WARNING, "QUERY %s: %s\n", _("WARNING"), mysql_error (&mysql)); 90 die(STATE_WARNING, "QUERY %s: %s\n", _("WARNING"), mysql_error(&mysql));
102 else if (mysql_errno (&mysql) == CR_OUT_OF_MEMORY) 91 } else if (mysql_errno(&mysql) == CR_OUT_OF_MEMORY) {
103 die (STATE_WARNING, "QUERY %s: %s\n", _("WARNING"), mysql_error (&mysql)); 92 die(STATE_WARNING, "QUERY %s: %s\n", _("WARNING"), mysql_error(&mysql));
104 else if (mysql_errno (&mysql) == CR_IPSOCK_ERROR) 93 } else if (mysql_errno(&mysql) == CR_IPSOCK_ERROR) {
105 die (STATE_WARNING, "QUERY %s: %s\n", _("WARNING"), mysql_error (&mysql)); 94 die(STATE_WARNING, "QUERY %s: %s\n", _("WARNING"), mysql_error(&mysql));
106 else if (mysql_errno (&mysql) == CR_SOCKET_CREATE_ERROR) 95 } else if (mysql_errno(&mysql) == CR_SOCKET_CREATE_ERROR) {
107 die (STATE_WARNING, "QUERY %s: %s\n", _("WARNING"), mysql_error (&mysql)); 96 die(STATE_WARNING, "QUERY %s: %s\n", _("WARNING"), mysql_error(&mysql));
108 else 97 } else {
109 die (STATE_CRITICAL, "QUERY %s: %s\n", _("CRITICAL"), mysql_error (&mysql)); 98 die(STATE_CRITICAL, "QUERY %s: %s\n", _("CRITICAL"), mysql_error(&mysql));
99 }
110 } 100 }
111 101
112 if (mysql_query (&mysql, sql_query) != 0) { 102 char *error = NULL;
103 if (mysql_query(&mysql, config.sql_query) != 0) {
113 error = strdup(mysql_error(&mysql)); 104 error = strdup(mysql_error(&mysql));
114 mysql_close (&mysql); 105 mysql_close(&mysql);
115 die (STATE_CRITICAL, "QUERY %s: %s - %s\n", _("CRITICAL"), _("Error with query"), error); 106 die(STATE_CRITICAL, "QUERY %s: %s - %s\n", _("CRITICAL"), _("Error with query"), error);
116 } 107 }
117 108
109 MYSQL_RES *res;
118 /* store the result */ 110 /* store the result */
119 if ( (res = mysql_store_result (&mysql)) == NULL) { 111 if ((res = mysql_store_result(&mysql)) == NULL) {
120 error = strdup(mysql_error(&mysql)); 112 error = strdup(mysql_error(&mysql));
121 mysql_close (&mysql); 113 mysql_close(&mysql);
122 die (STATE_CRITICAL, "QUERY %s: Error with store_result - %s\n", _("CRITICAL"), error); 114 die(STATE_CRITICAL, "QUERY %s: Error with store_result - %s\n", _("CRITICAL"), error);
123 } 115 }
124 116
125 /* Check there is some data */ 117 /* Check there is some data */
126 if (mysql_num_rows(res) == 0) { 118 if (mysql_num_rows(res) == 0) {
127 mysql_close(&mysql); 119 mysql_close(&mysql);
128 die (STATE_WARNING, "QUERY %s: %s\n", _("WARNING"), _("No rows returned")); 120 die(STATE_WARNING, "QUERY %s: %s\n", _("WARNING"), _("No rows returned"));
129 } 121 }
130 122
123 MYSQL_ROW row;
131 /* fetch the first row */ 124 /* fetch the first row */
132 if ( (row = mysql_fetch_row (res)) == NULL) { 125 if ((row = mysql_fetch_row(res)) == NULL) {
133 error = strdup(mysql_error(&mysql)); 126 error = strdup(mysql_error(&mysql));
134 mysql_free_result (res); 127 mysql_free_result(res);
135 mysql_close (&mysql); 128 mysql_close(&mysql);
136 die (STATE_CRITICAL, "QUERY %s: Fetch row error - %s\n", _("CRITICAL"), error); 129 die(STATE_CRITICAL, "QUERY %s: Fetch row error - %s\n", _("CRITICAL"), error);
137 } 130 }
138 131
139 if (! is_numeric(row[0])) { 132 if (!is_numeric(row[0])) {
140 die (STATE_CRITICAL, "QUERY %s: %s - '%s'\n", _("CRITICAL"), _("Is not a numeric"), row[0]); 133 die(STATE_CRITICAL, "QUERY %s: %s - '%s'\n", _("CRITICAL"), _("Is not a numeric"), row[0]);
141 } 134 }
142 135
143 value = strtod(row[0], NULL); 136 double value = strtod(row[0], NULL);
144 137
145 /* free the result */ 138 /* free the result */
146 mysql_free_result (res); 139 mysql_free_result(res);
147 140
148 /* close the connection */ 141 /* close the connection */
149 mysql_close (&mysql); 142 mysql_close(&mysql);
150 143
151 if (verbose >= 3) 144 if (verbose >= 3) {
152 printf("mysql result: %f\n", value); 145 printf("mysql result: %f\n", value);
146 }
153 147
154 status = get_status(value, my_thresholds); 148 int status = get_status(value, config.my_thresholds);
155 149
156 if (status == STATE_OK) { 150 if (status == STATE_OK) {
157 printf("QUERY %s: ", _("OK")); 151 printf("QUERY %s: ", _("OK"));
@@ -160,75 +154,63 @@ main (int argc, char **argv)
160 } else if (status == STATE_CRITICAL) { 154 } else if (status == STATE_CRITICAL) {
161 printf("QUERY %s: ", _("CRITICAL")); 155 printf("QUERY %s: ", _("CRITICAL"));
162 } 156 }
163 printf(_("'%s' returned %f | %s"), sql_query, value, 157 printf(_("'%s' returned %f | %s"), config.sql_query, value,
164 fperfdata("result", value, "", 158 fperfdata("result", value, "", config.my_thresholds->warning, config.my_thresholds->warning ? config.my_thresholds->warning->end : 0,
165 my_thresholds->warning?true:false, my_thresholds->warning?my_thresholds->warning->end:0, 159 config.my_thresholds->critical, config.my_thresholds->critical ? config.my_thresholds->critical->end : 0, false, 0, false, 0));
166 my_thresholds->critical?true:false, my_thresholds->critical?my_thresholds->critical->end:0,
167 false, 0,
168 false, 0)
169 );
170 printf("\n"); 160 printf("\n");
171 161
172 return status; 162 return status;
173} 163}
174 164
175
176/* process command-line arguments */ 165/* process command-line arguments */
177int 166check_mysql_query_config_wrapper process_arguments(int argc, char **argv) {
178process_arguments (int argc, char **argv)
179{
180 int c;
181 char *warning = NULL;
182 char *critical = NULL;
183
184 int option = 0;
185 static struct option longopts[] = { 167 static struct option longopts[] = {
186 {"hostname", required_argument, 0, 'H'}, 168 {"hostname", required_argument, 0, 'H'}, {"socket", required_argument, 0, 's'}, {"database", required_argument, 0, 'd'},
187 {"socket", required_argument, 0, 's'}, 169 {"username", required_argument, 0, 'u'}, {"password", required_argument, 0, 'p'}, {"file", required_argument, 0, 'f'},
188 {"database", required_argument, 0, 'd'}, 170 {"group", required_argument, 0, 'g'}, {"port", required_argument, 0, 'P'}, {"verbose", no_argument, 0, 'v'},
189 {"username", required_argument, 0, 'u'}, 171 {"version", no_argument, 0, 'V'}, {"help", no_argument, 0, 'h'}, {"query", required_argument, 0, 'q'},
190 {"password", required_argument, 0, 'p'}, 172 {"warning", required_argument, 0, 'w'}, {"critical", required_argument, 0, 'c'}, {0, 0, 0, 0}};
191 {"file", required_argument, 0, 'f'}, 173
192 {"group", required_argument, 0, 'g'}, 174 check_mysql_query_config_wrapper result = {
193 {"port", required_argument, 0, 'P'}, 175 .errorcode = OK,
194 {"verbose", no_argument, 0, 'v'}, 176 .config = check_mysql_query_config_init(),
195 {"version", no_argument, 0, 'V'},
196 {"help", no_argument, 0, 'h'},
197 {"query", required_argument, 0, 'q'},
198 {"warning", required_argument, 0, 'w'},
199 {"critical", required_argument, 0, 'c'},
200 {0, 0, 0, 0}
201 }; 177 };
202 178
203 if (argc < 1) 179 if (argc < 1) {
204 return ERROR; 180 result.errorcode = ERROR;
181 return result;
182 }
205 183
206 while (1) { 184 char *warning = NULL;
207 c = getopt_long (argc, argv, "hvVP:p:u:d:H:s:q:w:c:f:g:", longopts, &option); 185 char *critical = NULL;
208 186
209 if (c == -1 || c == EOF) 187 while (true) {
188 int option = 0;
189 int option_char = getopt_long(argc, argv, "hvVP:p:u:d:H:s:q:w:c:f:g:", longopts, &option);
190
191 if (option_char == -1 || option_char == EOF) {
210 break; 192 break;
193 }
211 194
212 switch (c) { 195 switch (option_char) {
213 case 'H': /* hostname */ 196 case 'H': /* hostname */
214 if (is_host (optarg)) { 197 if (is_host(optarg)) {
215 db_host = optarg; 198 result.config.db_host = optarg;
216 } 199 } else {
217 else { 200 usage2(_("Invalid hostname/address"), optarg);
218 usage2 (_("Invalid hostname/address"), optarg);
219 } 201 }
220 break; 202 break;
221 case 's': /* socket */ 203 case 's': /* socket */
222 db_socket = optarg; 204 result.config.db_socket = optarg;
223 break; 205 break;
224 case 'd': /* database */ 206 case 'd': /* database */
225 db = optarg; 207 result.config.db = optarg;
226 break; 208 break;
227 case 'u': /* username */ 209 case 'u': /* username */
228 db_user = optarg; 210 result.config.db_user = optarg;
229 break; 211 break;
230 case 'p': /* authentication information: password */ 212 case 'p': /* authentication information: password */
231 db_pass = strdup(optarg); 213 result.config.db_pass = strdup(optarg);
232 214
233 /* Delete the password from process list */ 215 /* Delete the password from process list */
234 while (*optarg != '\0') { 216 while (*optarg != '\0') {
@@ -236,26 +218,26 @@ process_arguments (int argc, char **argv)
236 optarg++; 218 optarg++;
237 } 219 }
238 break; 220 break;
239 case 'f': /* client options file */ 221 case 'f': /* client options file */
240 opt_file = optarg; 222 result.config.opt_file = optarg;
241 break; 223 break;
242 case 'g': /* client options group */ 224 case 'g': /* client options group */
243 opt_group = optarg; 225 result.config.opt_group = optarg;
244 break; 226 break;
245 case 'P': /* critical time threshold */ 227 case 'P': /* critical time threshold */
246 db_port = atoi (optarg); 228 result.config.db_port = atoi(optarg);
247 break; 229 break;
248 case 'v': 230 case 'v':
249 verbose++; 231 verbose++;
250 break; 232 break;
251 case 'V': /* version */ 233 case 'V': /* version */
252 print_revision (progname, NP_VERSION); 234 print_revision(progname, NP_VERSION);
253 exit (STATE_UNKNOWN); 235 exit(STATE_UNKNOWN);
254 case 'h': /* help */ 236 case 'h': /* help */
255 print_help (); 237 print_help();
256 exit (STATE_UNKNOWN); 238 exit(STATE_UNKNOWN);
257 case 'q': 239 case 'q':
258 xasprintf(&sql_query, "%s", optarg); 240 xasprintf(&result.config.sql_query, "%s", optarg);
259 break; 241 break;
260 case 'w': 242 case 'w':
261 warning = optarg; 243 warning = optarg;
@@ -263,92 +245,85 @@ process_arguments (int argc, char **argv)
263 case 'c': 245 case 'c':
264 critical = optarg; 246 critical = optarg;
265 break; 247 break;
266 case '?': /* help */ 248 case '?': /* help */
267 usage5 (); 249 usage5();
268 } 250 }
269 } 251 }
270 252
271 c = optind; 253 set_thresholds(&result.config.my_thresholds, warning, critical);
272 254
273 set_thresholds(&my_thresholds, warning, critical); 255 return validate_arguments(result);
274
275 return validate_arguments ();
276} 256}
277 257
278 258check_mysql_query_config_wrapper validate_arguments(check_mysql_query_config_wrapper config_wrapper) {
279int 259 if (config_wrapper.config.sql_query == NULL) {
280validate_arguments (void)
281{
282 if (sql_query == NULL)
283 usage("Must specify a SQL query to run"); 260 usage("Must specify a SQL query to run");
261 }
284 262
285 if (db_user == NULL) 263 if (config_wrapper.config.db_user == NULL) {
286 db_user = strdup(""); 264 config_wrapper.config.db_user = strdup("");
265 }
287 266
288 if (db_host == NULL) 267 if (config_wrapper.config.db_host == NULL) {
289 db_host = strdup(""); 268 config_wrapper.config.db_host = strdup("");
269 }
290 270
291 if (db == NULL) 271 if (config_wrapper.config.db == NULL) {
292 db = strdup(""); 272 config_wrapper.config.db = strdup("");
273 }
293 274
294 return OK; 275 return config_wrapper;
295} 276}
296 277
297 278void print_help(void) {
298void
299print_help (void)
300{
301 char *myport; 279 char *myport;
302 xasprintf (&myport, "%d", MYSQL_PORT); 280 xasprintf(&myport, "%d", MYSQL_PORT);
303 281
304 print_revision (progname, NP_VERSION); 282 print_revision(progname, NP_VERSION);
305 283
306 printf (_(COPYRIGHT), copyright, email); 284 printf(_(COPYRIGHT), copyright, email);
307 285
308 printf ("%s\n", _("This program checks a query result against threshold levels")); 286 printf("%s\n", _("This program checks a query result against threshold levels"));
309 287
310 printf ("\n\n"); 288 printf("\n\n");
311 289
312 print_usage (); 290 print_usage();
313 291
314 printf (UT_HELP_VRSN); 292 printf(UT_HELP_VRSN);
315 printf (UT_EXTRA_OPTS); 293 printf(UT_EXTRA_OPTS);
316 printf (" -q, --query=STRING\n"); 294 printf(" -q, --query=STRING\n");
317 printf (" %s\n", _("SQL query to run. Only first column in first row will be read")); 295 printf(" %s\n", _("SQL query to run. Only first column in first row will be read"));
318 printf (UT_WARN_CRIT_RANGE); 296 printf(UT_WARN_CRIT_RANGE);
319 printf (UT_HOST_PORT, 'P', myport); 297 printf(UT_HOST_PORT, 'P', myport);
320 printf (" %s\n", "-s, --socket=STRING"); 298 printf(" %s\n", "-s, --socket=STRING");
321 printf (" %s\n", _("Use the specified socket (has no effect if -H is used)")); 299 printf(" %s\n", _("Use the specified socket (has no effect if -H is used)"));
322 printf (" -d, --database=STRING\n"); 300 printf(" -d, --database=STRING\n");
323 printf (" %s\n", _("Database to check")); 301 printf(" %s\n", _("Database to check"));
324 printf (" %s\n", "-f, --file=STRING"); 302 printf(" %s\n", "-f, --file=STRING");
325 printf (" %s\n", _("Read from the specified client options file")); 303 printf(" %s\n", _("Read from the specified client options file"));
326 printf (" %s\n", "-g, --group=STRING"); 304 printf(" %s\n", "-g, --group=STRING");
327 printf (" %s\n", _("Use a client options group")); 305 printf(" %s\n", _("Use a client options group"));
328 printf (" -u, --username=STRING\n"); 306 printf(" -u, --username=STRING\n");
329 printf (" %s\n", _("Username to login with")); 307 printf(" %s\n", _("Username to login with"));
330 printf (" -p, --password=STRING\n"); 308 printf(" -p, --password=STRING\n");
331 printf (" %s\n", _("Password to login with")); 309 printf(" %s\n", _("Password to login with"));
332 printf (" ==> %s <==\n", _("IMPORTANT: THIS FORM OF AUTHENTICATION IS NOT SECURE!!!")); 310 printf(" ==> %s <==\n", _("IMPORTANT: THIS FORM OF AUTHENTICATION IS NOT SECURE!!!"));
333 printf (" %s\n", _("Your clear-text password could be visible as a process table entry")); 311 printf(" %s\n", _("Your clear-text password could be visible as a process table entry"));
334
335 printf ("\n");
336 printf (" %s\n", _("A query is required. The result from the query should be numeric."));
337 printf (" %s\n", _("For extra security, create a user with minimal access."));
338
339 printf ("\n");
340 printf ("%s\n", _("Notes:"));
341 printf (" %s\n", _("You must specify -p with an empty string to force an empty password,"));
342 printf (" %s\n", _("overriding any my.cnf settings."));
343
344 printf (UT_SUPPORT);
345}
346 312
313 printf("\n");
314 printf(" %s\n", _("A query is required. The result from the query should be numeric."));
315 printf(" %s\n", _("For extra security, create a user with minimal access."));
316
317 printf("\n");
318 printf("%s\n", _("Notes:"));
319 printf(" %s\n", _("You must specify -p with an empty string to force an empty password,"));
320 printf(" %s\n", _("overriding any my.cnf settings."));
321
322 printf(UT_SUPPORT);
323}
347 324
348void 325void print_usage(void) {
349print_usage (void) 326 printf("%s\n", _("Usage:"));
350{ 327 printf(" %s -q SQL_query [-w warn] [-c crit] [-H host] [-P port] [-s socket]\n", progname);
351 printf ("%s\n", _("Usage:")); 328 printf(" [-d database] [-u user] [-p password] [-f optfile] [-g group]\n");
352 printf (" %s -q SQL_query [-w warn] [-c crit] [-H host] [-P port] [-s socket]\n",progname);
353 printf (" [-d database] [-u user] [-p password] [-f optfile] [-g group]\n");
354} 329}