HEX
Server: Apache
System: Linux server.y-p01.co.uk 3.10.0-1160.144.1.el7.tuxcare.els3.x86_64 #1 SMP Fri Mar 6 13:52:53 UTC 2026 x86_64
User: calderca (1008)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: //usr/bin/emagmon
#!/bin/bash
# Copyright (c) 2013, Alex Parker
# All rights reserved.
CURRENTVERSION=1508201601
##################################################################
## Define  program functions
##################################################################

## MegaSAS|MegaRAID RAID detais
megasasinfo()
{

CONT="a0"
if [ -f '/usr/local/sbin/megacli' ]; then
MEGACLI='/usr/local/sbin/megacli'
elif [ -f '/opt/MegaRAID/MegaCli/MegaCli64'  ]; then
MEGACLI="/opt/MegaRAID/MegaCli/MegaCli64"
else
MEGACLI="";
fi
if [ ! -z $MEGACLI ] ; then
if [ $1 == "status" ]; then
rstatus=`$MEGACLI -ldinfo -Lall -aall |grep State |grep State | grep -v Optimal|wc -l`
if [ "$rstatus" -eq 0 ]; then
echo "Optimal";
else
echo "Degraded";
fi

elif [ $1 == "details" ]; then
for a in $CONT
do
echo "===================RAID Controller Information=============================" > $log
$MEGACLI -AdpAllInfo -a0 |egrep "Product Name|Serial No|Virtual Drives|Degraded|Disks|Failed Disks" >> $log
echo "===================Virtual Logical Drive information ==========================="  >> $log
$MEGACLI -LDInfo -Lall -aALL -NoLog |egrep 'Virtual Drive|RAID Level|Size|Mirror Data|State|Strip Size|Number Of Drives per span|Span Depth' >> $log
echo "===================RAID Rebuild Status ===================================" >> $log
$MEGACLI -LDCC -ShowProg -LALL -aALL -NoLog >> $log
ENCDRIVE=`$MEGACLI -PDlist -aALL -NoLog  | egrep 'Enclosure Device|Slot|state' | awk '/Slot/{if (x)print x;x="";}{x=(!x)?$0:x" -"$0;}END{print x;}' | sed 's/Firmware state://g' | egrep build | awk '{print $3}'`
if [ $ENCDRIVE ];then
ENCID=`$MEGACLI -PDlist -aALL | grep "Enclosure Device" |uniq |awk '{print $4}'`
$MEGACLI -PDRbld -ShowProg -PhysDrv [$ENCID:$ENCDRIVE] -a0 -NoLog >> $log
fi
echo "===================Phyical HDD information ================================" >> $log
$MEGACLI -PDlist -aALL -NoLog |awk '/Device Id/ { counter += 1; device[counter] = $3 }  /Raw Size/ { raw_size[counter] = $3 $4 } /Firmware state/ { state_drive[counter] = $3 } /Inquiry/ { name_drive[counter] = $3 " " $4 " " $5 " " $6 }  END { for (i=1; i<=counter; i+=1) printf ( "Device %02d (%s) [%s] status is: %s \n", device[i] ,name_drive[i],raw_size[i], state_drive[i]); }' >> $log
echo "=====================================================================" >> $log
awk 'BEGIN{ORS="<br>"}1' $log
done
elif [ $1 == "hdds" ]; then
$MEGACLI -PDlist -aALL -NoLog  |awk '/PD Type/ { counter += 1; type[counter] = $3 }  /Raw Size/ { raw_size[counter] = $3 " " $4 } /Inquiry Data:/ { (make_drive[counter] = $3) (model_drive[counter] = $4) (serial_drive[counter] = $5) }  END { printf("<root>"); for (i=1; i<=counter; i+=1) printf ( "<hdd><make>%s</make><model>%s</model><serial>%s</serial><size>%s</size><pdtype>%s</pdtype></hdd>\n",make_drive[i],model_drive[i],serial_drive[i],raw_size[i],type[i],name_drive[i], state_drive[i]); printf("</root>"); }'
else
echo "Blank"
fi
fi
}
## Find RAID Controller 
findraid()
{
if [[ `/sbin/lspci |grep -E 'MegaSAS|MegaRAID|Dell PowerEdge Expandable RAID controller 5'|wc -l` -gt 0 ]] ; then
if [ -f '/usr/local/sbin/megacli' ] ||  [ -f '/usr/sbin/megacli' ] || [ -f '/opt/MegaRAID/MegaCli/MegaCli64' ];then
megasasinfo $1
elif [ -f '/usr/sbin/megasasctl' ];then
megasasctl $1
fi
elif  [[ `/sbin/lspci |grep -E 'SAS1068E|SAS1064ET'` =~ "SAS106" ]] ; then
if [ `command -v mpt-status` ];then
mptinfo $1
fi
elif  [[ `/sbin/lspci |grep -E '3ware'` =~ "3ware" ]] ; then
if [ `command -v tw_cli` ];then
twinfo $1
fi
#elif [[ `/sbin/lspci |grep -E 'Hewlett-Packard Company Smart Array'` =~ "Smart Array" ]] ; then
elif [[ `/sbin/lspci | grep RAID |grep -E 'Hewlett-Packard Company Smart Array|Series/C200|Series/C220'|wc -l` -gt 0 ]] ;then
if [ `command -v hpacucli` ];then
hpacuinfo $1
fi
elif  [[ `/sbin/lspci |grep -E 'AAC-RAID|Adaptec Series 6'` =~ "Adaptec" ]] ; then
if [ -f '/usr/StorMan/arcconf' ];then
arcinfo $1
fi
elif [[ `/sbin/lspci |grep -E 'SAS2008|SAS2308|SAS3008'|wc -l` -gt 0 ]] ; then
if [ `command -v sas2ircu` ];then
sas2ircuinfo $1
fi
elif  [ `/bin/grep ^md -c /proc/mdstat` -gt 0 ] ; then
if [ -f '/proc/mdstat' ];then
softraid $1
fi
else
echo "RAID Controller on `hostname` server is diffrent`/sbin/lspci |grep Logic`"
fi
}


hpacuinfo()
{
if [ `command -v hpacucli` ];then
slotid=`hpacucli controller all  show config detail |grep Slot: |cut -d: -f2|tr -d ' '|head -1`
if [ $1 == "details" ] ; then
echo "===================Logical Volume Details======================================================" > $log
hpacucli ctrl slot=$slotid show status >> $log
echo "===================Physical HDD Details========================================================" >> $log
hpacucli controller slot=$slotid pd all show status  >> $log
echo "===============================================================================================" >> $log
awk 'BEGIN{ORS="<br>"}1' $log
elif [ $1 == "status" ] ; then
rstatus=`hpacucli ctrl slot=$slotid show status |grep -E 'Controller Status:' |awk '{print $3}'`
if [ "$rstatus" == "OK"  ]; then
echo "Optimal";
else
echo "Degraded";
fi
elif [ $1 == "hdds" ] ; then
 hpacucli controller slot=$slotid pd all show detail |awk '/Serial Number:/ { counter += 1; serial_drive[counter] = $3 }  /Size/ { raw_size[counter] = $2 " " $3 } /Model/ { (make_drive[counter] = $2) (model_drive[counter] = $3)} /Interface Type:/ { type[counter] = $3 }  END { printf("\n<root>"); for (i=1; i<=counter; i+=1) printf ( "<hdd><make>%s</make><model>%s</model><serial>%s</serial><size>%s</size><pdtype>%s</pdtype></hdd>\n",make_drive[i],model_drive[i],serial_drive[i],raw_size[i],type[i],name_drive[i]); printf("</root>"); }'
else
echo ""
fi
fi
}

#### Software RAID
softraid()
{
if [ $1 == "details" ] ; then
echo "===================RAID Information======================================================" > $log
echo "===============================================================================================" >> $log
echo "RAID Typ:  Software RAID Array" >> $log
cat /proc/mdstat >> $log
echo "===============================================================================================" >> $log
awk 'BEGIN{ORS="<br>"}1' $log
elif [ $1 == "status" ] ; then
rstatus=`egrep "\[.*(=|>|\.).*\]" /proc/mdstat -c`
RAID_CHECK=`grep check /proc/mdstat | awk '{print $4}'`
RAID_RECOVER=`grep recovery /proc/mdstat | awk '{print $4}'`
RAID_RESYNC=`grep resync /proc/mdstat | awk '{print $4}'`
if [ "$rstatus" -eq 0 ] || [[ $RAID_CHECK ]] ; then
echo "Optimal";
exit=1;
elif [[ $RAID_RECOVER ]]; then
echo "Recovering";
exit=1;
elif [[ $RAID_RESYNC ]]; then
echo "Rsyncing";
exit=1;
else
echo "Degraded";
fi
elif [ $1 == "hdds" ] ; then
echo "coming soon..."
else
echo ""
fi
}

megasasctl()
{
if [ `command -v megasasctl` ];then
if [ $1 == "details" ] ; then
echo "===============================================================================================" > $log
/usr/sbin/megasasctl  >> $log
echo "===============================================================================================" >> $log
awk 'BEGIN{ORS="<br>"}1' $log
elif [ $1 == "status" ] ; then
rstatus=`/usr/sbin/megasasctl | awk '/ RAID / {print $6}'`
if [ "$rstatus" == "optimal"  ]; then
echo "Optimal";
else
echo "Degraded";
fi
elif [ $1 == "hdds" ] ; then
/usr/sbin/megasasctl | awk '/ RAID / {print $1 " "  $3$4 " "  $6}'
else
echo ""
fi
fi
}

mptinfo()
{
if [ `command -v mpt-status` ];then
id=`mpt-status -p |grep "vol_id\|id=" |cut -d, -f 1|awk {'print $3'}|cut -d= -f 2`;
if [ $1 == "details" ] ; then
echo "===============================================================================================" > $log
mpt-status -i $id >>$log
echo "===============================================================================================" >> $log
awk 'BEGIN{ORS="<br>"}1' $log

elif [ $1 == "status" ] ; then
rstatus=`/usr/sbin/mpt-status -i $id -s |grep -E 'vol_id|log_id' | awk '{print $3}'`
if [ $rstatus == "OPTIMAL" ] ; then
echo "Optimal"
else
echo "Degraded"
fi
elif [ $1 == "hdds" ] ; then
/usr/sbin/mpt-status -i $id 
else
echo ""
fi
fi
}


twinfo()
{
if [ `command -v tw_cli` ];then
# Find the controller ID
CONTROLLER_ID=`tw_cli info | awk 'NR==4' | awk '{print $1}'`
# Find the RAID unit ID
UNIT_ID=`tw_cli info $CONTROLLER_ID | awk 'NR==4' | awk '{print $1}'`
if [ $1 == "details" ] ; then
echo "===============================================================================================" > $log
tw_cli /$CONTROLLER_ID show  >> $log
echo "===============================================================================================" >> $log
awk 'BEGIN{ORS="<br>"}1' $log
elif [ $1 == "status" ] ; then
rstatus=`tw_cli info $CONTROLLER_ID $UNIT_ID status | awk '{print $4}'|tr -d '\n'`
if [ "$rstatus" == "OK"  ]; then
echo "Optimal";
else
echo "Degraded";
fi
elif [ $1 == "hdds" ] ; then
tw_cli info $CONTROLLER_ID $UNIT_ID status | awk '{print $4}'
else
echo ""
fi
fi
}

sas2ircuinfo()
{
if [ `command -v sas2ircu` ];then
if [ $1 == "details" ] ; then
echo "=====================  Rebuilding Status =============================" > $log
/usr/sbin/sas2ircu  0 STATUS |grep -w 'Percentage complete' >> $log
echo "======================================================================" >>$log
/usr/sbin/sas2ircu 0 DISPLAY >> $log
awk 'BEGIN{ORS="<br>"}1' $log
elif [ $1 == "status" ] ; then
rstatus=`/usr/sbin/sas2ircu 0 STATUS |grep -E "Volume state" | awk '{print $4}'`
if [ "$rstatus" == "Optimal"  ]; then
echo "Optimal";
else
echo "Degraded";
fi
elif [ $1 == "hdds" ] ; then
/usr/sbin/sas2ircu 0 DISPLAY |grep -E "Volume state" | awk '{print $4}' 
else
echo ""
fi
fi
}
arcinfo()
{
if [ -f '/usr/StorMan/arcconf' ];then
if [ $1 == "details" ] ; then
/usr/StorMan/arcconf GETCONFIG 1  >$log
awk 'BEGIN{ORS="<br>"}1' $log
elif [ $1 == "status" ] ; then

rstatus=`/usr/StorMan/arcconf GETCONFIG 1 |grep -E 'Status of logical device' |awk '{print $6}'|uniq`
if [ "$rstatus" == "Optimal"  ]; then
echo "Optimal";
else
echo "Degraded";
fi
elif [ $1 == "hdds" ] ; then
/usr/StorMan/arcconf GETCONFIG 1
else
echo ""
fi
fi
}

syspartitions()
{
df -H -l -P | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $1 " " $6 }'
}
## update monitoring script
monupdate()
{
wget -q --output-document=/tmp/versions http://specialservers.com/versions
LATESTVERSION=`grep -m1 emagmon /tmp/versions | cut -d ':' -f 2`

if [ "$CURRENTVERSION" == "$LATESTVERSION" ]; then
   echo "emagmon is up2date"
else
   # Downloading
   echo "Downloading emagmon $LATESTVERSION..."
   wget -q --output-document=/root/emagmon http://specialservers.com/emag/emagmon.sh
  # echo "Done."
   CURRENTMD5=`grep -m1 emagmon /tmp/versions | cut -d ':' -f 3`
   if [ "`md5sum /root/emagmon | cut -d ' ' -f 1`" = "$CURRENTMD5" ]; then
          echo "MD5 check is  valid."
   else
           echo "MD5 invalid. Aborting upgrade process."
           exit
   fi
 #  echo "Copying files..."
   chmod 755 /root/emagmon
   if [ `/bin/cat /root/emagmon |wc -l` -gt 0 ] ; then
   mv --force /root/emagmon /usr/bin/emagmon
    chmod 755 /usr/bin/emagmon
   else
   echo "emagmon has been updated successfully "
   fi
   rm -f /tmp/versions
   rm -f /root/emagmon

 fi

}
csfstatus()
{
if  [ -f '/usr/sbin/csf' ] ; then
if [ -e '/etc/csf/csf.disable' ]; then
echo Disabled   ;
else
echo Enabled;
fi
else
IPTABLES=iptables
VAR_SUBSYS_IPTABLES=/var/lock/subsys/$IPTABLES
IPV=${IPTABLES%tables} # ip for ipv4 | ip6 for ipv6
[ "$IPV" = "ip" ] && _IPV="ipv4" || _IPV="ipv6"
PROC_IPTABLES_NAMES=/proc/net/${IPV}_tables_names
NF_TABLES=$(cat "$PROC_IPTABLES_NAMES" 2>/dev/null)
if [ ! -f "$VAR_SUBSYS_IPTABLES" -a -z "$NF_TABLES" ]; then
echo Disabled
else
echo Enabled;
fi

fi
}
raidmoninstall()
{
repourl="http://specialservers.com/repo/";
yum install pciutils   -y
if [[ `/sbin/lspci |grep -E 'MegaSAS|MegaRAID|Dell PowerEdge Expandable RAID controller 5'|wc -l` -gt 0 ]] ;
then echo "RAID Controller on `hostname` server is MegaRAID";
rpm -i --nodeps $repourl/raid/MegaRAID/MegaCli-8.07.10-1.noarch.rpm
ln -s /opt/MegaRAID/MegaCli/MegaCli64 /usr/local/sbin/megacli;
ln -s /opt/MegaRAID/MegaCli/MegaCli64 /usr/sbin/megacli;
elif [[ `/sbin/lspci |grep -E 'SAS1068E|SAS1064ET'` =~ "SAS106" ]] ;
then echo "RAID Controller on `hostname` server is SAS1068E";
rpm -i $repourl/raid/SAS1068E/mpt-status-1.1.6-0.rh7.i386.rpm
wget -q $repourl/raid/SAS1068E/lsiutil -O /sbin/lsiutil -o - ;
chmod 755 /sbin/lsiutil
lsiutil -s
modprobe mptctl
echo mptctl >> /etc/modules
elif  [[ `/sbin/lspci |grep -E '3ware'` =~ "3ware" ]] ;
then echo "RAID Controller on `hostname` server is 3ware";
if [ `uname -i` = "x86_64" ]
then
wget -q $repourl/raid/3ware/tw_cli_86_64 -O /usr/bin/tw_cli -o - ;
else
wget -q $repourl/raid/3ware/tw_cli -O /usr/bin/tw_cli -o - ;
fi
chmod 755 /usr/bin/tw_cli
elif [[ `/sbin/lspci |grep -E 'SAS2008|SAS2308|SAS3008'|wc -l` -gt 0 ]] ;
then echo "RAID Controller on `hostname` server is LSI Logic SAS2008";
if [ `uname -i` = "x86_64" ]
then
wget $repourl/raid/SAS2008/x64/sas2ircu -O /usr/sbin/sas2ircu
else
wget $repourl/raid/SAS2008/i386/sas2ircu -O /usr/sbin/sas2ircu
fi
chmod 755 /usr/sbin/sas2ircu
elif [[ `/sbin/lspci |grep -E 'Hewlett-Packard Company Smart Array'` =~ "Smart Array" ]] ;
then echo "RAID Controller on `hostname` server is Hewlett-Packard Company Smart Array G6 controllers";
if [ `uname -i` = "x86_64" ]
then
yum install libstdc++-4.4.7-3.el6.i686 -y
rpm -i $repourl/raid/HP/libstdc++-4.4.6-4.el6.i686.rpm
rpm -i $repourl/raid/HP/hpacucli-8.30-5.0.noarch.rpm
else
rpm -i $repourl/raid/HP/hpacucli-8.30-5.0.noarch.rpm
fi
elif  [[ `/sbin/lspci |grep -E 'AAC-RAID|Adaptec Series 6'` =~ "Adaptec" ]] ;
then echo "RAID Controller on `hostname` server is Adaptec AAC-RAID";
if [ `uname -i` = "x86_64" ];
then
rpm -i $repourl/raid/AAC-RAID/manager/StorMan-6.50.x86_64.rpm
else
rpm -i $repourl/raid/AAC-RAID/manager/StorMan-6.50.i386.rpm
fi
else
echo "RAID Controller on `hostname` server is diffrent`/sbin/lspci |grep Logic`";
fi

}

snmpsec()
{
echo "Applying the SNMP credentials..."
/etc/init.d/snmpd stop
net-snmp-config --create-snmpv3-user -ro -a MD5 -A S98%Msx#LopU -x DES -X savlamar UkServerUser;/etc/init.d/snmpd start;chkconfig snmpd on
if [ `command -v csf` ];then
csf -a 92.48.65.28
csf -a 78.129.211.13
csf -a 109.203.99.99
csf -a 213.175.215.196
csf -a 5.77.55.55
csf -a 115.124.115.22
csf -a 115.124.115.22
csf -a 5.77.45.45
csf -a 174.141.234.234
fi
echo "snmpd: ALL EXCEPT 92.48.65.28,78.129.211.13,109.203.99.99,5.77.55.55,213.175.215.196,115.124.115.22,174.141.234.234,5.77.45.45" >>  /etc/hosts.deny
echo "SNMP installation is completed"
}

## snmp installation
snmpinstall()
{

if [ -f '/etc/redhat-release' ] ; then
echo "Centos OS is detected.";
if [ `rpm -qa \*-release | grep -Ei "oracle|redhat|centos|cloudlinux" | cut -d"-" -f3` -eq 6 ]; then
if [ `rpm -qa |grep net-snmp|wc -l` -eq 0 ]; then
yum -y install net-snmp-devel net-snmp net-snmp-libs;
/etc/init.d/snmpd stop
ps -ef |grep snmp |grep -vE 'grep|snmpinstall' | awk '{print $2}' | xargs kill
snmpsec
else
/etc/init.d/snmpd stop
ps -ef |grep snmp |grep -vE 'grep|snmpinstall' | awk '{print $2}' | xargs kill
snmpsec
fi
fi
if [ `rpm -qa \*-release | grep -Ei "oracle|redhat|centos|cloudlinux" | cut -d"-" -f3` -eq 5 ]; then
yum -y install net-snmp net-snmp-utils net-snmp-devel;
/etc/init.d/snmpd stop
ps -ef |grep snmp |grep -vE 'grep|snmpinstall' | awk '{print $2}' | xargs kill
snmpsec
fi

elif [ -f /etc/debian-release ]; then
echo "Debian/Ubuntu  OS is detected.. Installing SNMP modules\n";
sudo apt-get install snmpd -y
snmpsec
else
echo "Other OS is detected please install SNMP module manually."
fi

}

##RBL check
rblcheck()
{
RBLLOG="/tmp/srvhsmon/rblblacklist"
function system_primary_ip()
{
# returns the primary IP assigned to eth0
#echo $(ifconfig eth0 | awk -F: '/inet addr:/ {print $2}' | awk '{ print $1 }')
echo $(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
}

if [ -f "$RBLLOG" ] ; then
if [ -f "/etc/mailips" ] && [ `/bin/cat /etc/mailips |wc -l ` -ne 0 ] ; then
ip=`/bin/cat /etc/mailips |grep "*" |grep -v "#" |cut -d: -f2 |sed 's/ //g'`
rblcount=`cat $RBLLOG |grep -w "$ip" | grep -w CRITICAL |wc -l`
if [  $rblcount -eq 0 ] ; then
echo "NORMAL"
else
echo "CRITICAL" 
fi
else
ip=$(system_primary_ip)
if [ `echo  $ip | grep -vE "10.10.|192.168"` ]; then
rblcount=`cat $RBLLOG |grep -w "$ip" | grep -w CRITICAL |wc -l`
if [  $rblcount -eq 0 ] ; then
echo "NORMAL"
else
echo "CRITICAL"
fi

fi
fi
else
echo "NORMAL"
rm -f $RBLLOG
srvhsmon --sharbl & > /dev/null
fi

}

lsyncstatus()
{
SERVICE="lsyncd"
RESULT=$(pgrep -x ${SERVICE})
if [[ "${RESULT:-null}" = null ]]; then
        echo "NOT RUNNING"
else
        echo "RUNNING"
fi

}


#Mail Queue check
mailq()
{
if [ -e "/usr/local/cpanel/version" ]; then
if [ -e "/usr/sbin/exim" ]; then
echo `exim -bpc`
fi
fi
}


## MySQL Clustering Monitoring
mysqlclsstatus()
{
mysqlclu=`mysql -u root  --exec="SHOW STATUS LIKE 'wsrep%';" |grep wsrep_local_state_comment |awk {'print $2'}`
if [ $mysqlclu == "Synced" ] ; then
echo "Synced"
else
echo "Not Synced"
fi
}

## MySQL slave replication

### MySQL Master-Slave Monitoring 
mysqlreplmon()
{
if [ $1 == "status" ] ; then
SQLresponse=`mysql -u root  -e "show slave status \G" |grep -i "Slave_SQL_Running"|gawk '{print $2}'`
IOresponse=`mysql -u root  -e "show slave status \G" |grep -i "Slave_IO_Running"|gawk '{print $2}'`
if [ "$SQLresponse" = "Yes" ] &&  [ "$IOresponse" = "Yes" ]; then
echo "Optimal"
else
echo "Degraded"
fi
elif [ $1 == "slavestatus" ] ; then
SQLresponse=`mysql -u root  -e "show slave status \G" |grep -i "Seconds_Behind_Master"|gawk '{print $2}'`
echo $SQLresponse
elif [ $1 == "details" ] ; then
echo "===================MySQL Replication Information=============================" > $mrepllog
mysql -e "show slave status \G;" >> $mrepllog
echo "=====================================================================" >> $mrepllog
awk 'BEGIN{ORS="<br>"}1' $mrepllog
else
echo "Invalid option"
fi
}
### main script
mon=$1
log="/root/raidstatus";
mrepllog="/root/mysqlreplstatus";
if [ ! -z "$mon" ]; then
if [ $mon == "raidstatus" ] ; then
findraid status
elif [ $mon == "sysraidinfo" ] ; then
findraid details
elif [ $mon == "monupdate" ] ; then
monupdate
elif [ $mon == "csfstatus" ] ; then
csfstatus
elif [ $mon == "raidinstall" ] ; then
raidmoninstall
elif [ $mon == "snmpinstall" ] ; then
snmpinstall
elif [ $mon == "raidhdds" ] ; then
findraid hdds
elif [ $mon == "mysqlrstatus" ] ; then
mysqlreplmon status
elif [ $mon == "mysqlrinfo" ] ; then
mysqlreplmon details
elif [ $mon == "rblcheck" ] ; then
rblcheck
elif [ $mon == "mailq" ] ; then
mailq
elif [ $mon == "slavestatus" ] ; then
mysqlreplmon slavestatus
elif [ $mon == "lsyncstatus" ] ; then
lsyncstatus
elif [ $mon == "mysqlclsstatus" ] ; then
mysqlclsstatus


else
echo "invalid method"
fi
else
exit;
fi