diff options
| author | Karl DeBisschop <kdebisschop@users.sourceforge.net> | 2003-08-02 22:06:06 +0000 |
|---|---|---|
| committer | Karl DeBisschop <kdebisschop@users.sourceforge.net> | 2003-08-02 22:06:06 +0000 |
| commit | 561da286a12ae7abb9d120b7ca87ffe46a225250 (patch) | |
| tree | c9319b351eb8f28c86ea8778644858fbe91c3228 /plugins/check_mysql.c | |
| parent | 3c48edf660facd4bd93181333b48960afd83934b (diff) | |
| download | monitoring-plugins-561da286a12ae7abb9d120b7ca87ffe46a225250.tar.gz | |
markupf for translation
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@634 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/check_mysql.c')
| -rw-r--r-- | plugins/check_mysql.c | 108 |
1 files changed, 51 insertions, 57 deletions
diff --git a/plugins/check_mysql.c b/plugins/check_mysql.c index 30748146..a18397d8 100644 --- a/plugins/check_mysql.c +++ b/plugins/check_mysql.c | |||
| @@ -15,25 +15,66 @@ | |||
| 15 | ******************************************************************************/ | 15 | ******************************************************************************/ |
| 16 | 16 | ||
| 17 | const char *progname = "check_mysql"; | 17 | const char *progname = "check_mysql"; |
| 18 | #define REVISION "$Revision$" | 18 | const char *revision = "$Revision$"; |
| 19 | #define COPYRIGHT "1999-2002" | 19 | const char *copyright = "1999-2002"; |
| 20 | const char *email = "nagiosplug-devel@lists.sourceforge.net"; | ||
| 20 | 21 | ||
| 21 | #include "common.h" | 22 | #include "common.h" |
| 22 | #include "utils.h" | 23 | #include "utils.h" |
| 23 | 24 | #include "netutils.h" | |
| 24 | #include <mysql/mysql.h> | 25 | #include <mysql/mysql.h> |
| 25 | #include <mysql/errmsg.h> | 26 | #include <mysql/errmsg.h> |
| 26 | 27 | ||
| 28 | unsigned int db_port = MYSQL_PORT; | ||
| 29 | |||
| 30 | void | ||
| 31 | print_usage (void) | ||
| 32 | { | ||
| 33 | printf (_("\ | ||
| 34 | Usage: %s [-d database] [-H host] [-P port] [-u user] [-p password]\n"), | ||
| 35 | progname); | ||
| 36 | printf (_(UT_HLP_VRS), progname, progname); | ||
| 37 | } | ||
| 38 | |||
| 39 | void | ||
| 40 | print_help (void) | ||
| 41 | { | ||
| 42 | print_revision (progname, revision); | ||
| 43 | |||
| 44 | printf (_(COPYRIGHT), copyright, email); | ||
| 45 | |||
| 46 | printf (_("This program tests connections to a mysql server\n")); | ||
| 47 | |||
| 48 | print_usage (); | ||
| 49 | |||
| 50 | printf (_(UT_HELP_VRSN)); | ||
| 51 | |||
| 52 | printf (_(UT_HOST_PORT), 'P', atoi(MYSQL_PORT)); | ||
| 53 | |||
| 54 | printf (_("\ | ||
| 55 | -d, --database=STRING\n\ | ||
| 56 | Check database with indicated name\n\ | ||
| 57 | -u, --username=STRING\n\ | ||
| 58 | Connect using the indicated username\n\ | ||
| 59 | -p, --password=STRING\n\ | ||
| 60 | Use the indicated password to authenticate the connection\n\ | ||
| 61 | ==> IMPORTANT: THIS FORM OF AUTHENTICATION IS NOT SECURE!!! <==\n\ | ||
| 62 | Your clear-text password will be visible as a process table entry\n")); | ||
| 63 | |||
| 64 | printf (_("\n\ | ||
| 65 | There are no required arguments. By default, the local database with\n\ | ||
| 66 | a server listening on MySQL standard port %d will be checked\n"), MYSQL_PORT); | ||
| 67 | |||
| 68 | printf (_(UT_SUPPORT)); | ||
| 69 | } | ||
| 70 | |||
| 27 | char *db_user = ""; | 71 | char *db_user = ""; |
| 28 | char *db_host = ""; | 72 | char *db_host = ""; |
| 29 | char *db_pass = ""; | 73 | char *db_pass = ""; |
| 30 | char *db = ""; | 74 | char *db = ""; |
| 31 | unsigned int db_port = MYSQL_PORT; | ||
| 32 | 75 | ||
| 33 | int process_arguments (int, char **); | 76 | int process_arguments (int, char **); |
| 34 | int validate_arguments (void); | 77 | int validate_arguments (void); |
| 35 | void print_help (void); | ||
| 36 | void print_usage (void); | ||
| 37 | 78 | ||
| 38 | int | 79 | int |
| 39 | main (int argc, char **argv) | 80 | main (int argc, char **argv) |
| @@ -43,7 +84,7 @@ main (int argc, char **argv) | |||
| 43 | char result[1024]; | 84 | char result[1024]; |
| 44 | 85 | ||
| 45 | if (process_arguments (argc, argv) != OK) | 86 | if (process_arguments (argc, argv) != OK) |
| 46 | usage ("Invalid command arguments supplied\n"); | 87 | usage (_("Invalid command arguments supplied\n")); |
| 47 | 88 | ||
| 48 | /* initialize mysql */ | 89 | /* initialize mysql */ |
| 49 | mysql_init (&mysql); | 90 | mysql_init (&mysql); |
| @@ -154,7 +195,7 @@ process_arguments (int argc, char **argv) | |||
| 154 | db_host = optarg; | 195 | db_host = optarg; |
| 155 | } | 196 | } |
| 156 | else { | 197 | else { |
| 157 | usage ("Invalid host name\n"); | 198 | usage (_("Invalid host name\n")); |
| 158 | } | 199 | } |
| 159 | break; | 200 | break; |
| 160 | case 'd': /* hostname */ | 201 | case 'd': /* hostname */ |
| @@ -170,13 +211,13 @@ process_arguments (int argc, char **argv) | |||
| 170 | db_port = atoi (optarg); | 211 | db_port = atoi (optarg); |
| 171 | break; | 212 | break; |
| 172 | case 'V': /* version */ | 213 | case 'V': /* version */ |
| 173 | print_revision (progname, REVISION); | 214 | print_revision (progname, revision); |
| 174 | exit (STATE_OK); | 215 | exit (STATE_OK); |
| 175 | case 'h': /* help */ | 216 | case 'h': /* help */ |
| 176 | print_help (); | 217 | print_help (); |
| 177 | exit (STATE_OK); | 218 | exit (STATE_OK); |
| 178 | case '?': /* help */ | 219 | case '?': /* help */ |
| 179 | usage ("Invalid argument\n"); | 220 | usage (_("Invalid argument\n")); |
| 180 | } | 221 | } |
| 181 | } | 222 | } |
| 182 | 223 | ||
| @@ -215,50 +256,3 @@ validate_arguments (void) | |||
| 215 | { | 256 | { |
| 216 | return OK; | 257 | return OK; |
| 217 | } | 258 | } |
| 218 | |||
| 219 | |||
| 220 | |||
| 221 | |||
| 222 | |||
| 223 | void | ||
| 224 | print_help (void) | ||
| 225 | { | ||
| 226 | print_revision (progname, REVISION); | ||
| 227 | printf | ||
| 228 | ("Copyright (c) 2000 Didi Rieder/Karl DeBisschop\n\n" | ||
| 229 | "This plugin is for testing a mysql server.\n"); | ||
| 230 | print_usage (); | ||
| 231 | printf | ||
| 232 | ("\nThere are no required arguments. By default, the local database with\n" | ||
| 233 | "a server listening on MySQL standard port %d will be checked\n\n" | ||
| 234 | "Options:\n" | ||
| 235 | " -d, --database=STRING\n" | ||
| 236 | " Check database with indicated name\n" | ||
| 237 | " -H, --hostname=STRING or IPADDRESS\n" | ||
| 238 | " Check server on the indicated host\n" | ||
| 239 | " -P, --port=INTEGER\n" | ||
| 240 | " Make connection on the indicated port\n" | ||
| 241 | " -u, --username=STRING\n" | ||
| 242 | " Connect using the indicated username\n" | ||
| 243 | " -p, --password=STRING\n" | ||
| 244 | " Use the indicated password to authenticate the connection\n" | ||
| 245 | " ==> IMPORTANT: THIS FORM OF AUTHENTICATION IS NOT SECURE!!! <==\n" | ||
| 246 | " Your clear-text password will be visible as a process table entry\n" | ||
| 247 | " -h, --help\n" | ||
| 248 | " Print detailed help screen\n" | ||
| 249 | " -V, --version\n" " Print version information\n\n", MYSQL_PORT); | ||
| 250 | support (); | ||
| 251 | } | ||
| 252 | |||
| 253 | |||
| 254 | |||
| 255 | |||
| 256 | |||
| 257 | void | ||
| 258 | print_usage (void) | ||
| 259 | { | ||
| 260 | printf | ||
| 261 | ("Usage: %s [-d database] [-H host] [-P port] [-u user] [-p password]\n" | ||
| 262 | " %s --help\n" | ||
| 263 | " %s --version\n", progname, progname, progname); | ||
| 264 | } | ||
