From 0b6423f9c99d9edf8c96fefd0f6c453859395aa1 Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Mon, 30 Sep 2013 00:03:24 +0200 Subject: Import Nagios Plugins site Import the Nagios Plugins web site, Cronjobs, infrastructure scripts, and configuration files. --- web/attachments/112910-check_mysql_slave | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 web/attachments/112910-check_mysql_slave (limited to 'web/attachments/112910-check_mysql_slave') diff --git a/web/attachments/112910-check_mysql_slave b/web/attachments/112910-check_mysql_slave new file mode 100644 index 0000000..9b1e3c8 --- /dev/null +++ b/web/attachments/112910-check_mysql_slave @@ -0,0 +1,25 @@ +#!/bin/sh +# +# Check that a mysql-slave is running +# +# usage: check_mysql_slave host user password +# +# @author peter.romianowski@optivo.net +# @version 1.0 19.12.2004 + +IO=`mysql -h$1 -u$2 -p$3 -B -e "SHOW SLAVE STATUS" | cut -f 10 | tr "\n" " "` + +if [ "$IO" != "Slave_IO_Running Yes " ] ; then + echo "CRITICAL Slave IO-Thread is not running (response was: $IO)" + exit 1 +fi + +SQL=`mysql -h$1 -u$2 -p$3 -B -e "SHOW SLAVE STATUS" | cut -f 11 | tr "\n" " "` + +if [ "$SQL" != "Slave_SQL_Running Yes " ] ; then + echo "CRITICAL Slave SQL-Thread is not running (response was: $SQL)" + exit 2 +fi + +echo "OK Slave IO- and SQL-Thread are running" +exit 0 \ No newline at end of file -- cgit v1.2.3-74-g34f1