summaryrefslogtreecommitdiffstats
path: root/web/attachments/112910-check_mysql_slave
diff options
context:
space:
mode:
Diffstat (limited to 'web/attachments/112910-check_mysql_slave')
-rw-r--r--web/attachments/112910-check_mysql_slave25
1 files changed, 25 insertions, 0 deletions
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 @@
1#!/bin/sh
2#
3# Check that a mysql-slave is running
4#
5# usage: check_mysql_slave host user password
6#
7# @author peter.romianowski@optivo.net
8# @version 1.0 19.12.2004
9
10IO=`mysql -h$1 -u$2 -p$3 -B -e "SHOW SLAVE STATUS" | cut -f 10 | tr "\n" " "`
11
12if [ "$IO" != "Slave_IO_Running Yes " ] ; then
13 echo "CRITICAL Slave IO-Thread is not running (response was: $IO)"
14 exit 1
15fi
16
17SQL=`mysql -h$1 -u$2 -p$3 -B -e "SHOW SLAVE STATUS" | cut -f 11 | tr "\n" " "`
18
19if [ "$SQL" != "Slave_SQL_Running Yes " ] ; then
20 echo "CRITICAL Slave SQL-Thread is not running (response was: $SQL)"
21 exit 2
22fi
23
24echo "OK Slave IO- and SQL-Thread are running"
25exit 0 \ No newline at end of file