mysql的空间使用脚本:
#!/bin/sh
#create by danchen
#2007-5-11
#function:mysql database schema tablespace
mysql -t -u root << EOF
SELECT a.schema_name db_name,
IFNULL(ROUND((SUM(b.data_length)+SUM(b.index_length))/1024/1024,2),0.00)
total_size_mb,
IFNULL(ROUND(((SUM(b.data_length)+SUM(b.index_length))-
SUM(b.data_free))/1024/1024,2),0.00) data_used_mb,
IFNULL(ROUND(SUM(data_free)/1024/1024,2),0.00) data_free_mb,
IFNULL(ROUND((((SUM(b.data_length)+SUM(b.index_length))-SUM(b.data_free))/
((SUM(b.data_length)+SUM(b.index_length)))*100),2),0) pct_used,
COUNT(table_name) tables
FROM information_schema.schemata a
LEFT JOIN information_schema.tables b ON a.schema_name = b.table_schema
WHERE a.schema_name != 'information_schema'
GROUP BY a.schema_name
ORDER BY 1;
exit
EOF
mysql的表分析脚本:
[mysql@test mysql]$ cat tabanalyze.sh
#!/bin/sh
#create by danchen
#2007-5-15
#function:produce analyze table syntax,this script is called by analyz.sh
mysql -u taobao <<EOF
use information_schema;
select concat('analyze table ',table_name,';') as head from tables where table_schema='email';
EOF
--------------------------------------------------------------------------------------------
[mysql@test mysql]$ cat analyze.sh
#!/bin/sh
#create by danchen
#2007-5-16
#function:analyze table and index
date
echo "analyze table begin"
#get all tables that need to analyze
/home/mysql/tabanalyze.sh > /tmp/table_analyze.sql
cat /tmp/table_analyze.sql|sed 's/head/use email;/' > /tmp/tmp_table_analyze.sql
#analyze
mysql -t -u taobao < /tmp/tmp_table_analyze.sql
echo "analyze table end"
date
分享到:
相关推荐
mysql监控脚本,mysql 宕机自启服务。mysql监控脚本,自启mysql监控脚本,自启
官方支持脚本,用于最新版Cacti 1.1.38监控mysql数据库 5.7
mysql.sock 登陆 监控脚本 ,需要简单更改下脚本登陆 本脚本默认为3306端口,可修改其它脚本复用 需要配合 zabbix 监控模版使用 模版链接 https://download.csdn.net/download/zhangxueleishamo/87681013
linux下检测mysql进程状态脚本,做Mysql主备模式,可以监测mysql数据库允许状态。
利用loadrunner工具编写脚本,监控mysql,在场景运行中可以左证mysql的运行状态
NULL 博文链接:https://hb-yym-929.iteye.com/blog/1176299
- Mysql监控脚本需要修改/opt/zabbix/etc/mysql.conf后才能使用; - Nginx不必修改,但NginxStatus状态服务须和监控脚本中配置的地址和端口一致,默认- Redis监控脚本配合模板使用,极为完善,且支持自动发现多实例...
mysql监控脚本常用命令整理,感兴趣的朋友可以了解下哈
mysql从服务器状态监控脚本,源自官方网
mysql 服务启动与关闭脚本,Windows 批处理,双击启动或者关闭
自动化运维之用Zabbix+mysql制作 监控SVN主从版本号是否一致的脚本
文章目录开发监控MySQL数据库的脚本httpd的监控脚本 开发监控MySQL数据库的脚本 脚本1: cat check_mysql_01.sh #!/bin/bash echo method1---------------------- if [ `netstat -antlpe|grep 3306|awk -F [ :]+ '{...
以前监控mysql的php脚本的一个Bug
NULL 博文链接:https://stevenfeng.iteye.com/blog/2034821
mysql告警监控shell脚本,实现MySQL的监控
编写的脚本用来监控mysql主从模式 环境: Centos5.6 mysql只做同步指定库,没有同步mysql库用户数据 登陆从服务器mysql,添加验证的用户 grant replication client on *.* to 'nagios'@localhost identified ...
zabbix监控mysql数据库详细配置,含监控mysql脚本;
实现监控LINUX系统下MySQL的主从同步错误,同时辅以邮件通知。
说明:监控脚本在 rhel5 下测试正常,其它版本的linux 系统请自行测试,需要的一些准备工作可以查看这篇文章 代码: 代码如下:#监控mysql 主从复制cat chk_mysql_rep.sh #!/bin/bash # #script_name:chk_mysql_rep....