Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Feb 2005 16:23:08 +0100
From:      Gerrit Beine <tux@pinguru.net>
To:        blaz@si.FreeBSD.org
Cc:        ports@FreeBSD.org
Subject:   Re: FreeBSD Port: nagios-plugins-1.4,1
Message-ID:  <4218AB5C.7000302@pinguru.net>
In-Reply-To: <42186A5C.9080108@gmx.de>
References:  <42186A5C.9080108@gmx.de>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------090007070201030006010109
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Gerrit Beine wrote:
> Hi,
> 
After taking a look into MySQL manual I changed the patch.
MySQL 4.0.x and MySQL 4.1.0 have only 16 columns in SHOW SLAVE STATUS,
MySQL 4.1.1 and greater 33 columns. So it is possible to switch between
the versions.

So long...

Gerrit

--------------090007070201030006010109
Content-Type: text/plain;
 name="patch-check_mysql.c"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="patch-check_mysql.c"

--- plugins/check_mysql.c.orig	Sun Dec 26 00:17:44 2004
+++ plugins/check_mysql.c	Sun Feb 20 14:12:10 2005
@@ -123,8 +123,16 @@
 				die (STATE_CRITICAL, "%s\n", slaveresult);
 			}
 
+		} else if (mysql_field_count (&mysql) == 33) {
+			/* mysql >= 4.1.1 */
+			snprintf (slaveresult, SLAVERESULTSIZE, "Slave IO: %s Slave SQL: %s", row[10], row[11]);
+			if (strcmp (row[10], "Yes") != 0 || strcmp (row[11], "Yes") != 0) {
+				mysql_free_result (res);
+				mysql_close (&mysql);
+				die (STATE_CRITICAL, "%s\n", slaveresult);
+			}
 		} else {
-			/* mysql 4.x.x */
+			/* mysql 4.0.x or 4.1.0 */
 			snprintf (slaveresult, SLAVERESULTSIZE, "Slave IO: %s Slave SQL: %s", row[9], row[10]);
 			if (strcmp (row[9], "Yes") != 0 || strcmp (row[10], "Yes") != 0) {
 				mysql_free_result (res);

--------------090007070201030006010109--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4218AB5C.7000302>