heartbeat 监控 MySQL 的脚本
·
1 分钟阅读
·
Shell
#!/bin/bash
pid=/var/mysql/data/host002.pid
time=`date '+%H:%M:%S'`
Date=`date '+%Y.%m.%d'`
if [ -f $pid ];then
echo "$time:mysql is running" >>/tmp/chk_mysql.log_$Date
else
echo "$time:mysql is down!stopping heartbeat..." >>/tmp/chk_mysql.log_$Date
/etc/init.d/heartbeat stop 2>&1 /dev/null
echo "$time:heartbeat has stoped." >>/tmp/chk_mysql.log_$Date
# sleep 100
echo "$time:restart heartbeat for standby...">>/tmp/chk_mysql.log_$Date
/etc/init.d/heartbeat start 2>&1 /dev/null
echo "$time:restart heartbeat successed.">>/tmp/chk_mysql.log_$Date
fi
#mysql
#监控告警
相关文章
-
实时监控网卡流量的脚本,显示发送/接收速率,支持不同单位自动转换。
Shell · 3 分钟阅读
-
从配置文件列表中逐个读取文件,备份后使用 sed 命令批量修改参数值。
Shell · 1 分钟阅读
-
基于 ifconfig 的网络流量监控脚本,实时显示网卡的发送/接收速率和平均流量。
Shell · 2 分钟阅读
-
使用 eval 命令将变量的值用作新的变量名,实现间接引用的技巧。
Shell · 1 分钟阅读