前言:
例行巡检是节假日来临之前的必做项目,对服务器做一轮全面的健康检查,一方面可以确保节假日期间服务器的稳定,另外还可以检查一下平时监控没覆盖到的地方。
连《炉石传说》这么强大的运维团队都能把数据弄丢,你还有什么理由不做一次巡检呢?
巡检主要分如下4个层面:
1.硬件
2.操作系统
3.数据库
4.架构
5.ETL
巡检项目:
如需详细大图与备注请直接联系我,站内不允许上传mindmanger格式的文件。
巡检脚本:
-
#!/bin/bash
-
#这个脚本的功能是对MySQL进行巡检
-
#Written by LiHui
-
#Version 1.1
-
#Data:2017-01-19
-
-
echo -e "\033[33m========================= 硬件检查 =========================\033[0m"
-
-
echo -e "\033[31m=====显示开机信息===== \033[0m"
-
dmesg | tail -20
-
-
echo -e "\033[31m=====查看RAID阵列信息===== \033[0m"
-
/opt/MegaRAID/MegaCli/MegaCli64 -LDInfo -Lall -aALL
-
-
echo -e "\033[31m=====检查物理磁盘SMART信息===== \033[0m"
-
/opt/MegaRAID/MegaCli/MegaCli64 -PDList -aALL|egrep 'Slot|S.M.A.R.T'
-
-
echo -e "\033[31m=====检查RAID电池状态===== \033[0m"
-
/opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -a0|grep -E 'Charger|isSOHGood|Cycle Count|Max Error'
-
-
-
-
echo -e "\033[33m========================= 操作系统检查 =========================\033[0m"
-
-
echo -e "\033[31m=====启动项检查===== \033[0m"
-
chkconfig --list |grep -E "lvs|iptables|zabbix_agentd"
-
-
echo -e "\033[31m=====MySQL启动项检查===== \033[0m"
-
cat /etc/rc.d/rc.local |grep mysql
-
-
echo -e "\033[31m=====IO性能检查===== \033[0m"
-
vmstat 1 5
-
-
echo -e "\033[31m=====内存检查===== \033[0m"
-
free -m
-
-
echo -e "\033[31m=====操作系统日志检查===== \033[0m"
-
tail -50 /var/log/messages
-
-
echo -e "\033[31m=====磁盘空间检查===== \033[0m"
-
df -h
-
-
echo -e "\033[31m=====网络情况检查===== \033[0m"
-
ifconfig|grep errors
-
-
-
-
echo -e "\033[33m========================= 数据库检查 =========================\033[0m"
-
-
for i in `netstat -nult |grep 33|awk -F ':' '{print $2}'|awk '{print $1}'`;do echo -e "\033[31m=====THIS SECTION IS BUFFER POOL FOR PORT " $i "===== \033[0m"; mysql -uxxx -pxxx -S /data0/mysqldata/$i/mysql.sock -e 'show engine innodb status \G' |grep 'Free buffers';done
-
-
for i in `netstat -nult |grep 33|awk -F ':' '{print $2}'|awk '{print $1}'`; do echo -e "\033[31m=====THIS SECTION IS ERROR LOG FOR PORT " $i "===== \033[0m"; tail -50 /data0/mysqldata/$i/mysql-error.log; done
-
-
-
-
echo -e "\033[33m========================= 架构检查 =========================\033[0m"
-
-
for i in `netstat -nult |grep 33|awk -F ':' '{print $2}'|awk '{print $1}'`;do echo -e "\033[31m=====THIS SECTION IS SLAVE STATUS FOR PORT " $i "===== \033[0m"; mysql -uxxx -pxxx -S /data0/mysqldata/$i/mysql.sock -e 'show slave status \G' |grep -E 'Slave_IO_Running|Slave_SQL_Running|Master_Log_File|Read_Master_Log_Pos|Relay_Master_Log_File|Exec_Master_Log_Pos|Seconds_Behind_Master';done
-
-
echo -e "\033[31m=====虚拟IP检查===== \033[0m"
-
ip addr|grep lo |grep -v eth1
阅读(10203) | 评论(0) | 转发(0) |