当前位置:网站首页>How ZABBIX can customize MySQL monitoring items and trigger alarms
How ZABBIX can customize MySQL monitoring items and trigger alarms
2022-06-11 17:51:00 【Yabingshi】
For example, I want to achieve , If there is metadata lock Waiting for table metadata lock, The alarm is triggered .
1 Write monitoring scripts
cd /opt/zabbix/scripts/
vi get_metalock.sh
Add the following :
#!/bin/bash
rm -rf /opt/zabbix/scripts/get_metalock.log
mysql -uMonitorUser -p password -e "
SELECT * FROM information_schema.processlist WHERE state='Waiting for table metadata lock';
quit" >> /opt/zabbix/scripts/get_metalock.log
v1=`cat /opt/zabbix/scripts/get_metalock.log |wc -l`
if [ $v1 -eq 0 ];then
echo 0
else
echo 1
fi# Authorize scripts
chmod 755 /opt/zabbix/scripts/get_metalock.sh
2 create profile
stay /opt/zabbix/etc/zabbix_agentd.conf The definition of Include Create the configuration file under the path .
Example :
Include=/opt/zabbix/etc/zabbix_agentd.conf.d/*.conf
be ,
cd /opt/zabbix/etc/zabbix_agentd.conf.d/
Build a new one to userparameter At the beginning , Name custom configuration file , Example :
vi userparameter_get_metalock.conf
Add the following :
UserParameter=get_metalock,sh /opt/zabbix/scripts/get_metalock.sh
# restart zabbix agent
systemctl restart zabbix_agentd
3 Add monitor
In existing mysql Create monitoring items in the template
To configure - Templates - Monitoring item - Create monitor item
The key values are consistent with those defined in the configuration file (UserParameter= Value after ).

4 Create trigger

Select the newly created monitoring item :
![]()
Set up here last result =1:

Final , The following results are automatically generated :

Customize ‘ severity ’:

边栏推荐
- 6-6 批量求和(*)
- 6-2 多个整数的逆序输出-递归
- Service learning notes 01 start method and life cycle
- Several ways to recover tidb data from accidental deletion
- How to become an optimist organization?
- adb 命令学习笔记
- 6-7 file read / write operation
- Tidb GC related problems
- Intelligent overall legend, legend of wiring, security, radio conference, television, building, fire protection and electrical diagram [transferred from wechat official account weak current classroom]
- threejs利用indexeddb缓存加载glb模型
猜你喜欢

How to become an optimist organization?

自动化测试-Selenium

After class, I looked at the document and went back to the lab. I picked up the forgotten SQL operators again

CLP information -5 keywords to see the development trend of the financial industry in 2022

Chorus翻译

sql server中关于FORCESCAN的使用以及注意项

送给大模型的「高考」卷:442人联名论文给大模型提出204个任务,谷歌领衔

为什么udp流设置1316字节

端口规划与APJ

ffmpeg奇偶场帧Interlace progressive命令和代码处理
随机推荐
括号生成---2022/02/25
Port planning and APJ
tidb-cdc同步mysql没有的特性到mysql时的处理
Ffmpeg hard codec inter QSV
6-2 writing articles (*)
Tidb CDC log tables are not eligible to replicate
送给大模型的「高考」卷:442人联名论文给大模型提出204个任务,谷歌领衔
Summary of clustering methods
安装mariadb 10.5.7(tar包安装)
信息安全数学基础 Chapter 3——有限域(二)
光纤熔接知识汇总【转载自微信公众号弱电智能化工程2018】
【先收藏,早晚用得到】100个Flink高频面试题系列(一)
How to simplify a lot of if... Elif... Else code?
信息安全数学基础 Chapter 3——有限域(一)
自动化测试-Selenium
Bracket generation ---2022/02/25
【线上问题】Timeout waiting for connection from pool 问题排查
6-3 reading articles (*)
CLP information -5 keywords to see the development trend of the financial industry in 2022
Hash table, inheritance