1
0
mirror of https://github.com/ranl/monitor-utils.git synced 2024-11-05 15:43:44 +01:00
monitor-utils/zabbix/user_param/mysql.conf
2013-12-02 15:24:24 +02:00

22 lines
3.5 KiB
Plaintext

####################
### MySQL Server ###
####################
# GRANT SELECT ON *.* TO zabbix@localhost IDENTIFIED BY '*******';
# 1 - user
# 2 - password
UserParameter=mysql.com_select[*],data=$(mysql --connect_timeout 2 -N -u $1 -p$2 -e "SHOW GLOBAL STATUS where Variable_name = 'Com_select';" 2> /dev/null | awk '{print $NF}') ; [ -z "$data" ] && data=0 ; echo $data
UserParameter=mysql.qcache_hits[*],data=$(mysql --connect_timeout 2 -N -u $1 -p$2 -e "SHOW GLOBAL STATUS where Variable_name = 'Qcache_hits';" 2> /dev/null | awk '{print $NF}') ; [ -z "$data" ] && data=0 ; echo $data
UserParameter=mysql.threads_connected[*],data=$(mysql --connect_timeout 2 -N -u $1 -p$2 -e "SHOW GLOBAL STATUS where Variable_name = 'Threads_connected';" 2> /dev/null | awk '{print $NF}') ; [ -z "$data" ] && data=0 ; echo $data
UserParameter=mysql.table_locks_waited[*],data=$(mysql--connect_timeout 2 -N -u $1 -p$2 -e "SHOW GLOBAL STATUS where Variable_name = 'Table_locks_waited';" 2> /dev/null | awk '{print $NF}') ; [ -z "$data" ] && data=0 ; echo $data
UserParameter=mysql.created_tmp_tables[*],data=$(mysql --connect_timeout 2 -N -u $1 -p$2 -e "SHOW GLOBAL STATUS where Variable_name = 'Created_tmp_tables';" 2> /dev/null | awk '{print $NF}') ; [ -z "$data" ] && data=0 ; echo $data
UserParameter=mysql.created_tmp_disk_tables[*],data=$(mysql --connect_timeout 2 -N -u $1 -p$2 -e "SHOW GLOBAL STATUS where Variable_name = 'Created_tmp_disk_tables';" 2> /dev/null | awk '{print $NF}') ; [ -z "$data" ] && data=0 ; echo $data
UserParameter=mysql.slow_queries[*],data=$(mysql --connect_timeout 2 -N -u $1 -p$2 -e "SHOW GLOBAL STATUS where Variable_name = 'Slow_queries';" 2> /dev/null | awk '{print $NF}') ; [ -z "$data" ] && data=0 ; echo $data
UserParameter=mysql.aborted_connects[*],data=$(mysql --connect_timeout 2 -N -u $1 -p$2 -e "SHOW GLOBAL STATUS where Variable_name = 'Aborted_connects';" 2> /dev/null | awk '{print $NF}') ; [ -z "$data" ] && data=0 ; echo $data
UserParameter=mysql.innodb_buffer_pool_read_requests[*],data=$(mysql --connect_timeout 2 -N -u $1 -p$2 -e "SHOW GLOBAL STATUS where Variable_name = 'Innodb_buffer_pool_read_requests';" 2> /dev/null | awk '{print $NF}') ; [ -z "$data" ] && data=0 ; echo $data
UserParameter=mysql.innodb_buffer_pool_reads[*],data=$(mysql --connect_timeout 2 -N -u $1 -p$2 -e "SHOW GLOBAL STATUS where Variable_name = 'Innodb_buffer_pool_reads';" 2> /dev/null | awk '{print $NF}') ; [ -z "$data" ] && data=0 ; echo $data
UserParameter=mysql.slave_io_running[*],mysql --connect_timeout 2 -u $1 -p$2 -e "SHOW SLAVE STATUS\G;" 2> /dev/null | sed '1d' |grep Slave_IO_Running | awk '{print $NF}' | grep -c Yes
UserParameter=mysql.slave_sql_running[*],mysql --connect_timeout 2 -u $1 -p$2 -e "SHOW SLAVE STATUS\G;" 2> /dev/null | sed '1d' |grep Slave_SQL_Running | awk '{print $NF}' | grep -c Yes
UserParameter=mysql.seconds_behind_master[*],data=$(mysql --connect_timeout 2 -u $1 -p$2 -e "SHOW SLAVE STATUS\G;" 2> /dev/null | sed '1d' |grep Seconds_Behind_Master | awk '{print $NF}') ; [ -z "$data" ] && data=0 ; echo $data
UserParameter=mysql.slave_io_last_error[*],msg=$(mysql --connect_timeout 2 -u $1 -p$2 -e "SHOW SLAVE STATUS\G;" 2> /dev/null | sed '1d' | grep Last_IO_Error: | sed 's/\s*Last_IO_Error: //g') ; [ -z "$msg" ] && msg="-1" ; echo $msg
UserParameter=mysql.slave_sql_last_error[*],msg=$(mysql --connect_timeout 2 -u $1 -p$2 -e "SHOW SLAVE STATUS\G;" 2> /dev/null | sed '1d' | grep Last_SQL_Error: | sed 's/\s*Last_SQL_Error: //g') ; [ -z "$msg" ] && msg="-1" ; echo $msg