
如果有操作或维护要求zabbix,可以联系博客QQ 452336092或电子邮件: admin#centos.bz(收费)
->
1. 如何获取大小和表大小?
Information_schema存储有关的信息

使用information_schema
MariaDB [(none)]> use information_schema ;
查询总大小
MariaDB [information_schema]> select concat(round(sum(data_length/1024/1024),2),'MB') as data from tables;

查询指定zabbix的大小
MariaDB [information_schema]> select concat(round(sum(data_length/1024/1024),2),'MB') as data from tables where table_schema='zabbix';
查询指定中指定表的大小(zabbix中items表的大小)
select concat(round(sum(data_length/1024/1024),2),'MB') as data from tables where table_schema='zabbix' and table_name='items';

2. 如何通过shell脚本?
vim /etc/zabbix/shell/monitor_mysql.sh
#!/bin/bash
DB_size() {
mysql -Dinformation_schema -e "select concat(round(sum(data_length/1024/1024),2)) as data from tables" |awk 'NR==2{print $1}'
}
DB_zabbix_size() {
mysql -Dinformation_schema -e "select concat(round(sum(data_length/1024/1024),2)) as data from tables where table_schema='zabbix'" | \
awk 'NR==2{print $1}'
}
$1
3.Agent定义模板

vim userparameter_my.conf
UserParameter=monitor_mysql[*],/bin/bash /etc/zabbix/shell/monitor_mysql.sh "$1"
参数说明:
monitor_mysql []: 这是一个自定义键,它是一个参数. 这是从服务器端自定义键值传递的参数.
4. 服务器端自定义键值zabbix,请参阅第二篇文章,即监视QPS和TPS
5. 我们将更新有关zabbix监视的特殊主题. 欢迎加入我们的Linux技术通信小组: 642921645,zabbix监视通信小组: 832462735. 我们将不时更新该小组中有关系统运行和维护的许多信息. 期待您加入!
6. 腾讯教室免费提供zabbix监控技术共享. 欢迎听!地址如下:
来源: 51cto->
本文来自电脑杂谈,转载请注明本文网址:
https://www.pc-fly.com/a/ruanjian/article-154822-1.html
理财方式这么多
小王子