Author: glen                         Date: Mon Jul 18 10:33:35 2005 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- patch fixing check_mysql -S

---- Files affected:
SOURCES:
   nagios-plugins-check_mysql-4.1.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/nagios-plugins-check_mysql-4.1.patch
diff -u /dev/null SOURCES/nagios-plugins-check_mysql-4.1.patch:1.1
--- /dev/null   Mon Jul 18 12:33:35 2005
+++ SOURCES/nagios-plugins-check_mysql-4.1.patch        Mon Jul 18 12:33:30 2005
@@ -0,0 +1,56 @@
+--- nagios-plugins-1.4/plugins/check_mysql.c   2004-12-26 01:17:44.000000000 
+0200
++++ nagios-plugins-HEAD-200507151647/plugins/check_mysql.c     2005-05-26 
05:13:19.000000000 +0300
+@@ -7,7 +7,7 @@
+ * Copyright (c) 1999 Didi Rieder ([EMAIL PROTECTED])
+ *  portions (c) 2000 Karl DeBisschop ([EMAIL PROTECTED])
+ * 
+-* $Id$
++* $Id$
+ *
+ * Description:
+ *
+@@ -15,7 +15,7 @@
+ 
******************************************************************************/
+ 
+ const char *progname = "check_mysql";
+-const char *revision = "$Revision$";
++const char *revision = "$Revision$";
+ const char *copyright = "1999-2004";
+ const char *email = "[EMAIL PROTECTED]";
+ 
+@@ -125,8 +125,33 @@
+ 
+               } else {
+                       /* mysql 4.x.x */
+-                      snprintf (slaveresult, SLAVERESULTSIZE, "Slave IO: %s 
Slave SQL: %s", row[9], row[10]);
+-                      if (strcmp (row[9], "Yes") != 0 || strcmp (row[10], 
"Yes") != 0) {
++                      int slave_io_field = -1 , slave_sql_field = -1, i, 
num_fields;
++                      MYSQL_FIELD* fields;
++
++                      num_fields = mysql_num_fields(res);
++                      fields = mysql_fetch_fields(res);
++                      for(i = 0; i < num_fields; i++)
++                      {
++                              if (0 == strcmp(fields[i].name, 
"Slave_IO_Running"))
++                              {
++                                      slave_io_field = i;
++                                      continue;
++                              }
++                              if (0 == strcmp(fields[i].name, 
"Slave_SQL_Running"))
++                              {
++                                      slave_sql_field = i;
++                                      continue;
++                              }
++                      }
++                      if ((slave_io_field < 0) || (slave_sql_field < 0) || 
(num_fields == 0))
++                      {
++                              mysql_free_result (res);
++                              mysql_close (&mysql);
++                              die (STATE_CRITICAL, "Slave status 
unavailable\n");
++                      }
++                       
++                      snprintf (slaveresult, SLAVERESULTSIZE, "Slave IO: %s 
Slave SQL: %s", row[slave_io_field], row[slave_sql_field]);
++                      if (strcmp (row[slave_io_field], "Yes") != 0 || strcmp 
(row[slave_sql_field], "Yes") != 0) {
+                               mysql_free_result (res);
+                               mysql_close (&mysql);
+                               die (STATE_CRITICAL, "%s\n", slaveresult);
================================================================
_______________________________________________
pld-cvs-commit mailing list
pld-cvs-commit@lists.pld-linux.org
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to