Commit bee76b0a authored by Vladimir Bashkirtsev's avatar Vladimir Bashkirtsev

Aligned UserParameter for Zabbix 5.4 MySQL template

parent 62fc3821
...@@ -55,11 +55,13 @@ all: client-cnf mysql-clients-cnf server-cnf mariadb-config ...@@ -55,11 +55,13 @@ all: client-cnf mysql-clients-cnf server-cnf mariadb-config
install -v -Dm644 mysqlchk@.service /lib/systemd/system/mysqlchk@.service install -v -Dm644 mysqlchk@.service /lib/systemd/system/mysqlchk@.service
systemctl enable mysqlchk.socket systemctl enable mysqlchk.socket
mysql_install_db --basedir=/usr --user=mysql --skip-test-db --innodb-log-file-size=32M mysql_install_db --basedir=/usr --user=mysql --skip-test-db --innodb-log-file-size=32M
sed -e '/^UserParameter=device\.product.*/a UserParameter=mysql.version,mysql -V' -i /etc/zabbix_agentd.conf sed -e '/^UserParameter=device\.product.*/a UserParameter=mysql.slave_status[*], mysql -h"$$1" -P"$$2" -sNX -e "show slave status"' -i /etc/zabbix_agentd.conf
sed -e '/^UserParameter=device\.product.*/a UserParameter=mysql.ping,mysqladmin -u root ping 2> /dev/null | grep -c alive' -i /etc/zabbix_agentd.conf sed -e '/^UserParameter=device\.product.*/a UserParameter=mysql.replication.discovery[*], mysql -h"$$1" -P"$$2" -sNX -e "show slave status"' -i /etc/zabbix_agentd.conf
sed -e '/^UserParameter=device\.product.*/a UserParameter=mysql.size[*],bash -c '\''echo "select sum($$(case "$$3" in both|"") echo "data_length+index_length";; data|index) echo "$$3_length";; free) echo "data_free";; esac)) from information_schema.tables$$([[ "$$1" = "all" || ! "$$1" ]] || echo " where table_schema=\\"$$1\\"")$$([[ "$$2" = "all" || ! "$$2" ]] || echo "and table_name=\\"$$2\\"");" | mysql -u root -N'\''' -i /etc/zabbix_agentd.conf sed -e '/^UserParameter=device\.product.*/a UserParameter=mysql.dbsize[*], mysql -h"$$1" -P"$$2" -sN -e "SELECT COALESCE(SUM(DATA_LENGTH + INDEX_LENGTH),0) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='\''$$3'\''"' -i /etc/zabbix_agentd.conf
sed -e '/^UserParameter=device\.product.*/a UserParameter=mysql.discovery,l=$$(echo "show databases" | mysql -u root -N);echo -n '\''{"data":['\'';for i in $${l};do echo -n "{\\"{#DBNAME}\\": \\"$$i\\"},";done|sed -e '\''s:\\},$$:\\}:'\'';echo -n '\'']}'\'';' -i /etc/zabbix_agentd.conf sed -e '/^UserParameter=device\.product.*/a UserParameter=mysql.db.discovery[*], mysql -h"$$1" -P"$$2" -sN -e "show databases"' -i /etc/zabbix_agentd.conf
sed -e '/^UserParameter=device\.product.*/a UserParameter=mysql.status[*],echo "show global status where Variable_name='\''\$$1'\'';" | mysql -u root -N | awk '\''{print $$$$2}'\''' -i /etc/zabbix_agentd.conf sed -e '/^UserParameter=device\.product.*/a UserParameter=mysql.version[*], mysqladmin -s -h"$$1" -P"$$2" version' -i /etc/zabbix_agentd.conf
sed -e '/^UserParameter=device\.product.*/a UserParameter=mysql.get_status_variables[*], mysql -h"$$1" -P"$$2" -sNX -e "show global status"' -i /etc/zabbix_agentd.conf
sed -e '/^UserParameter=device\.product.*/a UserParameter=mysql.ping[*], mysqladmin -h"$$1" -P"$$2" ping' -i /etc/zabbix_agentd.conf
rm -rf mariadb-10.5.11 rm -rf mariadb-10.5.11
swapoff swap swapoff swap
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment