[Pkg-nagios-devel] Bug#278864: marked as done (check_mysql should be able to slave status)

Debian Bug Tracking System owner at bugs.debian.org
Thu Oct 13 10:03:25 UTC 2005


Your message dated Thu, 13 Oct 2005 02:47:09 -0700
with message-id <E1EPzg5-0007Xr-00 at spohr.debian.org>
and subject line Bug#278864: fixed in nagios-plugins 1.4.2-3
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--------------------------------------
Received: (at submit) by bugs.debian.org; 29 Oct 2004 20:04:41 +0000
>From ian at penguinhosting.net Fri Oct 29 13:04:41 2004
Return-path: <ian at penguinhosting.net>
Received: from dev.coresense.com (coresense.com) [216.130.239.171] 
	by spohr.debian.org with esmtp (Exim 3.35 1 (Debian))
	id 1CNczJ-0006Up-00; Fri, 29 Oct 2004 13:04:41 -0700
Received: by coresense.com (Postfix, from userid 1000)
	id A1981E6B31; Fri, 29 Oct 2004 16:03:51 -0400 (EDT)
Date: Fri, 29 Oct 2004 16:03:51 -0400
From: Ian Gulliver <ian at penguinhosting.net>
To: submit at bugs.debian.org
Cc: fsmith at coresense.com
Subject: check_mysql should be able to slave status
Message-ID: <20041029200348.GC2346 at penguinhosting.net>
Mime-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="VACxsDaSTfeluoxK"
Content-Disposition: inline
X-Operating-System: Linux puck 2.6.8-1-686 
User-Agent: Mutt/1.5.6+20040722i
Delivered-To: submit at bugs.debian.org
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2004_03_25 
	(1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Status: No, hits=-3.0 required=4.0 tests=BAYES_00 autolearn=no 
	version=2.60-bugs.debian.org_2004_03_25
X-Spam-Level: 


--VACxsDaSTfeluoxK
Content-Type: multipart/mixed; boundary="1Y7d0dPL928TPQbc"
Content-Disposition: inline


--1Y7d0dPL928TPQbc
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Package: nagios-plugins
Version: 1.3.1.0-12
Severity: wishlist
Tags: patch

It would be useful if check_mysql could check the current status of
replication from either the master or slave perspective.  If replication
breaks currently, even if both ends are monitored, check_mysql will not
notice the problem and will not generate a nagios alert.

Attached is a patch that adds -s/--slave (master perspective, takes a
slave --report-host name) and -S/--slave-io (slave perspective, takes a
database name that is being replicated) flags to check_mysql.

--=20
Ian Gulliver
Penguin Hosting
"Failure is not an option; it comes bundled with your Microsoft products."

--1Y7d0dPL928TPQbc
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="nagios-plugins-1.3.1.0-checkslave.patch"
Content-Transfer-Encoding: quoted-printable

diff -udr nagios-plugins-1.3.1.0/plugins/check_mysql.c nagios-plugins-1.3.1=
=2E0-checkslave/plugins/check_mysql.c
--- nagios-plugins-1.3.1.0/plugins/check_mysql.c	2003-02-10 19:47:47.000000=
000 -0500
+++ nagios-plugins-1.3.1.0-checkslave/plugins/check_mysql.c	2004-10-29 15:5=
3:54.000000000 -0400
@@ -30,6 +30,9 @@
 char *db =3D "";
 unsigned int db_port =3D MYSQL_PORT;
=20
+char *slave =3D NULL;
+char *slave_io =3D NULL;
+
 int process_arguments (int, char **);
 int validate_arguments (void);
 void print_help (void);
@@ -107,6 +110,77 @@
=20
 	}
=20
+	if (slave !=3D NULL) {
+		MYSQL_ROW row;
+		MYSQL_RES *result;
+		int found =3D 0;
+
+		if (mysql_query(&mysql,"SHOW SLAVE HOSTS;") !=3D 0) {
+			printf("%s\n", mysql_error(&mysql));
+			return STATE_CRITICAL;
+		}
+
+		result =3D mysql_store_result(&mysql);
+		if (result =3D=3D NULL) {
+			printf("%s\n", mysql_error(&mysql));
+			return STATE_CRITICAL;
+		}
+
+		while ((row =3D mysql_fetch_row(result))) {
+			if (strcmp(row[1],slave) =3D=3D 0) {
+				printf("Slave %s is running.\n",row[1]);
+				found =3D 1;
+				break;
+			}
+		}
+
+		mysql_free_result(result);
+
+		if (found =3D=3D 0) {
+			printf("Slave %s is not running.\n",slave);
+			return STATE_CRITICAL;
+		}
+	}
+
+	if (slave_io !=3D NULL) {
+		MYSQL_ROW row;
+		MYSQL_RES *result;
+		int found =3D 0;
+
+		if (mysql_query(&mysql,"SHOW SLAVE STATUS;") !=3D 0) {
+			printf("%s\n", mysql_error(&mysql));
+			return STATE_CRITICAL;
+		}
+
+		result =3D mysql_store_result(&mysql);
+		if (result =3D=3D NULL) {
+			printf("%s\n", mysql_error(&mysql));
+			return STATE_CRITICAL;
+		}
+
+		while ((row =3D mysql_fetch_row(result))) {
+			if (strcmp(row[11],slave_io) =3D=3D 0) {
+				if (strcmp(row[9],"Yes") =3D=3D 0) {
+					found =3D 1;
+					printf("Slave I/O for database %s is running.\n",row[11]);
+				} else {
+					found =3D 2;
+					printf("Slave I/O for database %s is not running.\n",row[11]);
+				}
+				break;
+			}
+		}
+
+		mysql_free_result(result);
+
+		if (found =3D=3D 2) {
+			return STATE_CRITICAL;
+		} else if (found =3D=3D 0) {
+			printf("Slave I/O for database %s is not configure.\n",slave_io);
+			return STATE_CRITICAL;
+		}
+	}
+
 	/* close the connection */
 	mysql_close (&mysql);
=20
@@ -137,6 +211,8 @@
 		{"verbose", no_argument, 0, 'v'},
 		{"version", no_argument, 0, 'V'},
 		{"help", no_argument, 0, 'h'},
+		{"slave", required_argument, 0, 's'},
+		{"slave-io", required_argument, 0, 'S'},
 		{0, 0, 0, 0}
 	};
 #endif
@@ -147,9 +223,9 @@
 	while (1) {
 #ifdef HAVE_GETOPT_H
 		c =3D
-			getopt_long (argc, argv, "hVP:p:u:d:H:", long_options, &option_index);
+			getopt_long (argc, argv, "hVP:p:u:d:H:s:S:", long_options, &option_inde=
x);
 #else
-		c =3D getopt (argc, argv, "hVP:p:u:d:H:");
+		c =3D getopt (argc, argv, "hVP:p:u:d:H:s:S:");
 #endif
=20
 		if (c =3D=3D -1 || c =3D=3D EOF)
@@ -182,6 +258,12 @@
 		case 'h':									/* help */
 			print_help ();
 			exit (STATE_OK);
+		case 's':
+			slave =3D optarg;
+			break;
+		case 'S':
+			slave_io =3D optarg;
+			break;
 		case '?':									/* help */
 			usage ("Invalid argument\n");
 		}
@@ -251,6 +333,12 @@
 		 "   Use the indicated password to authenticate the connection\n"
 		 "   =3D=3D> IMPORTANT: THIS FORM OF AUTHENTICATION IS NOT SECURE!!! <=
=3D=3D\n"
 		 "   Your clear-text password will be visible as a process table entry\n"
+		 " -s, --slave=3DSTRING\n"
+		 "   Check that the indicated slave host is running\n"
+		 "   (requires REPLICATION SLAVE privilege)\n"
+		 " -S, --slave-io=3DSTRING\n"
+		 "   Check that slave I/O is running for the indicated database\n"
+		 "   (requires REPLICATION CLIENT privilege)\n"
 		 " -h, --help\n"
 		 "    Print detailed help screen\n"
 		 " -V, --version\n" "    Print version information\n\n", MYSQL_PORT);
@@ -265,7 +353,7 @@
 print_usage (void)
 {
 	printf
-		("Usage: %s [-d database] [-H host] [-P port] [-u user] [-p password]\n"
+		("Usage: %s [-d database] [-H host] [-P port] [-u user] [-p password] [-=
s slavename] [-S database]\n"
 		 "       %s --help\n"
 		 "       %s --version\n", progname, progname, progname);
 }

--1Y7d0dPL928TPQbc--

--VACxsDaSTfeluoxK
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFBgqIkefI+qeoOjxURArDdAJ9DEYtoVFF1AzmVVogoV1cW9CcNUgCePvg2
66X+LBfjNEUBIqlaetr1gD4=
=acba
-----END PGP SIGNATURE-----

--VACxsDaSTfeluoxK--

---------------------------------------
Received: (at 278864-close) by bugs.debian.org; 13 Oct 2005 09:47:54 +0000
>From katie at spohr.debian.org Thu Oct 13 02:47:54 2005
Return-path: <katie at spohr.debian.org>
Received: from katie by spohr.debian.org with local (Exim 3.36 1 (Debian))
	id 1EPzg5-0007Xr-00; Thu, 13 Oct 2005 02:47:09 -0700
From: sean finney <seanius at debian.org>
To: 278864-close at bugs.debian.org
X-Katie: $Revision: 1.56 $
Subject: Bug#278864: fixed in nagios-plugins 1.4.2-3
Message-Id: <E1EPzg5-0007Xr-00 at spohr.debian.org>
Sender: Archive Administrator <katie at spohr.debian.org>
Date: Thu, 13 Oct 2005 02:47:09 -0700
Delivered-To: 278864-close at bugs.debian.org
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2005_01_02 
	(1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Level: 
X-Spam-Status: No, hits=-6.0 required=4.0 tests=BAYES_00,HAS_BUG_NUMBER 
	autolearn=no version=2.60-bugs.debian.org_2005_01_02

Source: nagios-plugins
Source-Version: 1.4.2-3

We believe that the bug you reported is fixed in the latest version of
nagios-plugins, which is due to be installed in the Debian FTP archive:

nagios-plugins_1.4.2-3.diff.gz
  to pool/main/n/nagios-plugins/nagios-plugins_1.4.2-3.diff.gz
nagios-plugins_1.4.2-3.dsc
  to pool/main/n/nagios-plugins/nagios-plugins_1.4.2-3.dsc
nagios-plugins_1.4.2-3_i386.deb
  to pool/main/n/nagios-plugins/nagios-plugins_1.4.2-3_i386.deb



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 278864 at bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
sean finney <seanius at debian.org> (supplier of updated nagios-plugins package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster at debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.7
Date: Tue, 11 Oct 2005 10:14:18 +0200
Source: nagios-plugins
Binary: nagios-plugins
Architecture: source i386
Version: 1.4.2-3
Distribution: unstable
Urgency: low
Maintainer: seanius at debian.org
Changed-By: sean finney <seanius at debian.org>
Description: 
 nagios-plugins - Plugins for the nagios network monitoring and management system
Closes: 278864 285554 296278 296600 300701 307905 309255 309673
Changes: 
 nagios-plugins (1.4.2-3) unstable; urgency=low
 .
   * Sean Finney:
     - include fix from Modesto Alexandre to correct paths in check_log
       (closes: #296600).
     - looks like upstream's check_mrtg has been broken for a while now.
       now including a fix that i'll eventually move upstream.
       (closes: #309673).
     - include a fix to check_smtp to make it speak proper ehlo before
       issueing a starttls command, and also check that the server
       actually supports it before blindly continuing.  thanks to
       Jeroen van Wolffelaar for taking the time to point out the
       details (closes: #285554).
     - in the process of the above, also figured out how to get
       check_smtp to play nicely with gnutls-based servers.
     - check_disk once again will match non-mountpoint directories to
       the closest parent mountpoint (closes: #296278).
     - include jeroen's "less beastly" check_ntp sys.peer regex.
     - fix for braindead command-line option parsing for freespace
       in check_disk_smb (closes: #300701).
     - updated the usage function in check_game to reflect changed
       cmdline options (closes: #307905).
     - upstream is now shipping an non-broken ipv6-capable check_ping,
       with PING6_COMMAND properly set in config.h (closes: #309255).
     - upstream check_mysql can now check slave status (closes: #278864).
Files: 
 7766e68631fe0cf7c0f64e2cef5132d1 959 net extra nagios-plugins_1.4.2-3.dsc
 3a099ad7388c38c8a952fc66eda278fa 34971 net extra nagios-plugins_1.4.2-3.diff.gz
 75108ddbd441d34df2ad61063101f386 355684 net extra nagios-plugins_1.4.2-3_i386.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFDTirrynjLPm522B0RAorGAJ9Ecxq94f/MFeRM3fKPBfOxaYHgeQCdFfXg
BDEEfkgcgepf3QhCffDjGOw=
=Ew24
-----END PGP SIGNATURE-----




More information about the Pkg-nagios-devel mailing list