Saturday, August 19, 2006
Saturday, August 05, 2006
Mysql Replication check for Nagios
Many a times I had faced issues with MySQL replication breaking off due to network problem or system related problem. And most of the time by the time I get to know of these kind of problems it would be late. So I had developed a piece of code for Nagios to alert me when ever the replication has any trouble. Below is the code snippet from the check_repl script I developed for monitoring the replication check on a single master single slave setup.
#!/bin/sh
###################################################################
# The script is a plugin for nagios. The script is used to check
# the replication status between the Master and Slave. The script
# has to be executed from the master.
# Written by : Jithesh M K
# Created on : July, 2006
# Updates on : ###################################################################
# Nagios alert status
STATE_OK=0
STATE_WARNING=1
STATE_CRITICAL=2
STATE_UNKNOWN=3
STATE_DEPENDENT=4
# Script Variables
SLAVEIP_1= # IP Address of the slave
REPLUSERNAME=nagios # User who has power to query 'show master status' and 'show slave status'
REPLPASSWD=nagios
CRITICAL_VALUE=1000
WARNING_VALUE=500
iSlave_1=`mysql -h $SLAVEIP_1 -u $REPLUSERNAME -p$REPLPASSWD -e "show slave status" | grep bin | cut -f7`
iMaster=`mysql -u $REPLUSERNAME -p$REPLPASSWD -e "show master status" | grep bin | cut -f2`
iDiff_1=`expr $iMaster - $iSlave_1`
echo "Master Log Position : "$iMaster" 1st Slave Log Position : "$iSlave_1 " Difference : "$iDiff_1
if [ $iDiff_1 -gt $CRITICAL_VALUE ]
then
exit $STATE_CRITICAL
elif [ $iDiff_1 -gt $WARNING_VALUE ]
then
exit $STATE_WARNING
else
exit $STATE_OK
fi
#!/bin/sh
###################################################################
# The script is a plugin for nagios. The script is used to check
# the replication status between the Master and Slave. The script
# has to be executed from the master.
# Written by : Jithesh M K
# Created on : July, 2006
# Updates on : ###################################################################
# Nagios alert status
STATE_OK=0
STATE_WARNING=1
STATE_CRITICAL=2
STATE_UNKNOWN=3
STATE_DEPENDENT=4
# Script Variables
SLAVEIP_1= # IP Address of the slave
REPLUSERNAME=nagios # User who has power to query 'show master status' and 'show slave status'
REPLPASSWD=nagios
CRITICAL_VALUE=1000
WARNING_VALUE=500
iSlave_1=`mysql -h $SLAVEIP_1 -u $REPLUSERNAME -p$REPLPASSWD -e "show slave status" | grep bin | cut -f7`
iMaster=`mysql -u $REPLUSERNAME -p$REPLPASSWD -e "show master status" | grep bin | cut -f2`
iDiff_1=`expr $iMaster - $iSlave_1`
echo "Master Log Position : "$iMaster" 1st Slave Log Position : "$iSlave_1 " Difference : "$iDiff_1
if [ $iDiff_1 -gt $CRITICAL_VALUE ]
then
exit $STATE_CRITICAL
elif [ $iDiff_1 -gt $WARNING_VALUE ]
then
exit $STATE_WARNING
else
exit $STATE_OK
fi
Pirates of the Caribbean: Dead Man's Chest

I saw the movie Pirates of the Caribbean: Dead Man's Chest at Inox. As usual Johnny Deep as Capt. Jack Sparrow was amazing in the sequel. I strongly believe that they have filmed back-to-back with Pirates of the Caribbean 3. The film is pretty good but I prefered the first one.
Subscribe to:
Posts (Atom)
