- 浏览: 558388 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (262)
- oracle (43)
- 打包 (3)
- linux (33)
- nginx (20)
- ftp (1)
- tomcat (8)
- mysql (22)
- plsql (4)
- jms (3)
- nosql (2)
- 运维监控 (5)
- 数据采集 (0)
- 测试 (2)
- jvm (5)
- 自动化数据库迁移 (2)
- 密码 (1)
- java代码 (7)
- java多线程,线程安全 (8)
- xml (1)
- spring (6)
- svn (2)
- oracle备份 (1)
- oracle 诊断 (3)
- oracle 归档 (4)
- java 虚拟机(JVM) (2)
- hibernate (5)
- activemq (2)
- http (2)
- linux_shell (9)
- python (3)
- ant (1)
- oracle rac (1)
- php (2)
- js (1)
- mongo (1)
- java 反射 (1)
- jira (1)
- 打包 maven (1)
- zabbix (2)
- lvs+keepalive (1)
- 防火墙 (1)
- memcache (2)
- redis (1)
最新评论
-
di1984HIT:
学习了~~~~
服务器大量TIME_WAIT -
springdata_spring:
可以参考最新的文档:如何在eclipse jee中检出项目并转 ...
maven常用命令 -
李小斌_2014:
我也遇到了,现在完美解决。
ORA-01422: 实际返回的行数超出请求的行数 -
啸风8023:
...
tomcat启动报错 -
fke153:
这个问题确实很坑人啊,学习了
ORA-01422: 实际返回的行数超出请求的行数
来源http://www.showerlee.com/archives/658
例子
例子
一.修改mysql客户端zabbix_agentd.conf配置: # vi /usr/local/etc/zabbix_agentd.conf 这里注意mysql账号密码与你的数据库账户需对应,还有本脚本获取的是zabbix服务端本地mysql数据库信息,若要获取zabbix客户端信息,请在每行语句mysql或mysqladmin后加 -h"IP"参数,否则无法获取客户端mysql参数信息。 例如: UserParameter=mysql.Ping,mysqladmin -uroot -h192.168.7.10 -p123456 ping|grep alive|wc -l 末行添加如下内容: ----------------- UserParameter=mysql.Ping,mysqladmin -uroot -p123456 ping|grep alive|wc -l UserParameter=mysql.Threads,mysqladmin -uroot -p123456 status|cut -f3 -d":"|cut -f1 -d"Q" UserParameter=mysql.Questions,mysqladmin -uroot -p123456 status|cut -f4 -d":"|cut -f1 -d"S" UserParameter=mysql.Slowqueries,mysqladmin -uroot -p123456 status|cut -f5 -d":"|cut -f1 -d"O" UserParameter=mysql.Qps,mysqladmin -uroot -p123456 status|cut -f9 -d":" UserParameter=mysql.Slave_IO_State,if [ "$(mysql -uroot -p123456 -e "show slave status\G"| grep Slave_IO_Running|awk '{print $2}')" == "Yes" ];then echo 1; else echo 0;fi UserParameter=mysql.Slave_SQL_State,if [ "$(mysql -uroot -p123456 -e "show slave status\G"| grep Slave_SQL_Running|awk '{print $2}')" == "Yes" ];then echo 1; else echo 0;fi UserParameter=mysql.Key_buffer_size,mysql -uroot -p123456 -e "show variables like 'key_buffer_size';"| grep -v Value |awk '{print $2/1024^2}' UserParameter=mysql.Key_reads,mysql -uroot -p123456 -e "show status like 'key_reads';"| grep -v Value |awk '{print $2}' UserParameter=mysql.Key_read_requests,mysql -uroot -p123456 -e "show status like 'key_read_requests';"| grep -v Value |awk '{print $2}' UserParameter=mysql.Key_cache_miss_rate,echo $(mysql -uroot -p123456 -e "show status like 'key_reads';"| grep -v Value |awk '{print $2}') $(mysql -uroot -p123456 -e "show status like 'key_read_requests';"| grep -v Value |awk '{print $2}')| awk '{printf("%1.4f\n",$1/$2*100)}' UserParameter=mysql.Key_blocks_used,mysql -uroot -p123456 -e "show status like 'key_blocks_used';"| grep -v Value |awk '{print $2}' UserParameter=mysql.Key_blocks_unused,mysql -uroot -p123456 -e "show status like 'key_blocks_unused';"| grep -v Value |awk '{print $2}' UserParameter=mysql.Key_blocks_used_rate,echo $(mysql -uroot -p123456 -e "show status like 'key_blocks_used';"| grep -v Value |awk '{print $2}') $(mysql -uroot -p123456 -e "show status like 'key_blocks_unused';"| grep -v Value |awk '{print $2}')| awk '{printf("%1.4f\n",$1/($1+$2)*100)}' UserParameter=mysql.Innodb_buffer_pool_size,mysql -uroot -p123456 -e "show variables like 'innodb_buffer_pool_size';"| grep -v Value |awk '{print $2/1024^2}' UserParameter=mysql.Innodb_log_file_size,mysql -uroot -p123456 -e "show variables like 'innodb_log_file_size';"| grep -v Value |awk '{print $2/1024^2}' UserParameter=mysql.Innodb_log_buffer_size,mysql -uroot -p123456 -e "show variables like 'innodb_log_buffer_size';"| grep -v Value |awk '{print $2/1024^2}' UserParameter=mysql.Table_open_cache,mysql -uroot -p123456 -e "show variables like 'table_open_cache';"| grep -v Value |awk '{print $2}' UserParameter=mysql.Open_tables,mysql -uroot -p123456 -e "show status like 'open_tables';"| grep -v Value |awk '{print $2}' UserParameter=mysql.Opened_tables,mysql -uroot -p123456 -e "show status like 'opened_tables';"| grep -v Value |awk '{print $2}' UserParameter=mysql.Open_tables_rate,echo $(mysql -uroot -p123456 -e "show status like 'open_tables';"| grep -v Value |awk '{print $2}') $(mysql -uroot -p123456 -e "show status like 'opened_tables';"| grep -v Value |awk '{print $2}')| awk '{printf("%1.4f\n",$1/($1+$2)*100)}' UserParameter=mysql.Table_open_cache_used_rate,echo $(mysql -uroot -p123456 -e "show status like 'open_tables';"| grep -v Value |awk '{print $2}') $(mysql -uroot -p123456 -e "show variables like 'table_open_cache';"| grep -v Value |awk '{print $2}')| awk '{printf("%1.4f\n",$1/($1+$2)*100)}' UserParameter=mysql.Thread_cache_size,mysql -uroot -p123456 -e "show variables like 'thread_cache_size';"| grep -v Value |awk '{print $2}' UserParameter=mysql.Threads_cached,mysql -uroot -p123456 -e "show status like 'Threads_cached';"| grep -v Value |awk '{print $2}' UserParameter=mysql.Threads_connected,mysql -uroot -p123456 -e "show status like 'Threads_connected';"| grep -v Value |awk '{print $2}' UserParameter=mysql.Threads_created,mysql -uroot -p123456 -e "show status like 'Threads_created';"| grep -v Value |awk '{print $2}' UserParameter=mysql.Threads_running,mysql -uroot -p123456 -e "show status like 'Threads_running';"| grep -v Value |awk '{print $2}' UserParameter=mysql.Qcache_free_blocks,mysql -uroot -p123456 -e "show status like 'Qcache_free_blocks';"| grep -v Value |awk '{print $2}' UserParameter=mysql.Qcache_free_memory,mysql -uroot -p123456 -e "show status like 'Qcache_free_memory';"| grep -v Value |awk '{print $2}' UserParameter=mysql.Qcache_hits,mysql -uroot -p123456 -e "show status like 'Qcache_hits';"| grep -v Value |awk '{print $2}' UserParameter=mysql.Qcache_inserts,mysql -uroot -p123456 -e "show status like 'Qcache_inserts';"| grep -v Value |awk '{print $2}' UserParameter=mysql.Qcache_lowmem_prunes,mysql -uroot -p123456 -e "show status like 'Qcache_lowmem_prunes';"| grep -v Value |awk '{print $2}' UserParameter=mysql.Qcache_not_cached,mysql -uroot -p123456 -e "show status like 'Qcache_not_cached';"| grep -v Value |awk '{print $2}' UserParameter=mysql.Qcache_queries_in_cache,mysql -uroot -p123456 -e "show status like 'Qcache_queries_in_cache';"| grep -v Value |awk '{print $2}' UserParameter=mysql.Qcache_total_blocks,mysql -uroot -p123456 -e "show status like 'Qcache_total_blocks';"| grep -v Value |awk '{print $2}' UserParameter=mysql.Qcache_fragment_rate,echo $(mysql -uroot -p123456 -e "show status like 'Qcache_free_blocks';"| grep -v Value |awk '{print $2}') $(mysql -uroot -p123456 -e "show status like 'Qcache_total_blocks';"| grep -v Value |awk '{print $2}')| awk '{printf("%1.4f\n",$1/$2*100)}' UserParameter=mysql.Qcache_used_rate,echo $(mysql -uroot -p123456 -e "show variables like 'query_cache_size';"| grep -v Value |awk '{print $2}') $(mysql -uroot -p123456 -e "show status like 'Qcache_free_memory';"| grep -v Value |awk '{print $2}')| awk '{printf("%1.4f\n",($1-$2)/$1*100)}' UserParameter=mysql.Qcache_hits_rate,echo $(mysql -uroot -p123456 -e "show status like 'Qcache_hits';"| grep -v Value |awk '{print $2}') $(mysql -uroot -p123456 -e "show status like 'Qcache_inserts';"| grep -v Value |awk '{print $2}')| awk '{printf("%1.4f\n",($1-$2)/$1*100)}' UserParameter=mysql.Query_cache_limit,mysql -uroot -p123456 -e "show variables like 'query_cache_limit';"| grep -v Value |awk '{print $2}' UserParameter=mysql.Query_cache_min_res_unit,mysql -uroot -p123456 -e "show variables like 'query_cache_min_res_unit';"| grep -v Value |awk '{print $2}' UserParameter=mysql.Query_cache_size,mysql -uroot -p123456 -e "show variables like 'query_cache_size';"| grep -v Value |awk '{print $2}' UserParameter=mysql.Sort_merge_passes,mysql -uroot -p123456 -e "show status like 'Sort_merge_passes';"| grep -v Value |awk '{print $2}' UserParameter=mysql.Sort_range,mysql -uroot -p123456 -e "show status like 'Sort_range';"| grep -v Value |awk '{print $2}' UserParameter=mysql.Sort_rows,mysql -uroot -p123456 -e "show status like 'Sort_rows';"| grep -v Value |awk '{print $2}' UserParameter=mysql.Sort_scan,mysql -uroot -p123456 -e "show status like 'Sort_scan';"| grep -v Value |awk '{print $2}' UserParameter=mysql.Handler_read_first,mysql -uroot -p123456 -e "show status like 'Handler_read_first';"| grep -v Value |awk '{print $2}' UserParameter=mysql.Handler_read_key,mysql -uroot -p123456 -e "show status like 'Handler_read_key';"| grep -v Value |awk '{print $2}' UserParameter=mysql.Handler_read_next,mysql -uroot -p123456 -e "show status like 'Handler_read_next';"| grep -v Value |awk '{print $2}' UserParameter=mysql.Handler_read_prev,mysql -uroot -p123456 -e "show status like 'Handler_read_prev';"| grep -v Value |awk '{print $2}' UserParameter=mysql.Handler_read_rnd,mysql -uroot -p123456 -e "show status like 'Handler_read_rnd';"| grep -v Value |awk '{print $2}' UserParameter=mysql.Handler_read_rnd_next,mysql -uroot -p123456 -e "show status like 'Handler_read_rnd_next';"| grep -v Value |awk '{print $2}' UserParameter=mysql.Com_select,mysql -uroot -p123456 -e "show status like 'com_select';"| grep -v Value |awk '{print $2}' UserParameter=mysql.Com_insert,mysql -uroot -p123456 -e "show status like 'com_insert';"| grep -v Value |awk '{print $2}' UserParameter=mysql.Com_insert_select,mysql -uroot -p123456 -e "show status like 'com_insert_select';"| grep -v Value |awk '{print $2}' UserParameter=mysql.Com_update,mysql -uroot -p123456 -e "show status like 'com_update';"| grep -v Value |awk '{print $2}' UserParameter=mysql.Com_replace,mysql -uroot -p123456 -e "show status like 'com_replace';"| grep -v Value |awk '{print $2}' UserParameter=mysql.Com_replace_select,mysql -uroot -p123456 -e "show status like 'com_replace_select';"| grep -v Value |awk '{print $2}' UserParameter=mysql.Table_scan_rate,echo $(mysql -uroot -p123456 -e "show status like 'Handler_read_rnd_next';"| grep -v Value |awk '{print $2}') $(mysql -uroot -p123456 -e "show status like 'com_select';"| grep -v Value |awk '{print $2}')| awk '{printf("%1.4f\n",$1/$2*100)}' UserParameter=mysql.Open_files,mysql -uroot -p123456 -e "show status like 'open_files';"| grep -v Value |awk '{print $2}' UserParameter=mysql.Open_files_limit,mysql -uroot -p123456 -e "show variables like 'open_files_limit';"| grep -v Value |awk '{print $2}' UserParameter=mysql.Open_files_rate,echo $(mysql -uroot -p123456 -e "show status like 'open_files';"| grep -v Value |awk '{print $2}') $(mysql -uroot -p123456 -e "show variables like 'open_files_limit';"| grep -v Value |awk '{print $2}')| awk '{printf("%1.4f\n",$1/$2*100)}' UserParameter=mysql.Created_tmp_disk_tables,mysql -uroot -p123456 -e "show status like 'created_tmp_disk_tables';"| grep -v Value |awk '{print $2}' UserParameter=mysql.Created_tmp_tables,mysql -uroot -p123456 -e "show status like 'created_tmp_tables';"| grep -v Value |awk '{print $2}' UserParameter=mysql.Created_tmp_disk_tables_rate,echo $(mysql -uroot -p123456 -e "show status like 'created_tmp_disk_tables';"| grep -v Value |awk '{print $2}') $(mysql -uroot -p123456 -e "show status like 'created_tmp_tables';"| grep -v Value |awk '{print $2}')| awk '{printf("%1.4f\n",$1/$2*100)}' UserParameter=mysql.Max_connections,mysql -uroot -p123456 -e "show variables like 'max_connections';"| grep -v Value |awk '{print $2}' UserParameter=mysql.Max_used_connections,mysql -uroot -p123456 -e "show status like 'Max_used_connections';"| grep -v Value |awk '{print $2}' UserParameter=mysql.Max_connections_used_rate,echo $(mysql -uroot -p123456 -e "show status like 'Max_used_connections';"| grep -v Value |awk '{print $2}') $(mysql -uroot -p123456 -e "show variables like 'max_connections';"| grep -v Value |awk '{print $2}')| awk '{printf("%1.4f\n",$1/$2*100)}' UserParameter=mysql.Table_locks_immediate,mysql -uroot -p123456 -e "show status like 'Table_locks_immediate';"| grep -v Value |awk '{print $2}' UserParameter=mysql.Table_locks_waited,mysql -uroot -p123456 -e "show status like 'table_locks_waited';"| grep -v Value |awk '{print $2}' UserParameter=mysql.Engine_select,echo $(mysql -uroot -p123456 -e "show status like 'Table_locks_immediate';"| grep -v Value |awk '{print $2}') $(mysql -uroot -p123456 -e "show status like 'table_locks_waited';"| grep -v Value |awk '{print $2}')| awk '{printf("%5.4f\n",$1/$2)}'
- zbx_tomcat_templates.rar (3.6 KB)
- 下载次数: 3
- zabbix_mysql.zip (83.4 KB)
- 下载次数: 6
相关推荐
利用loadrunner工具编写脚本,监控mysql,在场景运行中可以左证mysql的运行状态
linux下检测mysql进程状态脚本,做Mysql主备模式,可以监测mysql数据库允许状态。
mysql监控脚本,mysql 宕机自启服务。mysql监控脚本,自启mysql监控脚本,自启
官方支持脚本,用于最新版Cacti 1.1.38监控mysql数据库 5.7
zabbix监控mysql数据库详细配置,含监控mysql脚本;
全国省市区编号MySql脚本
该包中包含一键安装mysql5.7和mysql8.0脚本,分为mysql二进制包安装和yum安装,并一起部署MySQL备份策略 用于快速部署mysql场景,适合多项目快速部署 备份工具为xtrabackup
身份证前面6位对应的,全国行政区域编号mysql建表脚本。
zabbix监控mysql pecona模板 zabbix 3.0版本可用 zabbix 3.0版本可用
prometheus监控规则大全 node规则,redis监控,es监控,vmware监控,ipmi监控,ceph监控,etcd监控,k8s监控,mysql监控,openstack监控,os监控,交换机监控,windows监控,cdh监控,calico监控规则监控
自动化部署mysql脚本适合的版本为mysql5.5和5.6系列。
zabbix监控mysql文档,可以按照此文档顺利的完成mysql的监控
python链接mysql脚本 链接ejabberd 进行外部验证的脚本,需要更改自己数据库的一些设置
quartz定时器mysql的脚本,如果需要定时器持久化到数据库,可以使用
mysql dba 常用脚本 运行脚本可以方便管理MYSQL运行脚本可以方便管理MYSQL运行脚本可以方便管理MYSQL
C#/WInform+DotNetBar实现MySQL一件安装,监控服务状态,开启,关闭,重启服务
zipkin持久化mysql脚本
mysql 服务启动与关闭脚本,Windows 批处理,双击启动或者关闭