summaryrefslogtreecommitdiffstats
path: root/web/attachments/406534-nagiosplug_mysql.diff
diff options
context:
space:
mode:
Diffstat (limited to 'web/attachments/406534-nagiosplug_mysql.diff')
-rw-r--r--web/attachments/406534-nagiosplug_mysql.diff74
1 files changed, 74 insertions, 0 deletions
diff --git a/web/attachments/406534-nagiosplug_mysql.diff b/web/attachments/406534-nagiosplug_mysql.diff
new file mode 100644
index 0000000..991ce1a
--- /dev/null
+++ b/web/attachments/406534-nagiosplug_mysql.diff
@@ -0,0 +1,74 @@
1diff --git a/REQUIREMENTS b/REQUIREMENTS
2index fd41ded..33c5eb9 100644
3--- a/REQUIREMENTS
4+++ b/REQUIREMENTS
5@@ -36,10 +36,9 @@ check_ldap:
6
7 check_mysql, check_mysql_query:
8 - Requires the MySQL libraries available from
9- http://www.mysql.org/
10+ http://dev.mysql.com/downloads/
11 Lib: libmysql, libmysqlclient
12- Redhat Powertools Source: mysql-3.20.32a-3.i386.rpm, mysql-devel-3.20.32a-3.i386.rpm (these seem to be broken, however)
13- RPMS from www.mysql.org work better
14+ Redhat Source (RHEL6, YUM): mysql-devel, mysql-libs
15 Must have mysql_config in PATH or specified with --with-mysql=DIR for DIR/bin/mysql_config
16
17 check_pqsql:
18diff --git a/plugins/check_mysql.c b/plugins/check_mysql.c
19index d9b4e53..0dfb1fd 100644
20--- a/plugins/check_mysql.c
21+++ b/plugins/check_mysql.c
22@@ -5,7 +5,7 @@
23 * License: GPL
24 * Copyright (c) 1999 Didi Rieder (adrieder@sbox.tu-graz.ac.at)
25 * Copyright (c) 2000 Karl DeBisschop (kdebisschop@users.sourceforge.net)
26-* Copyright (c) 1999-2009 Nagios Plugins Development Team
27+* Copyright (c) 1999-2011 Nagios Plugins Development Team
28 *
29 * Description:
30 *
31@@ -31,7 +31,7 @@
32 *****************************************************************************/
33
34 const char *progname = "check_mysql";
35-const char *copyright = "1999-2007";
36+const char *copyright = "1999-2011";
37 const char *email = "nagiosplug-devel@lists.sourceforge.net";
38
39 #define SLAVERESULTSIZE 70
40@@ -157,7 +157,7 @@ main (int argc, char **argv)
41 }
42
43 } else {
44- /* mysql 4.x.x */
45+ /* mysql 4.x.x and mysql 5.x.x */
46 int slave_io_field = -1 , slave_sql_field = -1, seconds_behind_field = -1, i, num_fields;
47 MYSQL_FIELD* fields;
48
49@@ -178,13 +178,17 @@ main (int argc, char **argv)
50 }
51 }
52
53+ /* Check if slave status is available */
54 if ((slave_io_field < 0) || (slave_sql_field < 0) || (num_fields == 0)) {
55 mysql_free_result (res);
56 mysql_close (&mysql);
57 die (STATE_CRITICAL, "Slave status unavailable\n");
58 }
59
60+ /* Save slave status in slaveresult */
61 snprintf (slaveresult, SLAVERESULTSIZE, "Slave IO: %s Slave SQL: %s Seconds Behind Master: %s", row[slave_io_field], row[slave_sql_field], seconds_behind_field!=-1?row[seconds_behind_field]:"Unknown");
62+
63+ /* Raise critical error if SQL THREAD or IO THREAD are stopped */
64 if (strcmp (row[slave_io_field], "Yes") != 0 || strcmp (row[slave_sql_field], "Yes") != 0) {
65 mysql_free_result (res);
66 mysql_close (&mysql);
67@@ -199,6 +203,7 @@ main (int argc, char **argv)
68 }
69 }
70
71+ /* Check Seconds Behind against threshold */
72 if ((seconds_behind_field != -1) && (strcmp (row[seconds_behind_field], "NULL") != 0)) {
73 double value = atof(row[seconds_behind_field]);
74 int status;