当前位置:网站首页>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 ’:

边栏推荐
- Service learning notes 01 start method and life cycle
- which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_ mod
- R语言寻找数据集缺失值位置
- av_read_frame返回值为-5 Input/output error
- 6-8 creating and traversing linked lists
- 6-2 reverse output of multiple integers recursion
- tidb-lightning配置数据还原路由
- Centos7 server configuration (IV) -- installing redis
- 合并两个有序链表---2022/02/24
- Why is the UDP stream set to 1316 bytes
猜你喜欢

threejs利用indexeddb缓存加载glb模型

Service学习笔记02-实战 startService 与bindService

Why is the UDP stream set to 1316 bytes

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

ffmpeg奇偶场帧Interlace progressive命令和代码处理

Use of forcescan in SQL server and precautions

Ffmpeg parity field frame interlace progressive command and code processing
![[foundation of deep learning] learning of neural network (3)](/img/a5/1b80ba85faf8fa636b784c76d4df2f.png)
[foundation of deep learning] learning of neural network (3)

自动化测试-Selenium

Kubernetes deploys elk and collects container logs using filebeat
随机推荐
About element location and size
6-2 writing articles (*)
Vscode configures eslint to automatically format with an error "the setting is deprecated. use editor.codeactionsonsave instead with a source“
Chapter II relational database
threejs利用indexeddb缓存加载glb模型
zabbix怎样自定义mysql监控项并触发告警
6-5 统计单词数量(文件)(*)
"College entrance examination" volume sent to the big model: 442 people put forward 204 tasks to the big model, led by Google
6-1 需要多少单词可以组成一句话?
Mathematical foundations of information security Chapter 3 - finite fields (I)
信息安全数学基础 Chapter 2——同余
6-3 reading articles (*)
Tidb CDC synchronization of features not available in MySQL to MySQL
6-2 多个整数的逆序输出-递归
How to simplify a lot of if... Elif... Else code?
6-2 写文章(*)
tidb-gc相关问题
ffmpeg硬件编解码Nvidia GPU
智能化整体图例,布线、安防、广播会议、电视、楼宇、消防、电气图的图例【转自微信公众号弱电课堂】
【实用脚本】获取某个文件的行号,然后删除文件内容。