2014/12/01

MySQL internals monitoring by Zabbix

There are a lot of examples how to monitor MySQL internal by zabbix-agent, like:
but you know - the main issue is NIH ;) Those solutions are too heavy and use dependencies like php. Also, mysql "SHOW GLOBAL STATUS" provides with hundreds of values, and its hard to select ~50 of most valuable. Last link is best solution found, I've updated it a little:
  • Fast and light - only one bash file
  • Zabbix traps are used to send data in one chunk, lowering system load and bandwidth
  • 45 items, 13 triggers, 11 graphs




Installation:
  1. Save this as /etc/zabbix/zabbix_agentd.conf.d/mysql.conf
    # mysql[uptime] or mysql[max_connections] will trigger trap sending
    # run '/etc/zabbix/mysql.sh uptime debug' to debug trap sending
    UserParameter=mysql[*],/etc/zabbix/mysql.sh $1 $2
    
  2. Download and save data-getter
    /etc/zabbix/mysql.sh
  3. Import template
    template_app_mysql.xml
Notes:
  • Triggers are mostly paranoid, so be ready to understand what they measure and fix.
    If not - just disable them
  • All values are of type "zabbix trap" except for 'uptime' and 'max_connections'
    'uptime' is "zabbix active check" and checked each 5min by default, at this time all status traps are sent
    'max_connections' is checked hourly, at this time variables traps sent
  • So, if you want to check additional status counter - you would need to create zabbix-trap counter in web interface, and then add the same counter to script 'status' array to send it
  • Some graphs in templates provided are of type "logarithmic", fix template in notepad, or install zabbix patch
  • Also there is some extra bonus lines in script at the end. They are used for additional template "transactions/locks analyze". You can download it here (screenshot below):
    template_app_mysql_transactions.xml

No comments:

Post a Comment