当前位置:网站首页>Mysql 监控3
Mysql 监控3
2022-06-30 01:19:00 【franket】
测试脚本
装完包后,再次执行测试脚本,就正常返回一个数字了
[[email protected] scripts]# /var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.sh gg
0
[[email protected] scripts]# /var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.sh gt
38409这个数据从哪里来的呢, 执行脚本的过程中生成了这个文件 /tmp/localhost-mysql_cacti_stats.txt
[[email protected] scripts]# cat /tmp/localhost-mysql_cacti_stats.txt
gg:0 gh:0 gi:0 gj:0 gk:3275 gl:7096091357813 gm:0 gn:2 go:0 gp:0 gq:1310712 gr:560473 gs:747264 gt:38409 gu:666299 gv:81269 gw:3884351 gx:4850164 gy:666658 gz:22406662 hg:16685721 hh:0 hi:0 hj:0 hk:0 hl:0 hm:0 hn:0 ho:0 hp:0 hq:61117 hr:79688 hs:72627 ht:3483741 hu:46269304 hv:1477167 hw:10612667 hx:10992203 hy:712017 hz:11704230 ig:0 ih:358979056 ii:0 ij:23 ik:245 il:263 im:2048 in:10245 io:2048 ip:0 iq:2 ir:1 is:0 it:0 iu:1 iv:1 iw:1 ix:2048 iy:8 iz:12 jg:0 jh:0 ji:0 jj:0 jk:0 jl:1 jm:268417400 jn:0 jo:0 jp:0 jq:6 jr:0 js:1 jt:268435456 ju:52 jv:10816055 jw:10511991 jx:6 jy:719085 jz:0 kg:0 kh:0 ki:0 kj:0 kk:0 kl:0 km:0 kn:0 ko:0 kp:3 kq:0 kr:0 ks:0 kt:0 ku:3 kv:0 kw:6 kx:87998 ky:6025810131 kz:8388608 lg:8388608 lh:4347852912824 li:4347852916081 lj:575663419 lk:1048576 ll:0 lm:0 ln:638 lo:0 lp:0 lq:0 lr:0 ls:0 lt:0 lu:1 lv:0 lw:0 lx:0 ly:0 lz:0 mg:0 mh:0 mi:0 mj:0 mk:0 ml:2 mm:38445444 mn:712017 mo:0 mp:0 mq:6 mr:11974037 ms:10 mt:0 mu:11971670 mv:62 mw:0 mx:0 my:0 mz:10992203 ng:10612792 nh:0 ni:0 nj:-1 nk:-1 nl:21978152960 nm:0 nn:72550322 no:1 np:813 nq:815 nr:388741648 ns:2657176 nt:87248076 nu:1197592 nv:53125976 nw:0 nx:-1 ny:-1 nz:-1 og:0 oh:6119424 oi:33554432 oj:0 ok:0 ol:-1 om:-1 on:-1 oo:-1 op:-1 oq:-1 or:-1 os:-1 ot:-1 ou:-1 ov:-1 ow:-1 ox:-1 oy:-1 oz:-1 pg:-1 ph:-1 pi:-1 pj:-1 pk:-1 pl:-1 pm:-1 pn:-1 po:-1 pp:-1 pq:-1 pr:-1 ps:-1 pt:-1 pu:-1 pv:-1 pw:-1 px:-1 py:-1 pz:-1 qg:-1 qh:-1 qi:-1 qj:-1 qk:-1 ql:-1 qm:-1 qn:-1 qo:607839 qp:1964228995[[email protected] scripts]#
[[email protected] scripts]# 这个脚本并不长,总共只有43行,是对 ss_get_mysql_stats.php 的一层包装,罗辑非常简单,看看就知道了
[[email protected] scripts]# wc -l /var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.sh
43 /var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.sh
[[email protected] scripts]# cat /var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.sh
#!/bin/sh
# The wrapper for Cacti PHP script.
# It runs the script every 5 min. and parses the cache file on each following run.
# Version: 1.1.5
#
# This program is part of Percona Monitoring Plugins
# License: GPL License (see COPYING)
# Copyright: 2015 Percona
# Authors: Roman Vynar
ITEM=$1
HOST=localhost
DIR=`dirname $0`
CMD="/usr/bin/php -q $DIR/ss_get_mysql_stats.php --host $HOST --items gg"
CACHEFILE="/tmp/$HOST-mysql_cacti_stats.txt"
if [ "$ITEM" = "running-slave" ]; then
# Check for running slave
RES=`HOME=~zabbix mysql -e 'SHOW SLAVE STATUS\G' | egrep '(Slave_IO_Running|Slave_SQL_Running):' | awk -F: '{print $2}' | tr '\n' ','`
if [ "$RES" = " Yes, Yes," ]; then
echo 1
else
echo 0
fi
exit
elif [ -e $CACHEFILE ]; then
# Check and run the script
TIMEFLM=`stat -c %Y /tmp/$HOST-mysql_cacti_stats.txt`
TIMENOW=`date +%s`
if [ `expr $TIMENOW - $TIMEFLM` -gt 300 ]; then
rm -f $CACHEFILE
$CMD 2>&1 > /dev/null
fi
else
$CMD 2>&1 > /dev/null
fi
# Parse cache file
if [ -e $CACHEFILE ]; then
cat $CACHEFILE | sed 's/ /\n/g; s/-1/0/g'| grep $ITEM | awk -F: '{print $2}'
else
echo "ERROR: run the command manually to investigate the problem: $CMD"
fi
[[email protected] scripts]# 边栏推荐
- Questions about database: database attachment
- Machine learning notes: time series decomposition STL
- 英伟达Jetson Nano的初步了解
- latex如何输入一个矩阵
- How to seamlessly transition from traditional microservice framework to service grid ASM
- Stringredistemplate disconnects and the value disappears
- Antd - tree structure: default deployment node attribute failure - Basic promotion
- 【深度学习编译】算子编译 IR 转换
- Netease cloud music beta music social app "mus" matches friends of the same frequency through music
- Ansible ad-hoc 临时命令
猜你喜欢

Machinery -- nx2007 (UG) finite element analysis tutorial 2 -- assembly

Kubernetes 核心对象概览详解

If the amount exceeds 6 digits after the decimal point, only 6 digits will be reserved, and if it is less than 6 digits, it will remain the same - Basic accumulation

Pytroch Learning Notes 6: NN network layer convolution layer

postman 之接口关联

【535. TinyURL 的加密与解密】

利用huggingface进行文本分类

Tetris game based on STM32F103

【论文写作】英文论文写作指南

传统微服务框架如何无缝过渡到服务网格 ASM
随机推荐
MES管理系统功能模块之质量管理
[recommended] how to quickly locate a bug during testing
第八届“互联网+”大赛 | 云原生赛道邀你来挑战
Outsourcing work for three years, waste a step confused
How to unify the use of package manager in a project?
Cantilever beam calculation [matlab code]
[Thesis Writing] English thesis writing guide
Mechanical --nx2007 (UG) -- gap analysis (interference inspection)
Crmeb SMS for program configuration of knowledge payment system
Taguchi experimental method
Using tsne to visualize the similarity of different sentences
Stringredistemplate disconnects and the value disappears
我,33岁,字节跳动测试开发,揭开北京“测试岗”的真实收入
Sentinel source code analysis Part 7 - sentinel adapter module - Summary
I learned database at station B (V): DQL exercise
Sentinel source code analysis Part 6 - sentinel adapter module Chapter 4 zuul2 gateway
Vant weave - remove (clear) < van button > button component Click to display gray background effect
Machinery -- nx2007 (UG) finite element analysis tutorial 2 -- assembly
Quick Pow: 如何快速求幂
[MRCTF2020]Ezpop-1|php序列化