diff options
Diffstat (limited to 'contrib/check_mysql.c')
-rw-r--r-- | contrib/check_mysql.c | 75 |
1 files changed, 0 insertions, 75 deletions
diff --git a/contrib/check_mysql.c b/contrib/check_mysql.c deleted file mode 100644 index 56725dc4..00000000 --- a/contrib/check_mysql.c +++ /dev/null | |||
@@ -1,75 +0,0 @@ | |||
1 | /***************************************************************** | ||
2 | * | ||
3 | * Program: check_mysql.c | ||
4 | * License: GPL | ||
5 | * | ||
6 | * Written by Tim Weippert | ||
7 | * (based on plugins by Ethan Galstad and MySQL example code) | ||
8 | * | ||
9 | * Command line: check_mysql <host> [user] [passwd] | ||
10 | * <host> can be the FQDN or the IP-Adress | ||
11 | * [user] and [passwd] are optional | ||
12 | * | ||
13 | * Description: | ||
14 | * | ||
15 | * This plugin attempts to connect to an MySQL Server | ||
16 | * with the optional specified parameters user and passwd. | ||
17 | * Normaly the host and a user HAVE to assigned. | ||
18 | * | ||
19 | * The plugin returns | ||
20 | * STATE_OK and the Version Number of the Server when all is fine | ||
21 | * STATE_CRITICAL if the Connection can't be esablished | ||
22 | * STATE_WARNING if the connection was established but the | ||
23 | * program can't get the Versoin Number | ||
24 | * STATE_UNKNOWN if to many parameters are given | ||
25 | * | ||
26 | * Copyright (c) 1999 by Tim Weippert | ||
27 | * | ||
28 | * Changes: | ||
29 | * 16.12.1999: Changed the return codes from numbers to statements | ||
30 | * | ||
31 | *******************************************************************/ | ||
32 | |||
33 | #include "config.h" | ||
34 | #include "common.h" | ||
35 | #include "mysql.h" | ||
36 | |||
37 | MYSQL mysql; | ||
38 | |||
39 | int main(int argc, char **argv) | ||
40 | { | ||
41 | uint i = 0; | ||
42 | char *host; | ||
43 | char *user; | ||
44 | char *passwd; | ||
45 | |||
46 | char *status; | ||
47 | char *version; | ||
48 | |||
49 | if ( argc > 4 ) { | ||
50 | printf("Too many Arguments supplied - %i .\n", argc); | ||
51 | printf("Usage: %s <host> [user] [passwd]\n", argv[0]); | ||
52 | return STATE_UNKNOWN; | ||
53 | } | ||
54 | |||
55 | (host = argv[1]) || (host = NULL); | ||
56 | (user = argv[2]) || (user = NULL); | ||
57 | (passwd = argv[3]) || (passwd = NULL); | ||
58 | |||
59 | if (!(mysql_connect(&mysql,host,user,passwd))) { | ||
60 | printf("Can't connect to Mysql on Host: %s\n", host); | ||
61 | return STATE_CRITICAL; | ||
62 | } | ||
63 | |||
64 | if ( !(version = mysql_get_server_info(&mysql)) ) { | ||
65 | printf("Connect OK, but can't get Serverinfo ... something wrong !\n"); | ||
66 | return STATE_WARNING; | ||
67 | } | ||
68 | |||
69 | printf("Mysql ok - Running Version: %s\n", version); | ||
70 | |||
71 | mysql_close(&mysql); | ||
72 | return STATE_OK; | ||
73 | } | ||
74 | |||
75 | |||