Skip to content

La vie rêvée d’Akim

…ou le zèbre qui voulait être un homme

  • Style de vie
  • Informatique
  • Photographie
  • Musique
  • English (US)English (US)
  • FrançaisFrançais

Monitoring de mysql avec Zabbix 2.0

Posted on Monday 29 October 2012 - Friday 7 March 2014 by Akim

J’ai trouvé sur le net un template avec des scripts pour le monitoring de mysql dans Zabbix.

Voici donc traduction de l’article. Vous trouverez les scripts en bas de page.

Sur le serveur, importez le fichier mysql.xml dans les templates.

Sur le client, assurez-vous que php5 est installé et que le plugin php-mysql également, ainsi que php-cli.

Je considère que l’agent a été compilé depuis les sources et que le fichier de configuration est dans /usr/local/etc comme c’est le cas chez moi.

Créez un répertoire /usr/local/share/zabbix/plugins

Copiez dedans le fichier ss_get_mysql_stats.php

Copiez le fichier zabbixmysql.conf dans /usr/local/etc/

Editez le fichier /usr/local/etc/zabbis_agentd.conf, et ajoutez y

Include=/usr/local/etc/zabbixmysql.conf

Connectez-vous à mysql. Créez un utilisateur de base de donnée (par exemple zabbix) et accordez-lui les droits comme indiqué:

"GRANT PROCESS ON *.* TO 'zabbix'@'localhost' identified BY 'some_password';

Editez le /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php et modifier les paramètres d’authenfication dans la base de données:

$mysql_user = 'zabbix';
$mysql_pass = 'some_password';

Redémarrez l’agent.

Pour testez, vous pouvez exécuter par exemple une commande comme:

Sur le client:

zabbix_agentd -t mysql.Sort_scan

Sur le serveur:

zabbix_get -s agentip -k mysql.Sort_scan

Fichiers:

# Copyright 2010 (c) Brian Smith <brian@palominodb.com> and PalominoDB.
# Feedback and improvements are welcome.
#
# THIS PROGRAM IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
# MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, version 2.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place, Suite 330, Boston, MA  02111-1307  USA.
UserParameter=mysql.Key_read_requests,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items g0 | awk -F: '{ print $2 }'
UserParameter=mysql.Key_reads,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items g1 | awk -F: '{ prin	t $2 }'
UserParameter=mysql.Key_write_requests,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items g2 | awk -F: '{ print $2 }'
UserParameter=mysql.Key_writes,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items g3 | awk -F: '{ print $2 }'
UserParameter=mysql.history_list,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items g4 | awk -F: '{ print $2 }'
UserParameter=mysql.innodb_transactions,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items g5 | awk -F: '{ print $2 }'
UserParameter=mysql.read_views,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items g6 | awk -F: '{ print $2 }'
UserParameter=mysql.current_transactions,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items g7 | awk -F: '{ print $2 }'
UserParameter=mysql.locked_transactions,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items g8 | awk -F: '{ print $2 }'
UserParameter=mysql.active_transactions,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items g9 | awk -F: '{ print $2 }'
UserParameter=mysql.setting.pool_size,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items ga | awk -F: '{ print $2 }'
UserParameter=mysql.free_pages,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items gb | awk -F: '{ print $2 }'
UserParameter=mysql.database_pages,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items gc | awk -F: '{ print $2 }'
UserParameter=mysql.modified_pages,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items gd | awk -F: '{ print $2 }'
UserParameter=mysql.pages_read,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items ge | awk -F: '{ print $2 }'
UserParameter=mysql.pages_created,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items gf | awk -F: '{ print $2 }'
UserParameter=mysql.pages_written,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items gg | awk -F: '{ print $2 }'
UserParameter=mysql.file_fsyncs,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items gh | awk -F: '{ print $2 }'
UserParameter=mysql.file_reads,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items gi | awk -F: '{ print $2 }'
UserParameter=mysql.file_writes,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items gj | awk -F: '{ print $2 }'
UserParameter=mysql.log_writes,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items gk | awk -F: '{ print $2 }'
UserParameter=mysql.pending_aio_log_ios,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items gl | awk -F: '{ print $2 }'
UserParameter=mysql.pending_aio_sync_ios,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items gm | awk -F: '{ print $2 }'
UserParameter=mysql.pending_buf_pool_flushes,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items gn | awk -F: '{ print $2 }'
UserParameter=mysql.pending_chkp_writes,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items go | awk -F: '{ print $2 }'
UserParameter=mysql.pending_ibuf_aio_reads,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items gp | awk -F: '{ print $2 }'
UserParameter=mysql.pending_log_flushes,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items gq | awk -F: '{ print $2 }'
UserParameter=mysql.pending_log_writes,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items gr | awk -F: '{ print $2 }'
UserParameter=mysql.pending_normal_aio_reads,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items gs | awk -F: '{ print $2 }'
UserParameter=mysql.pending_normal_aio_writes,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items gt | awk -F: '{ print $2 }'
UserParameter=mysql.ibuf_inserts,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items gu | awk -F: '{ print $2 }'
UserParameter=mysql.ibuf_merged,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items gv | awk -F: '{ print $2 }'
UserParameter=mysql.ibuf_merges,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items gw | awk -F: '{ print $2 }'
UserParameter=mysql.spin_waits,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items gx | awk -F: '{ print $2 }'
UserParameter=mysql.spin_rounds,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items gy | awk -F: '{ print $2 }'
UserParameter=mysql.os_waits,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items gz | awk -F: '{ print $2 }'
UserParameter=mysql.rows_inserted,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items h0 | awk -F: '{ print $2 }'
UserParameter=mysql.rows_updated,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items h1 | awk -F: '{ print $2 }'
UserParameter=mysql.rows_deleted,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items h2 | awk -F: '{ print $2 }'
UserParameter=mysql.rows_read,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items h3 | awk -F: '{ print $2 }'
UserParameter=mysql.Table_locks_waited,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items h4 | awk -F: '{ print $2 }'
UserParameter=mysql.Table_locks_immediate,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items h5 | awk -F: '{ print $2 }'
UserParameter=mysql.Slow_queries,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items h6 | awk -F: '{ print $2 }'
UserParameter=mysql.Open_files,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items h7 | awk -F: '{ print $2 }'
UserParameter=mysql.Open_tables,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items h8 | awk -F: '{ print $2 }'
UserParameter=mysql.Opened_tables,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items h9 | awk -F: '{ print $2 }'
UserParameter=mysql.innodb_open_files,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items ha | awk -F: '{ print $2 }'
UserParameter=mysql.setting.open_files_limit,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items hb | awk -F: '{ print $2 }'
UserParameter=mysql.setting.table_cache,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items hc | awk -F: '{ print $2 }'
UserParameter=mysql.Aborted_clients,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items hd | awk -F: '{ print $2 }'
UserParameter=mysql.Aborted_connects,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items he | awk -F: '{ print $2 }'
UserParameter=mysql.Max_used_connections,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items hf | awk -F: '{ print $2 }'
UserParameter=mysql.Slow_launch_threads,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items hg | awk -F: '{ print $2 }'
UserParameter=mysql.Threads_cached,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items hh | awk -F: '{ print $2 }'
UserParameter=mysql.Threads_connected,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items hi | awk -F: '{ print $2 }'
UserParameter=mysql.Threads_created,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items hj | awk -F: '{ print $2 }'
UserParameter=mysql.Threads_running,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items hk | awk -F: '{ print $2 }'
UserParameter=mysql.setting.max_connections,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items hl | awk -F: '{ print $2 }'
UserParameter=mysql.setting.thread_cache_size,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items hm | awk -F: '{ print $2 }'
UserParameter=mysql.Connections,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items hn | awk -F: '{ print $2 }'
UserParameter=mysql.slave_running,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items ho | awk -F: '{ print $2 }'
UserParameter=mysql.slave_stopped,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items hp | awk -F: '{ print $2 }'
UserParameter=mysql.Slave_retried_transactions,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items hq | awk -F: '{ print $2 }'
UserParameter=mysql.slave_lag,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items hr | awk -F: '{ print $2 }'
UserParameter=mysql.Slave_open_temp_tables,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items hs | awk -F: '{ print $2 }'
UserParameter=mysql.Qcache_free_blocks,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items ht | awk -F: '{ print $2 }'
UserParameter=mysql.Qcache_free_memory,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items hu | awk -F: '{ print $2 }'
UserParameter=mysql.Qcache_hits,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items hv | awk -F: '{ print $2 }'
UserParameter=mysql.Qcache_inserts,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items hw | awk -F: '{ print $2 }'
UserParameter=mysql.Qcache_lowmem_prunes,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items hx | awk -F: '{ print $2 }'
UserParameter=mysql.Qcache_not_cached,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items hy | awk -F: '{ print $2 }'
UserParameter=mysql.Qcache_queries_in_cache,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items hz | awk -F: '{ print $2 }'
UserParameter=mysql.Qcache_total_blocks,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items i0 | awk -F: '{ print $2 }'
UserParameter=mysql.setting.query_cache_size,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items i1 | awk -F: '{ print $2 }'
UserParameter=mysql.Questions,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items i2 | awk -F: '{ print $2 }'
UserParameter=mysql.Com_update,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items i3 | awk -F: '{ print $2 }'
UserParameter=mysql.Com_insert,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items i4 | awk -F: '{ print $2 }'
UserParameter=mysql.Com_select,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items i5 | awk -F: '{ print $2 }'
UserParameter=mysql.Com_delete,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items i6 | awk -F: '{ print $2 }'
UserParameter=mysql.Com_replace,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items i7 | awk -F: '{ print $2 }'
UserParameter=mysql.Com_load,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items i8 | awk -F: '{ print $2 }'
UserParameter=mysql.Com_update_multi,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items i9 | awk -F: '{ print $2 }'
UserParameter=mysql.Com_insert_select,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items ia | awk -F: '{ print $2 }'
UserParameter=mysql.Com_delete_multi,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items ib | awk -F: '{ print $2 }'
UserParameter=mysql.Com_replace_select,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items ic | awk -F: '{ print $2 }'
UserParameter=mysql.Select_full_join,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items id | awk -F: '{ print $2 }'
UserParameter=mysql.Select_full_range_join,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items ie | awk -F: '{ print $2 }'
UserParameter=mysql.Select_range,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items if | awk -F: '{ print $2 }'
UserParameter=mysql.Select_range_check,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items ig | awk -F: '{ print $2 }'
UserParameter=mysql.Select_scan,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items ih | awk -F: '{ print $2 }'
UserParameter=mysql.Sort_merge_passes,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items ii | awk -F: '{ print $2 }'
UserParameter=mysql.Sort_range,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items ij | awk -F: '{ print $2 }'
UserParameter=mysql.Sort_rows,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items ik | awk -F: '{ print $2 }'
UserParameter=mysql.Sort_scan,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items il | awk -F: '{ print $2 }'
UserParameter=mysql.Created_tmp_tables,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items im | awk -F: '{ print $2 }'
UserParameter=mysql.Created_tmp_disk_tables,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items in | awk -F: '{ print $2 }'
UserParameter=mysql.Created_tmp_files,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items io | awk -F: '{ print $2 }'
UserParameter=mysql.Bytes_sent,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items ip | awk -F: '{ print $2 }'
UserParameter=mysql.Bytes_received,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items iq | awk -F: '{ print $2 }'
UserParameter=mysql.innodb_log_buffer_size,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items ir | awk -F: '{ print $2 }'
UserParameter=mysql.unflushed_log,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items is | awk -F: '{ print $2 }'
UserParameter=mysql.log_bytes_flushed,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items it | awk -F: '{ print $2 }'
UserParameter=mysql.log_bytes_written,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items iu | awk -F: '{ print $2 }'
UserParameter=mysql.relay_log_space,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items iv | awk -F: '{ print $2 }'
UserParameter=mysql.setting.binlog_cache_size,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items iw | awk -F: '{ print $2 }'
UserParameter=mysql.Binlog_cache_disk_use,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items ix | awk -F: '{ print $2 }'
UserParameter=mysql.Binlog_cache_use,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items iy | awk -F: '{ print $2 }'
UserParameter=mysql.binary_log_space,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items iz | awk -F: '{ print $2 }'
UserParameter=mysql.innodb_locked_tables,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items j0 | awk -F: '{ print $2 }'
UserParameter=mysql.innodb_lock_structs,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items j1 | awk -F: '{ print $2 }'
UserParameter=mysql.State_closing_tables,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items j2 | awk -F: '{ print $2 }'
UserParameter=mysql.State_copying_to_tmp_table,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items j3 | awk -F: '{ print $2 }'
UserParameter=mysql.State_end,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items j4 | awk -F: '{ print $2 }'
UserParameter=mysql.State_freeing_items,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items j5 | awk -F: '{ print $2 }'
UserParameter=mysql.State_init,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items j6 | awk -F: '{ print $2 }'
UserParameter=mysql.State_locked,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items j7 | awk -F: '{ print $2 }'
UserParameter=mysql.State_login,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items j8 | awk -F: '{ print $2 }'
UserParameter=mysql.State_preparing,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items j9 | awk -F: '{ print $2 }'
UserParameter=mysql.State_reading_from_net,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items ja | awk -F: '{ print $2 }'
UserParameter=mysql.State_sending_data,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items jb | awk -F: '{ print $2 }'
UserParameter=mysql.State_sorting_result,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items jc | awk -F: '{ print $2 }'
UserParameter=mysql.State_statistics,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items jd | awk -F: '{ print $2 }'
UserParameter=mysql.State_updating,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items je | awk -F: '{ print $2 }'
UserParameter=mysql.State_writing_to_net,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items jf | awk -F: '{ print $2 }'
UserParameter=mysql.State_none,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items jg | awk -F: '{ print $2 }'
UserParameter=mysql.State_other,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items jh | awk -F: '{ print $2 }'
UserParameter=mysql.Handler_commit,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items ji | awk -F: '{ print $2 }'
UserParameter=mysql.Handler_delete,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items jj | awk -F: '{ print $2 }'
UserParameter=mysql.Handler_discover,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items jk | awk -F: '{ print $2 }'
UserParameter=mysql.Handler_prepare,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items jl | awk -F: '{ print $2 }'
UserParameter=mysql.Handler_read_first,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items jm | awk -F: '{ print $2 }'
UserParameter=mysql.Handler_read_key,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items jn | awk -F: '{ print $2 }'
UserParameter=mysql.Handler_read_next,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items jo | awk -F: '{ print $2 }'
UserParameter=mysql.Handler_read_prev,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items jp | awk -F: '{ print $2 }'
UserParameter=mysql.Handler_read_rnd,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items jq | awk -F: '{ print $2 }'
UserParameter=mysql.Handler_read_rnd_next,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items jr | awk -F: '{ print $2 }'
UserParameter=mysql.Handler_rollback,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items js | awk -F: '{ print $2 }'
UserParameter=mysql.Handler_savepoint,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items jt | awk -F: '{ print $2 }'
UserParameter=mysql.Handler_savepoint_rollback,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items ju | awk -F: '{ print $2 }'
UserParameter=mysql.Handler_update,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items jv | awk -F: '{ print $2 }'
UserParameter=mysql.Handler_write,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items jw | awk -F: '{ print $2 }'
UserParameter=mysql.innodb_tables_in_use,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items jx | awk -F: '{ print $2 }'
UserParameter=mysql.innodb_lock_wait_secs,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items jy | awk -F: '{ print $2 }'
UserParameter=mysql.hash_index_cells_total,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items jz | awk -F: '{ print $2 }'
UserParameter=mysql.hash_index_cells_used,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items k0 | awk -F: '{ print $2 }'
UserParameter=mysql.total_mem_alloc,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items k1 | awk -F: '{ print $2 }'
UserParameter=mysql.additional_pool_alloc,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items k2 | awk -F: '{ print $2 }'
UserParameter=mysql.uncheckpointed_bytes,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items k3 | awk -F: '{ print $2 }'
UserParameter=mysql.ibuf_used_cells,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items k4 | awk -F: '{ print $2 }'
UserParameter=mysql.ibuf_free_cells,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items k5 | awk -F: '{ print $2 }'
UserParameter=mysql.ibuf_cell_count,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items k6 | awk -F: '{ print $2 }'
UserParameter=mysql.adaptive_hash_memory,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items k7 | awk -F: '{ print $2 }'
UserParameter=mysql.page_hash_memory,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items k8 | awk -F: '{ print $2 }'
UserParameter=mysql.dictionary_cache_memory,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items k9 | awk -F: '{ print $2 }'
UserParameter=mysql.file_system_memory,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items ka | awk -F: '{ print $2 }'
UserParameter=mysql.lock_system_memory,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items kb | awk -F: '{ print $2 }'
UserParameter=mysql.recovery_system_memory,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items kc | awk -F: '{ print $2 }'
UserParameter=mysql.thread_hash_memory,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items kd | awk -F: '{ print $2 }'
UserParameter=mysql.innodb_sem_waits,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items ke | awk -F: '{ print $2 }'
UserParameter=mysql.innodb_sem_wait_time_ms,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items kf | awk -F: '{ print $2 }'
UserParameter=mysql.Key_buf_bytes_unflushed,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items kg | awk -F: '{ print $2 }'
UserParameter=mysql.Key_buf_bytes_used,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items kh | awk -F: '{ print $2 }'
UserParameter=mysql.setting.key_buffer_size,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items ki | awk -F: '{ print $2 }'
UserParameter=mysql.Innodb_row_lock_time,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items kj | awk -F: '{ print $2 }'
UserParameter=mysql.Innodb_row_lock_waits,/usr/bin/php /usr/local/share/zabbix/plugins/ss_get_mysql_stats.php --host localhost --items kk | awk -F: '{ print $2 }'
<?php # ============================================================================ # This program is part of Percona Monitoring Plugins # License: GPL License (see COPYING) # Copyright 2008-2012 Baron Schwartz, 2012 Percona Inc. # Authors: #  Baron Schwartz # ============================================================================ # ============================================================================ # To make this code testable, we need to prevent code from running when it is # included from the test script.  The test script and this file have different # filenames, so we can compare them.  In some cases $_SERVER['SCRIPT_FILENAME'] # seems not to be defined, so we skip the check -- this check should certainly # pass in the test environment. # ============================================================================ if ( !array_key_exists('SCRIPT_FILENAME', $_SERVER)    || basename(__FILE__) == basename($_SERVER['SCRIPT_FILENAME']) ) { # ============================================================================ # CONFIGURATION # ============================================================================ # Define MySQL connection constants in config.php.  Arguments explicitly passed # in from Cacti will override these.  However, if you leave them blank in Cacti # and set them here, you can make life easier.  Instead of defining parameters # here, you can define them in another file named the same as this file, with a # .cnf extension. # ============================================================================ $mysql_user = 'mysqluser'; $mysql_pass = 'mysqlpass'; $mysql_port = 3306; $mysql_ssl  = FALSE;   # Whether to use SSL to connect to MySQL. $heartbeat  = '';      # db.tbl if you use pt-heartbeat from Percona Toolkit. $cache_dir  = '/tmp';  # If set, this uses caching to avoid multiple calls. $poll_time  = 300;     # Adjust to match your polling interval. $timezone   = null;    # If not set, uses the system default.  Example: "UTC" $chk_options = array (    'innodb'  => true,    # Do you want to check InnoDB statistics?
   'master'  => true,    # Do you want to check binary logging?
   'slave'   => true,    # Do you want to check slave status?
   'procs'   => true,    # Do you want to check SHOW PROCESSLIST?
   'get_qrt' => true,    # Get query response times from Percona Server?
);

$use_ss    = FALSE; # Whether to use the script server or not
$debug     = FALSE; # Define whether you want debugging behavior.
$debug_log = '/tmp/alpha'; # If $debug_log is a filename, it'll be used.

# ============================================================================
# You should not need to change anything below this line.
# ============================================================================
$version = '1.0.0';

# ============================================================================
# Include settings from an external config file (issue 39).
# ============================================================================
if ( file_exists(__FILE__ . '.cnf' ) ) {
   debug("Found configuration file " . __FILE__ . ".cnf");
   require(__FILE__ . '.cnf');
}

# Make this a happy little script even when there are errors.
$no_http_headers = true;
ini_set('implicit_flush', false); # No output, ever.
if ( $debug ) {
   ini_set('display_errors', true);
   ini_set('display_startup_errors', true);
   ini_set('error_reporting', 2147483647);
}
else {
   ini_set('error_reporting', E_ERROR);
}
ob_start(); # Catch all output such as notices of undefined array indexes.
function error_handler($errno, $errstr, $errfile, $errline) {
   print("$errstr at $errfile line $errline\n");
   debug("$errstr at $errfile line $errline");
}
# ============================================================================
# Set up the stuff we need to be called by the script server.
# ============================================================================
if ( $use_ss ) {
   if ( file_exists( dirname(__FILE__) . "/../include/global.php") ) {
      # See issue 5 for the reasoning behind this.
      debug("including " . dirname(__FILE__) . "/../include/global.php");
      include_once(dirname(__FILE__) . "/../include/global.php");
   }
   elseif ( file_exists( dirname(__FILE__) . "/../include/config.php" ) ) {
      # Some Cacti installations don't have global.php.
      debug("including " . dirname(__FILE__) . "/../include/config.php");
      include_once(dirname(__FILE__) . "/../include/config.php");
   }
}

# ============================================================================
# Set the default timezone either to the configured, system timezone, or the
# default set above in the script.
# ============================================================================
if ( function_exists("date_default_timezone_set")
   && function_exists("date_default_timezone_get") ) {
   $tz = ($timezone ? $timezone : @date_default_timezone_get());
   if ( $tz ) {
      @date_default_timezone_set($tz);
   }
}

# ============================================================================
# Make sure we can also be called as a script.
# ============================================================================
if (!isset($called_by_script_server)) {
   debug($_SERVER["argv"]);
   array_shift($_SERVER["argv"]); # Strip off this script's filename
   $options = parse_cmdline($_SERVER["argv"]);
   validate_options($options);
   $result = ss_get_mysql_stats($options);
   debug($result);
   if ( !$debug ) {
      # Throw away the buffer, which ought to contain only errors.
      ob_end_clean();
   }
   else {
      ob_end_flush(); # In debugging mode, print out the errors.
   }

   # Split the result up and extract only the desired parts of it.
   $wanted = explode(',', $options['items']);
   $output = array();
   foreach ( explode(' ', $result) as $item ) {
      if ( in_array(substr($item, 0, 2), $wanted) ) {
         $output[] = $item;
      }
   }
   debug(array("Final result", $output));
   print(implode(' ', $output));
}

# ============================================================================
# End "if file was not included" section.
# ============================================================================
}

# ============================================================================
# Work around the lack of array_change_key_case in older PHP.
# ============================================================================
if ( !function_exists('array_change_key_case') ) {
   function array_change_key_case($arr) {
      $res = array();
      foreach ( $arr as $key => $val ) {
         $res[strtolower($key)] = $val;
      }
      return $res;
   }
}

# ============================================================================
# Validate that the command-line options are here and correct
# ============================================================================
function validate_options($options) {
   debug($options);
   $opts = array('host', 'items', 'user', 'pass', 'heartbeat', 'nocache', 'port');
   # Required command-line options
   foreach ( array('host', 'items') as $option ) {
      if ( !isset($options[$option]) || !$options[$option] ) {
         usage("Required option --$option is missing");
      }
   }
   foreach ( $options as $key => $val ) {
      if ( !in_array($key, $opts) ) {
         usage("Unknown option --$key");
      }
   }
}

# ============================================================================
# Print out a brief usage summary
# ============================================================================
function usage($message) {
   global $mysql_user, $mysql_pass, $mysql_port, $heartbeat;

   $usage = << --items <item,...> [OPTION]

   --host      Hostname to connect to; use host:port syntax to specify a port
               Use :/path/to/socket if you want to connect via a UNIX socket
   --items     Comma-separated list of the items whose data you want
   --user      MySQL username; defaults to $mysql_user if not given
   --pass      MySQL password; defaults to $mysql_pass if not given
   --heartbeat MySQL heartbeat table; defaults to '$heartbeat' (see pt-heartbeat)
   --nocache   Do not cache results in a file
   --port      MySQL port; defaults to $mysql_port if not given
   --mysql_ssl Add the MYSQL_CLIENT_SSL flag to mysql_connect() call

EOF;
   die($usage);
}

# ============================================================================
# Parse command-line arguments, in the format --arg value --arg value, and
# return them as an array ( arg => value )
# ============================================================================
function parse_cmdline( $args ) {
   $result = array();
   $cur_arg = '';
   foreach ($args as $val) {
      if ( strpos($val, '--') === 0 ) {
         if ( strpos($val, '--no') === 0 ) {
            # It's an option without an argument, but it's a --nosomething so
            # it's OK.
            $result[substr($val, 2)] = 1;
            $cur_arg = '';
         }
         elseif ( $cur_arg ) { # Maybe the last --arg was an option with no arg
            if ( $cur_arg == '--user' || $cur_arg == '--pass' || $cur_arg == '--port' ) {
               # Special case because Cacti will pass these without an arg
               $cur_arg = '';
            }
            else {
               die("No arg: $cur_arg\n");
            }
         }
         else {
            $cur_arg = $val;
         }
      }
      else {
         $result[substr($cur_arg, 2)] = $val;
         $cur_arg = '';
      }
   }
   if ( $cur_arg && ($cur_arg != '--user' && $cur_arg != '--pass' && $cur_arg != '--port') ) {
      die("No arg: $cur_arg\n");
   }
   debug($result);
   return $result;
}

# ============================================================================
# This is the main function.  Some parameters are filled in from defaults at the
# top of this file.
# ============================================================================
function ss_get_mysql_stats( $options ) {
   # Process connection options and connect to MySQL.
   global $debug, $mysql_user, $mysql_pass, $heartbeat, $cache_dir, $poll_time,
          $chk_options, $mysql_port, $mysql_ssl;

   # Connect to MySQL.
   $user = isset($options['user']) ? $options['user'] : $mysql_user;
   $pass = isset($options['pass']) ? $options['pass'] : $mysql_pass;
   $port = isset($options['port']) ? $options['port'] : $mysql_port;
   $heartbeat = isset($options['heartbeat']) ? $options['heartbeat'] : $heartbeat;
   # If there is a port, or if it's a non-standard port, we add ":$port" to the
   # hostname.
   $host_str  = $options['host']
              . (isset($options['port']) || $port != 3306 ? ":$port" : '');
   debug(array('connecting to', $host_str, $user, $pass));
   if ( !extension_loaded('mysql') ) {
      debug("The MySQL extension is not loaded");
      die("The MySQL extension is not loaded");
   }
   if ( $mysql_ssl || (isset($options['mysql_ssl']) && $options['mysql_ssl']) ) {
      $conn = mysql_connect($host_str, $user, $pass, true, MYSQL_CLIENT_SSL);
   }
   else {
      $conn = mysql_connect($host_str, $user, $pass);
   }
   if ( !$conn ) {
      debug("MySQL connection failed: " . mysql_error());
      die("MySQL: " . mysql_error());
   }

   $sanitized_host
       = str_replace(array(":", "/"), array("", "_"), $options['host']);
   $cache_file = "$cache_dir/$sanitized_host-mysql_cacti_stats.txt"
               . (isset($options['port']) || $port != 3306 ? ":$port" : '');
   debug("Cache file is $cache_file");

   # First, check the cache.
   $fp = null;
   if ( !isset($options['nocache']) ) {
      if ( $fp = fopen($cache_file, 'a+') ) {
         $locked = flock($fp, 1); # LOCK_SH
         if ( $locked ) {
            if ( filesize($cache_file) > 0
               && filectime($cache_file) + ($poll_time/2) > time()
               && ($arr = file($cache_file))
            ) {# The cache file is good to use.
               debug("Using the cache file");
               fclose($fp);
               return $arr[0];
            }
            else {
               debug("The cache file seems too small or stale");
               # Escalate the lock to exclusive, so we can write to it.
               if ( flock($fp, 2) ) { # LOCK_EX
                  # We might have blocked while waiting for that LOCK_EX, and
                  # another process ran and updated it.  Let's see if we can just
                  # return the data now:
                  if ( filesize($cache_file) > 0
                     && filectime($cache_file) + ($poll_time/2) > time()
                     && ($arr = file($cache_file))
                  ) {# The cache file is good to use.
                     debug("Using the cache file");
                     fclose($fp);
                     return $arr[0];
                  }
                  ftruncate($fp, 0); # Now it's ready for writing later.
               }
            }
         }
         else {
            debug("Couldn't lock the cache file, ignoring it.");
            $fp = null;
         }
      }
   }
   else {
      $fp = null;
      debug("Couldn't open the cache file");
   }

   # Set up variables.
   $status = array( # Holds the result of SHOW STATUS, SHOW INNODB STATUS, etc
      # Define some indexes so they don't cause errors with += operations.
      'relay_log_space'          => null,
      'binary_log_space'         => null,
      'current_transactions'     => 0,
      'locked_transactions'      => 0,
      'active_transactions'      => 0,
      'innodb_locked_tables'     => 0,
      'innodb_tables_in_use'     => 0,
      'innodb_lock_structs'      => 0,
      'innodb_lock_wait_secs'    => 0,
      'innodb_sem_waits'         => 0,
      'innodb_sem_wait_time_ms'  => 0,
      # Values for the 'state' column from SHOW PROCESSLIST (converted to
      # lowercase, with spaces replaced by underscores)
      'State_closing_tables'       => null,
      'State_copying_to_tmp_table' => null,
      'State_end'                  => null,
      'State_freeing_items'        => null,
      'State_init'                 => null,
      'State_locked'               => null,
      'State_login'                => null,
      'State_preparing'            => null,
      'State_reading_from_net'     => null,
      'State_sending_data'         => null,
      'State_sorting_result'       => null,
      'State_statistics'           => null,
      'State_updating'             => null,
      'State_writing_to_net'       => null,
      'State_none'                 => null,
      'State_other'                => null, # Everything not listed above
   );

   # Get SHOW STATUS and convert the name-value array into a simple
   # associative array.
   $result = run_query("SHOW /*!50002 GLOBAL */ STATUS", $conn);
   foreach ( $result as $row ) {
      $status[$row[0]] = $row[1];
   }

   # Get SHOW VARIABLES and do the same thing, adding it to the $status array.
   $result = run_query("SHOW VARIABLES", $conn);
   foreach ( $result as $row ) {
      $status[$row[0]] = $row[1];
   }

   # Get SHOW SLAVE STATUS, and add it to the $status array.
   if ( $chk_options['slave'] ) {
      $result = run_query("SHOW SLAVE STATUS", $conn);
      $slave_status_rows_gotten = 0;
      foreach ( $result as $row ) {
         $slave_status_rows_gotten++;
         # Must lowercase keys because different MySQL versions have different
         # lettercase.
         $row = array_change_key_case($row, CASE_LOWER);
         $status['relay_log_space']  = $row['relay_log_space'];
         $status['slave_lag']        = $row['seconds_behind_master'];

         # Check replication heartbeat, if present.
         if ( $heartbeat ) {
            $result2 = run_query(
               "SELECT MAX(GREATEST(0, UNIX_TIMESTAMP() - UNIX_TIMESTAMP(ts) - 1))"
               . " AS delay FROM $heartbeat", $conn);
            $slave_delay_rows_gotten = 0;
            foreach ( $result2 as $row2 ) {
               $slave_delay_rows_gotten++;
               if ( $row2 && is_array($row2)
                  && array_key_exists('delay', $row2) )
               {
                  $status['slave_lag'] = $row2['delay'];
               }
               else {
                  debug("Couldn't get slave lag from $heartbeat");
               }
            }
            if ( $slave_delay_rows_gotten == 0 ) {
               debug("Got nothing from heartbeat query");
            }
         }

         # Scale slave_running and slave_stopped relative to the slave lag.
         $status['slave_running'] = ($row['slave_sql_running'] == 'Yes')
            ? $status['slave_lag'] : 0;
         $status['slave_stopped'] = ($row['slave_sql_running'] == 'Yes')
            ? 0 : $status['slave_lag'];
      }
      if ( $slave_status_rows_gotten == 0 ) {
         debug("Got nothing from SHOW SLAVE STATUS");
      }
   }

   # Get SHOW MASTER STATUS, and add it to the $status array.
   if ( $chk_options['master']
         && array_key_exists('log_bin', $status)
         && $status['log_bin'] == 'ON'
   ) { # See issue #8
      $binlogs = array(0);
      $result = run_query("SHOW MASTER LOGS", $conn);
      foreach ( $result as $row ) {
         $row = array_change_key_case($row, CASE_LOWER);
         # Older versions of MySQL may not have the File_size column in the
         # results of the command.  Zero-size files indicate the user is
         # deleting binlogs manually from disk (bad user! bad!).
         if ( array_key_exists('file_size', $row) && $row['file_size'] > 0 ) {
            $binlogs[] = $row['file_size'];
         }
      }
      if (count($binlogs)) {
         $status['binary_log_space'] = to_int(array_sum($binlogs));
      }
   }

   # Get SHOW PROCESSLIST and aggregate it by state, then add it to the array
   # too.
   if ( $chk_options['procs'] ) {
      $result = run_query('SHOW PROCESSLIST', $conn);
      foreach ( $result as $row ) {
         $state = $row['State'];
         if ( is_null($state) ) {
            $state = 'NULL';
         }
         if ( $state == '' ) {
            $state = 'none';
         }
         # MySQL 5.5 replaces the 'Locked' state with a variety of "Waiting for
         # X lock" types of statuses.  Wrap these all back into "Locked" because
         # we don't really care about the type of locking it is.
         $state = preg_replace('/^(Table lock|Waiting for .*lock)$/', 'Locked', $state);
         $state = str_replace(' ', '_', strtolower($state));
         if ( array_key_exists("State_$state", $status) ) {
            increment($status, "State_$state", 1);
         }
         else {
            increment($status, "State_other", 1);
         }
      }
   }

   # Get SHOW INNODB STATUS and extract the desired metrics from it, then add
   # those to the array too.
   if ( $chk_options['innodb']
         && array_key_exists('have_innodb', $status)
         && $status['have_innodb'] == 'YES'
   ) {
      $result        = run_query("SHOW /*!50000 ENGINE*/ INNODB STATUS", $conn);
      $istatus_text = $result[0]['Status'];
      $istatus_vals = get_innodb_array($istatus_text);

      # Get response time histogram from Percona Server if enabled.
      if ( $chk_options['get_qrt']
           && isset($status['have_response_time_distribution']) 
           &&      ($status['have_response_time_distribution'] == 'YES'))
      {
         debug('Getting query time histogram');
         $i = 0;
         $result = run_query(
            "SELECT `count`, total * 1000000 AS total "
               . "FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME "
               . "WHERE `time` <> 'TOO LONG'",
            $conn);
         foreach ( $result as $row ) {
            if ( $i > 13 ) {
               # It's possible that the number of rows returned isn't 14.
               # Don't add extra status counters.
               break;
            }
            $count_key = sprintf("Query_time_count_%02d", $i);
            $total_key = sprintf("Query_time_total_%02d", $i);
            $status[$count_key] = $row['count'];
            $status[$total_key] = $row['total'];
            $i++;
         }
         # It's also possible that the number of rows returned is too few.
         # Don't leave any status counters unassigned; it will break graphs.
         while ( $i <= 13 ) {             $count_key = sprintf("Query_time_count_%02d", $i);             $total_key = sprintf("Query_time_total_%02d", $i);             $status[$count_key] = 0;             $status[$total_key] = 0;             $i++;          }       }       else {          debug('Not getting time histogram because it is not enabled');       }       # Override values from InnoDB parsing with values from SHOW STATUS,       # because InnoDB status might not have everything and the SHOW STATUS is       # to be preferred where possible.       $overrides = array(          'Innodb_buffer_pool_pages_data'  => 'database_pages',
         'Innodb_buffer_pool_pages_dirty' => 'modified_pages',
         'Innodb_buffer_pool_pages_free'  => 'free_pages',
         'Innodb_buffer_pool_pages_total' => 'pool_size',
         'Innodb_data_fsyncs'             => 'file_fsyncs',
         'Innodb_data_pending_reads'      => 'pending_normal_aio_reads',
         'Innodb_data_pending_writes'     => 'pending_normal_aio_writes',
         'Innodb_os_log_pending_fsyncs'   => 'pending_log_flushes',
         'Innodb_pages_created'           => 'pages_created',
         'Innodb_pages_read'              => 'pages_read',
         'Innodb_pages_written'           => 'pages_written',
         'Innodb_rows_deleted'            => 'rows_deleted',
         'Innodb_rows_inserted'           => 'rows_inserted',
         'Innodb_rows_read'               => 'rows_read',
         'Innodb_rows_updated'            => 'rows_updated',
      );

      # If the SHOW STATUS value exists, override...
      foreach ( $overrides as $key => $val ) {
         if ( array_key_exists($key, $status) ) {
            debug("Override $key");
            $istatus_vals[$val] = $status[$key];
         }
      }

      # Now copy the values into $status.
      foreach ( $istatus_vals as $key => $val ) {
         $status[$key] = $istatus_vals[$key];
      }
   }

   # Make table_open_cache backwards-compatible (issue 63).
   if ( array_key_exists('table_open_cache', $status) ) {
      $status['table_cache'] = $status['table_open_cache'];
   }

   # Compute how much of the key buffer is used and unflushed (issue 127).
   $status['Key_buf_bytes_used']
      = big_sub($status['key_buffer_size'],
         big_multiply($status['Key_blocks_unused'],
         $status['key_cache_block_size']));
   $status['Key_buf_bytes_unflushed']
      = big_multiply($status['Key_blocks_not_flushed'],
         $status['key_cache_block_size']);

   if ( array_key_exists('unflushed_log', $status)
         && $status['unflushed_log']
   ) {
      # TODO: I'm not sure what the deal is here; need to debug this.  But the
      # unflushed log bytes spikes a lot sometimes and it's impossible for it to
      # be more than the log buffer.
      debug("Unflushed log: $status[unflushed_log]");
      $status['unflushed_log']
         = max($status['unflushed_log'], $status['innodb_log_buffer_size']);
   }

   # Define the variables to output.  I use shortened variable names so maybe
   # it'll all fit in 1024 bytes for Cactid and Spine's benefit.  Strings must
   # have some non-hex characters (non a-f0-9) to avoid a Cacti bug.  This list
   # must come right after the word MAGIC_VARS_DEFINITIONS.  The Perl script
   # parses it and uses it as a Perl variable.
   $keys = array(
      'Key_read_requests'           =>  'g0',
      'Key_reads'                   =>  'g1',
      'Key_write_requests'          =>  'g2',
      'Key_writes'                  =>  'g3',
      'history_list'                =>  'g4',
      'innodb_transactions'         =>  'g5',
      'read_views'                  =>  'g6',
      'current_transactions'        =>  'g7',
      'locked_transactions'         =>  'g8',
      'active_transactions'         =>  'g9',
      'pool_size'                   =>  'ga',
      'free_pages'                  =>  'gb',
      'database_pages'              =>  'gc',
      'modified_pages'              =>  'gd',
      'pages_read'                  =>  'ge',
      'pages_created'               =>  'gf',
      'pages_written'               =>  'gg',
      'file_fsyncs'                 =>  'gh',
      'file_reads'                  =>  'gi',
      'file_writes'                 =>  'gj',
      'log_writes'                  =>  'gk',
      'pending_aio_log_ios'         =>  'gl',
      'pending_aio_sync_ios'        =>  'gm',
      'pending_buf_pool_flushes'    =>  'gn',
      'pending_chkp_writes'         =>  'go',
      'pending_ibuf_aio_reads'      =>  'gp',
      'pending_log_flushes'         =>  'gq',
      'pending_log_writes'          =>  'gr',
      'pending_normal_aio_reads'    =>  'gs',
      'pending_normal_aio_writes'   =>  'gt',
      'ibuf_inserts'                =>  'gu',
      'ibuf_merged'                 =>  'gv',
      'ibuf_merges'                 =>  'gw',
      'spin_waits'                  =>  'gx',
      'spin_rounds'                 =>  'gy',
      'os_waits'                    =>  'gz',
      'rows_inserted'               =>  'h0',
      'rows_updated'                =>  'h1',
      'rows_deleted'                =>  'h2',
      'rows_read'                   =>  'h3',
      'Table_locks_waited'          =>  'h4',
      'Table_locks_immediate'       =>  'h5',
      'Slow_queries'                =>  'h6',
      'Open_files'                  =>  'h7',
      'Open_tables'                 =>  'h8',
      'Opened_tables'               =>  'h9',
      'innodb_open_files'           =>  'ha',
      'open_files_limit'            =>  'hb',
      'table_cache'                 =>  'hc',
      'Aborted_clients'             =>  'hd',
      'Aborted_connects'            =>  'he',
      'Max_used_connections'        =>  'hf',
      'Slow_launch_threads'         =>  'hg',
      'Threads_cached'              =>  'hh',
      'Threads_connected'           =>  'hi',
      'Threads_created'             =>  'hj',
      'Threads_running'             =>  'hk',
      'max_connections'             =>  'hl',
      'thread_cache_size'           =>  'hm',
      'Connections'                 =>  'hn',
      'slave_running'               =>  'ho',
      'slave_stopped'               =>  'hp',
      'Slave_retried_transactions'  =>  'hq',
      'slave_lag'                   =>  'hr',
      'Slave_open_temp_tables'      =>  'hs',
      'Qcache_free_blocks'          =>  'ht',
      'Qcache_free_memory'          =>  'hu',
      'Qcache_hits'                 =>  'hv',
      'Qcache_inserts'              =>  'hw',
      'Qcache_lowmem_prunes'        =>  'hx',
      'Qcache_not_cached'           =>  'hy',
      'Qcache_queries_in_cache'     =>  'hz',
      'Qcache_total_blocks'         =>  'i0',
      'query_cache_size'            =>  'i1',
      'Questions'                   =>  'i2',
      'Com_update'                  =>  'i3',
      'Com_insert'                  =>  'i4',
      'Com_select'                  =>  'i5',
      'Com_delete'                  =>  'i6',
      'Com_replace'                 =>  'i7',
      'Com_load'                    =>  'i8',
      'Com_update_multi'            =>  'i9',
      'Com_insert_select'           =>  'ia',
      'Com_delete_multi'            =>  'ib',
      'Com_replace_select'          =>  'ic',
      'Select_full_join'            =>  'id',
      'Select_full_range_join'      =>  'ie',
      'Select_range'                =>  'if',
      'Select_range_check'          =>  'ig',
      'Select_scan'                 =>  'ih',
      'Sort_merge_passes'           =>  'ii',
      'Sort_range'                  =>  'ij',
      'Sort_rows'                   =>  'ik',
      'Sort_scan'                   =>  'il',
      'Created_tmp_tables'          =>  'im',
      'Created_tmp_disk_tables'     =>  'in',
      'Created_tmp_files'           =>  'io',
      'Bytes_sent'                  =>  'ip',
      'Bytes_received'              =>  'iq',
      'innodb_log_buffer_size'      =>  'ir',
      'unflushed_log'               =>  'is',
      'log_bytes_flushed'           =>  'it',
      'log_bytes_written'           =>  'iu',
      'relay_log_space'             =>  'iv',
      'binlog_cache_size'           =>  'iw',
      'Binlog_cache_disk_use'       =>  'ix',
      'Binlog_cache_use'            =>  'iy',
      'binary_log_space'            =>  'iz',
      'innodb_locked_tables'        =>  'j0',
      'innodb_lock_structs'         =>  'j1',
      'State_closing_tables'        =>  'j2',
      'State_copying_to_tmp_table'  =>  'j3',
      'State_end'                   =>  'j4',
      'State_freeing_items'         =>  'j5',
      'State_init'                  =>  'j6',
      'State_locked'                =>  'j7',
      'State_login'                 =>  'j8',
      'State_preparing'             =>  'j9',
      'State_reading_from_net'      =>  'ja',
      'State_sending_data'          =>  'jb',
      'State_sorting_result'        =>  'jc',
      'State_statistics'            =>  'jd',
      'State_updating'              =>  'je',
      'State_writing_to_net'        =>  'jf',
      'State_none'                  =>  'jg',
      'State_other'                 =>  'jh',
      'Handler_commit'              =>  'ji',
      'Handler_delete'              =>  'jj',
      'Handler_discover'            =>  'jk',
      'Handler_prepare'             =>  'jl',
      'Handler_read_first'          =>  'jm',
      'Handler_read_key'            =>  'jn',
      'Handler_read_next'           =>  'jo',
      'Handler_read_prev'           =>  'jp',
      'Handler_read_rnd'            =>  'jq',
      'Handler_read_rnd_next'       =>  'jr',
      'Handler_rollback'            =>  'js',
      'Handler_savepoint'           =>  'jt',
      'Handler_savepoint_rollback'  =>  'ju',
      'Handler_update'              =>  'jv',
      'Handler_write'               =>  'jw',
      'innodb_tables_in_use'        =>  'jx',
      'innodb_lock_wait_secs'       =>  'jy',
      'hash_index_cells_total'      =>  'jz',
      'hash_index_cells_used'       =>  'k0',
      'total_mem_alloc'             =>  'k1',
      'additional_pool_alloc'       =>  'k2',
      'uncheckpointed_bytes'        =>  'k3',
      'ibuf_used_cells'             =>  'k4',
      'ibuf_free_cells'             =>  'k5',
      'ibuf_cell_count'             =>  'k6',
      'adaptive_hash_memory'        =>  'k7',
      'page_hash_memory'            =>  'k8',
      'dictionary_cache_memory'     =>  'k9',
      'file_system_memory'          =>  'ka',
      'lock_system_memory'          =>  'kb',
      'recovery_system_memory'      =>  'kc',
      'thread_hash_memory'          =>  'kd',
      'innodb_sem_waits'            =>  'ke',
      'innodb_sem_wait_time_ms'     =>  'kf',
      'Key_buf_bytes_unflushed'     =>  'kg',
      'Key_buf_bytes_used'          =>  'kh',
      'key_buffer_size'             =>  'ki',
      'Innodb_row_lock_time'        =>  'kj',
      'Innodb_row_lock_waits'       =>  'kk',
      'Query_time_count_00'         =>  'kl',
      'Query_time_count_01'         =>  'km',
      'Query_time_count_02'         =>  'kn',
      'Query_time_count_03'         =>  'ko',
      'Query_time_count_04'         =>  'kp',
      'Query_time_count_05'         =>  'kq',
      'Query_time_count_06'         =>  'kr',
      'Query_time_count_07'         =>  'ks',
      'Query_time_count_08'         =>  'kt',
      'Query_time_count_09'         =>  'ku',
      'Query_time_count_10'         =>  'kv',
      'Query_time_count_11'         =>  'kw',
      'Query_time_count_12'         =>  'kx',
      'Query_time_count_13'         =>  'ky',
      'Query_time_total_00'         =>  'kz',
      'Query_time_total_01'         =>  'la',
      'Query_time_total_02'         =>  'lb',
      'Query_time_total_03'         =>  'lc',
      'Query_time_total_04'         =>  'ld',
      'Query_time_total_05'         =>  'le',
      'Query_time_total_06'         =>  'lf',
      'Query_time_total_07'         =>  'lg',
      'Query_time_total_08'         =>  'lh',
      'Query_time_total_09'         =>  'li',
      'Query_time_total_10'         =>  'lj',
      'Query_time_total_11'         =>  'lk',
      'Query_time_total_12'         =>  'll',
      'Query_time_total_13'         =>  'lm',
   );

   # Return the output.
   $output = array();
   foreach ($keys as $key => $short ) {
      # If the value isn't defined, return -1 which is lower than (most graphs')
      # minimum value of 0, so it'll be regarded as a missing value.
      $val      = isset($status[$key]) ? $status[$key] : -1;
      $output[] = "$short:$val";
   }
   $result = implode(' ', $output);
   if ( $fp ) {
      if ( fwrite($fp, $result) === FALSE ) {
         die("Can't write '$cache_file'");
      }
      fclose($fp);
   }
   return $result;
}

# ============================================================================
# Given INNODB STATUS text, returns a key-value array of the parsed text.  Each
# line shows a sample of the input for both standard InnoDB as you would find in
# MySQL 5.0, and XtraDB or enhanced InnoDB from Percona if applicable.  Note
# that extra leading spaces are ignored due to trim().
# ============================================================================
function get_innodb_array($text) {
   $results  = array(
      'spin_waits'  => array(),
      'spin_rounds' => array(),
      'os_waits'    => array(),
      'pending_normal_aio_reads'  => null,
      'pending_normal_aio_writes' => null,
      'pending_ibuf_aio_reads'    => null,
      'pending_aio_log_ios'       => null,
      'pending_aio_sync_ios'      => null,
      'pending_log_flushes'       => null,
      'pending_buf_pool_flushes'  => null,
      'file_reads'                => null,
      'file_writes'               => null,
      'file_fsyncs'               => null,
      'ibuf_inserts'              => null,
      'ibuf_merged'               => null,
      'ibuf_merges'               => null,
      'log_bytes_written'         => null,
      'unflushed_log'             => null,
      'log_bytes_flushed'         => null,
      'pending_log_writes'        => null,
      'pending_chkp_writes'       => null,
      'log_writes'                => null,
      'pool_size'                 => null,
      'free_pages'                => null,
      'database_pages'            => null,
      'modified_pages'            => null,
      'pages_read'                => null,
      'pages_created'             => null,
      'pages_written'             => null,
      'queries_inside'            => null,
      'queries_queued'            => null,
      'read_views'                => null,
      'rows_inserted'             => null,
      'rows_updated'              => null,
      'rows_deleted'              => null,
      'rows_read'                 => null,
      'innodb_transactions'       => null,
      'unpurged_txns'             => null,
      'history_list'              => null,
      'current_transactions'      => null,
      'hash_index_cells_total'    => null,
      'hash_index_cells_used'     => null,
      'total_mem_alloc'           => null,
      'additional_pool_alloc'     => null,
      'last_checkpoint'           => null,
      'uncheckpointed_bytes'      => null,
      'ibuf_used_cells'           => null,
      'ibuf_free_cells'           => null,
      'ibuf_cell_count'           => null,
      'adaptive_hash_memory'      => null,
      'page_hash_memory'          => null,
      'dictionary_cache_memory'   => null,
      'file_system_memory'        => null,
      'lock_system_memory'        => null,
      'recovery_system_memory'    => null,
      'thread_hash_memory'        => null,
      'innodb_sem_waits'          => null,
      'innodb_sem_wait_time_ms'   => null,
   );
   $txn_seen = FALSE;
   foreach ( explode("\n", $text) as $line ) {
      $line = trim($line);
      $row = preg_split('/ +/', $line);

      # SEMAPHORES
      if (strpos($line, 'Mutex spin waits') === 0 ) {
         # Mutex spin waits 79626940, rounds 157459864, OS waits 698719
         # Mutex spin waits 0, rounds 247280272495, OS waits 316513438
         $results['spin_waits'][]  = to_int($row[3]);
         $results['spin_rounds'][] = to_int($row[5]);
         $results['os_waits'][]    = to_int($row[8]);
      }
      elseif (strpos($line, 'RW-shared spins') === 0
            && strpos($line, ';') > 0 ) {
         # RW-shared spins 3859028, OS waits 2100750; RW-excl spins 4641946, OS waits 1530310
         $results['spin_waits'][] = to_int($row[2]);
         $results['spin_waits'][] = to_int($row[8]);
         $results['os_waits'][]   = to_int($row[5]);
         $results['os_waits'][]   = to_int($row[11]);
      }
      elseif (strpos($line, 'RW-shared spins') === 0 && strpos($line, '; RW-excl spins') === FALSE) {
         # Post 5.5.17 SHOW ENGINE INNODB STATUS syntax
         # RW-shared spins 604733, rounds 8107431, OS waits 241268
         $results['spin_waits'][] = to_int($row[2]);
         $results['os_waits'][]   = to_int($row[7]);
      }
      elseif (strpos($line, 'RW-excl spins') === 0) {
         # Post 5.5.17 SHOW ENGINE INNODB STATUS syntax
         # RW-excl spins 604733, rounds 8107431, OS waits 241268
         $results['spin_waits'][] = to_int($row[2]);
         $results['os_waits'][]   = to_int($row[7]);
      }
      elseif (strpos($line, 'seconds the semaphore:') > 0) {
         # --Thread 907205 has waited at handler/ha_innodb.cc line 7156 for 1.00 seconds the semaphore:
         increment($results, 'innodb_sem_waits', 1);
         increment($results,
            'innodb_sem_wait_time_ms', to_int($row[9]) * 1000);
      }

      # TRANSACTIONS
      elseif ( strpos($line, 'Trx id counter') === 0 ) {
         # The beginning of the TRANSACTIONS section: start counting
         # transactions
         # Trx id counter 0 1170664159
         # Trx id counter 861B144C
         $results['innodb_transactions'] = make_bigint(
            $row[3], (isset($row[4]) ? $row[4] : null));
         $txn_seen = TRUE;
      }
      elseif ( strpos($line, 'Purge done for trx') === 0 ) {
         # Purge done for trx's n:o < 0 1170663853 undo n:o < 0 0
         # Purge done for trx's n:o < 861B135D undo n:o < 0          $purged_to = make_bigint($row[6], $row[7] == 'undo' ? null : $row[7]);          $results['unpurged_txns']             = big_sub($results['innodb_transactions'], $purged_to);       }       elseif (strpos($line, 'History list length') === 0 ) {          # History list length 132          $results['history_list'] = to_int($row[3]);       }       elseif ( $txn_seen && strpos($line, '---TRANSACTION') === 0 ) {          # ---TRANSACTION 0, not started, process no 13510, OS thread id 1170446656          increment($results, 'current_transactions', 1);          if ( strpos($line, 'ACTIVE') > 0 ) {
            increment($results, 'active_transactions', 1);
         }
      }
      elseif ( $txn_seen && strpos($line, '------- TRX HAS BEEN') === 0 ) {
         # ------- TRX HAS BEEN WAITING 32 SEC FOR THIS LOCK TO BE GRANTED:
         increment($results, 'innodb_lock_wait_secs', to_int($row[5]));
      }
      elseif ( strpos($line, 'read views open inside InnoDB') > 0 ) {
         # 1 read views open inside InnoDB
         $results['read_views'] = to_int($row[0]);
      }
      elseif ( strpos($line, 'mysql tables in use') === 0 ) {
         # mysql tables in use 2, locked 2
         increment($results, 'innodb_tables_in_use', to_int($row[4]));
         increment($results, 'innodb_locked_tables', to_int($row[6]));
      }
      elseif ( $txn_seen && strpos($line, 'lock struct(s)') > 0 ) {
         # 23 lock struct(s), heap size 3024, undo log entries 27
         # LOCK WAIT 12 lock struct(s), heap size 3024, undo log entries 5
         # LOCK WAIT 2 lock struct(s), heap size 368
         if ( strpos($line, 'LOCK WAIT') === 0 ) {
            increment($results, 'innodb_lock_structs', to_int($row[2]));
            increment($results, 'locked_transactions', 1);
         }
         else {
            increment($results, 'innodb_lock_structs', to_int($row[0]));
         }
      }

      # FILE I/O
      elseif (strpos($line, ' OS file reads, ') > 0 ) {
         # 8782182 OS file reads, 15635445 OS file writes, 947800 OS fsyncs
         $results['file_reads']  = to_int($row[0]);
         $results['file_writes'] = to_int($row[4]);
         $results['file_fsyncs'] = to_int($row[8]);
      }
      elseif (strpos($line, 'Pending normal aio reads:') === 0 ) {
         # Pending normal aio reads: 0, aio writes: 0,
         $results['pending_normal_aio_reads']  = to_int($row[4]);
         $results['pending_normal_aio_writes'] = to_int($row[7]);
      }
      elseif (strpos($line, 'ibuf aio reads') === 0 ) {
         #  ibuf aio reads: 0, log i/o's: 0, sync i/o's: 0
         $results['pending_ibuf_aio_reads'] = to_int($row[3]);
         $results['pending_aio_log_ios']    = to_int($row[6]);
         $results['pending_aio_sync_ios']   = to_int($row[9]);
      }
      elseif ( strpos($line, 'Pending flushes (fsync)') === 0 ) {
         # Pending flushes (fsync) log: 0; buffer pool: 0
         $results['pending_log_flushes']      = to_int($row[4]);
         $results['pending_buf_pool_flushes'] = to_int($row[7]);
      }

      # INSERT BUFFER AND ADAPTIVE HASH INDEX
      elseif (strpos($line, 'Ibuf for space 0: size ') === 0 ) {
         # Older InnoDB code seemed to be ready for an ibuf per tablespace.  It
         # had two lines in the output.  Newer has just one line, see below.
         # Ibuf for space 0: size 1, free list len 887, seg size 889, is not empty
         # Ibuf for space 0: size 1, free list len 887, seg size 889,
         $results['ibuf_used_cells']  = to_int($row[5]);
         $results['ibuf_free_cells']  = to_int($row[9]);
         $results['ibuf_cell_count']  = to_int($row[12]);
      }
      elseif (strpos($line, 'Ibuf: size ') === 0 ) {
         # Ibuf: size 1, free list len 4634, seg size 4636,
         $results['ibuf_used_cells']  = to_int($row[2]);
         $results['ibuf_free_cells']  = to_int($row[6]);
         $results['ibuf_cell_count']  = to_int($row[9]);
         if (strpos($line, 'merges')) {
            $results['ibuf_merges']  = to_int($row[10]);
         }
      }
      elseif (strpos($line, ', delete mark ') > 0 && strpos($prev_line, 'merged operations:') === 0 ) {
         # Output of show engine innodb status has changed in 5.5
         # merged operations:
         # insert 593983, delete mark 387006, delete 73092
         $results['ibuf_inserts'] = to_int($row[1]);
         $results['ibuf_merged']  = to_int($row[1]) + to_int($row[4]) + to_int($row[6]);
      }
      elseif (strpos($line, ' merged recs, ') > 0 ) {
         # 19817685 inserts, 19817684 merged recs, 3552620 merges
         $results['ibuf_inserts'] = to_int($row[0]);
         $results['ibuf_merged']  = to_int($row[2]);
         $results['ibuf_merges']  = to_int($row[5]);
      }
      elseif (strpos($line, 'Hash table size ') === 0 ) {
         # In some versions of InnoDB, the used cells is omitted.
         # Hash table size 4425293, used cells 4229064, ....
         # Hash table size 57374437, node heap has 72964 buffer(s)  0 ? to_int($row[6]) : '0';
      }

      # LOG
      elseif (strpos($line, " log i/o's done, ") > 0 ) {
         # 3430041 log i/o's done, 17.44 log i/o's/second
         # 520835887 log i/o's done, 17.28 log i/o's/second, 518724686 syncs, 2980893 checkpoints
         # TODO: graph syncs and checkpoints
         $results['log_writes'] = to_int($row[0]);
      }
      elseif (strpos($line, " pending log writes, ") > 0 ) {
         # 0 pending log writes, 0 pending chkp writes
         $results['pending_log_writes']  = to_int($row[0]);
         $results['pending_chkp_writes'] = to_int($row[4]);
      }
      elseif (strpos($line, "Log sequence number") === 0 ) {
         # This number is NOT printed in hex in InnoDB plugin.
         # Log sequence number 13093949495856 //plugin
         # Log sequence number 125 3934414864 //normal
         $results['log_bytes_written']
            = isset($row[4])
            ? make_bigint($row[3], $row[4])
            : to_int($row[3]);
      }
      elseif (strpos($line, "Log flushed up to") === 0 ) {
         # This number is NOT printed in hex in InnoDB plugin.
         # Log flushed up to   13093948219327
         # Log flushed up to   125 3934414864
         $results['log_bytes_flushed']
            = isset($row[5])
            ? make_bigint($row[4], $row[5])
            : to_int($row[4]);
      }
      elseif (strpos($line, "Last checkpoint at") === 0 ) {
         # Last checkpoint at  125 3934293461
         $results['last_checkpoint']
            = isset($row[4])
            ? make_bigint($row[3], $row[4])
            : to_int($row[3]);
      }

      # BUFFER POOL AND MEMORY
      elseif (strpos($line, "Total memory allocated") === 0 ) {
         # Total memory allocated 29642194944; in additional pool allocated 0
         $results['total_mem_alloc']       = to_int($row[3]);
         $results['additional_pool_alloc'] = to_int($row[8]);
      }
      elseif(strpos($line, 'Adaptive hash index ') === 0 ) {
         #   Adaptive hash index 1538240664 	(186998824 + 1351241840)
         $results['adaptive_hash_memory'] = to_int($row[3]);
      }
      elseif(strpos($line, 'Page hash           ') === 0 ) {
         #   Page hash           11688584
         $results['page_hash_memory'] = to_int($row[2]);
      }
      elseif(strpos($line, 'Dictionary cache    ') === 0 ) {
         #   Dictionary cache    145525560 	(140250984 + 5274576)
         $results['dictionary_cache_memory'] = to_int($row[2]);
      }
      elseif(strpos($line, 'File system         ') === 0 ) {
         #   File system         313848 	(82672 + 231176)
         $results['file_system_memory'] = to_int($row[2]);
      }
      elseif(strpos($line, 'Lock system         ') === 0 ) {
         #   Lock system         29232616 	(29219368 + 13248)
         $results['lock_system_memory'] = to_int($row[2]);
      }
      elseif(strpos($line, 'Recovery system     ') === 0 ) {
         #   Recovery system     0 	(0 + 0)
         $results['recovery_system_memory'] = to_int($row[2]);
      }
      elseif(strpos($line, 'Threads             ') === 0 ) {
         #   Threads             409336 	(406936 + 2400)
         $results['thread_hash_memory'] = to_int($row[1]);
      }
      elseif(strpos($line, 'innodb_io_pattern   ') === 0 ) {
         #   innodb_io_pattern   0 	(0 + 0)
         $results['innodb_io_pattern_memory'] = to_int($row[1]);
      }
      elseif (strpos($line, "Buffer pool size ") === 0 ) {
         # The " " after size is necessary to avoid matching the wrong line:
         # Buffer pool size        1769471
         # Buffer pool size, bytes 28991012864
         $results['pool_size'] = to_int($row[3]);
      }
      elseif (strpos($line, "Free buffers") === 0 ) {
         # Free buffers            0
         $results['free_pages'] = to_int($row[2]);
      }
      elseif (strpos($line, "Database pages") === 0 ) {
         # Database pages          1696503
         $results['database_pages'] = to_int($row[2]);
      }
      elseif (strpos($line, "Modified db pages") === 0 ) {
         # Modified db pages       160602
         $results['modified_pages'] = to_int($row[3]);
      }
      elseif (strpos($line, "Pages read ahead") === 0 ) {
         # Must do this BEFORE the next test, otherwise it'll get fooled by this
         # line from the new plugin (see samples/innodb-015.txt):
         # Pages read ahead 0.00/s, evicted without access 0.06/s
         # TODO: No-op for now, see issue 134.
      }
      elseif (strpos($line, "Pages read") === 0 ) {
         # Pages read 15240822, created 1770238, written 21705836
         $results['pages_read']    = to_int($row[2]);
         $results['pages_created'] = to_int($row[4]);
         $results['pages_written'] = to_int($row[6]);
      }

      # ROW OPERATIONS
      elseif (strpos($line, 'Number of rows inserted') === 0 ) {
         # Number of rows inserted 50678311, updated 66425915, deleted 20605903, read 454561562
         $results['rows_inserted'] = to_int($row[4]);
         $results['rows_updated']  = to_int($row[6]);
         $results['rows_deleted']  = to_int($row[8]);
         $results['rows_read']     = to_int($row[10]);
      }
      elseif (strpos($line, " queries inside InnoDB, ") > 0 ) {
         # 0 queries inside InnoDB, 0 queries in queue
         $results['queries_inside'] = to_int($row[0]);
         $results['queries_queued'] = to_int($row[4]);
      }
      $prev_line = $line;
   }

   foreach ( array('spin_waits', 'spin_rounds', 'os_waits') as $key ) {
      $results[$key] = to_int(array_sum($results[$key]));
   }
   $results['unflushed_log']
      = big_sub($results['log_bytes_written'], $results['log_bytes_flushed']);
   $results['uncheckpointed_bytes']
      = big_sub($results['log_bytes_written'], $results['last_checkpoint']);

   return $results;
}

# ============================================================================
# Returns a bigint from two ulint or a single hex number.  This is tested in
# t/mysql_stats.php and copied, without tests, to ss_get_by_ssh.php.
# ============================================================================
function make_bigint ($hi, $lo = null) {
   debug(array($hi, $lo));
   if ( is_null($lo) ) {
      # Assume it is a hex string representation.
      return base_convert($hi, 16, 10);
   }
   else {
      $hi = $hi ? $hi : '0'; # Handle empty-string or whatnot
      $lo = $lo ? $lo : '0';
      return big_add(big_multiply($hi, 4294967296), $lo);
   }
}

# ============================================================================
# Extracts the numbers from a string.  You can't reliably do this by casting to
# an int, because numbers that are bigger than PHP's int (varies by platform)
# will be truncated.  And you can't use sprintf(%u) either, because the maximum
# value that will return on some platforms is 4022289582.  So this just handles
# them as a string instead.  It extracts digits until it finds a non-digit and
# quits.  This is tested in t/mysql_stats.php and copied, without tests, to
# ss_get_by_ssh.php.
# ============================================================================
function to_int ( $str ) {
   debug($str);
   global $debug;
   preg_match('{(\d+)}', $str, $m);
   if ( isset($m[1]) ) {
      return $m[1];
   }
   elseif ( $debug ) {
      print_r(debug_backtrace());
   }
   else {
      return 0;
   }
}

# ============================================================================
# Wrap mysql_query in error-handling, and instead of returning the result,
# return an array of arrays in the result.
# ============================================================================
function run_query($sql, $conn) {
   global $debug;
   debug($sql);
   $result = @mysql_query($sql, $conn);
   if ( $debug ) {
      $error = @mysql_error($conn);
      if ( $error ) {
         debug(array($sql, $error));
         die("SQLERR $error in $sql");
      }
   }
   $array = array();
   while ( $row = @mysql_fetch_array($result) ) {
      $array[] = $row;
   }
   debug(array($sql, $array));
   return $array;
}

# ============================================================================
# Safely increments a value that might be null.
# ============================================================================
function increment(&$arr, $key, $howmuch) {
   debug(array($key, $howmuch));
   if ( array_key_exists($key, $arr) && isset($arr[$key]) ) {
      $arr[$key] = big_add($arr[$key], $howmuch);
   }
   else {
      $arr[$key] = $howmuch;
   }
}

# ============================================================================
# Multiply two big integers together as accurately as possible with reasonable
# effort.  This is tested in t/mysql_stats.php and copied, without tests, to
# ss_get_by_ssh.php.  $force is for testability.
# ============================================================================
function big_multiply ($left, $right, $force = null) {
   if ( function_exists("gmp_mul") && (is_null($force) || $force == 'gmp') ) {
      debug(array('gmp_mul', $left, $right));
      return gmp_strval( gmp_mul( $left, $right ));
   }
   elseif ( function_exists("bcmul") && (is_null($force) || $force == 'bc') ) {
      debug(array('bcmul', $left, $right));
      return bcmul( $left, $right );
   }
   else { # Or $force == 'something else'
      debug(array('sprintf', $left, $right));
      return sprintf("%.0f", $left * $right);
   }
}

# ============================================================================
# Subtract two big integers as accurately as possible with reasonable effort.
# This is tested in t/mysql_stats.php and copied, without tests, to
# ss_get_by_ssh.php.  $force is for testability.
# ============================================================================
function big_sub ($left, $right, $force = null) {
   debug(array($left, $right));
   if ( is_null($left)  ) { $left = 0; }
   if ( is_null($right) ) { $right = 0; }
   if ( function_exists("gmp_sub") && (is_null($force) || $force == 'gmp')) {
      debug(array('gmp_sub', $left, $right));
      return gmp_strval( gmp_sub( $left, $right ));
   }
   elseif ( function_exists("bcsub") && (is_null($force) || $force == 'bc')) {
      debug(array('bcsub', $left, $right));
      return bcsub( $left, $right );
   }
   else { # Or $force == 'something else'
      debug(array('to_int', $left, $right));
      return to_int($left - $right);
   }
}

# ============================================================================
# Add two big integers together as accurately as possible with reasonable
# effort.  This is tested in t/mysql_stats.php and copied, without tests, to
# ss_get_by_ssh.php.  $force is for testability.
# ============================================================================
function big_add ($left, $right, $force = null) {
   if ( is_null($left)  ) { $left = 0; }
   if ( is_null($right) ) { $right = 0; }
   if ( function_exists("gmp_add") && (is_null($force) || $force == 'gmp')) {
      debug(array('gmp_add', $left, $right));
      return gmp_strval( gmp_add( $left, $right ));
   }
   elseif ( function_exists("bcadd") && (is_null($force) || $force == 'bc')) {
      debug(array('bcadd', $left, $right));
      return bcadd( $left, $right );
   }
   else { # Or $force == 'something else'
      debug(array('to_int', $left, $right));
      return to_int($left + $right);
   }
}

# ============================================================================
# Writes to a debugging log.
# ============================================================================
function debug($val) {
   global $debug_log;
   if ( !$debug_log ) {
      return;
   }
   if ( $fp = fopen($debug_log, 'a+') ) {
      $trace = debug_backtrace();
      $calls = array();
      $i    = 0;
      $line = 0;
      $file = '';
      foreach ( debug_backtrace() as $arr ) {
         if ( $i++ ) {
            $calls[] = "$arr[function]() at $file:$line";
         }
         $line = array_key_exists('line', $arr) ? $arr['line'] : '?';
         $file = array_key_exists('file', $arr) ? $arr['file'] : '?';
      }
      if ( !count($calls) ) {
         $calls[] = "at $file:$line";
      }
      fwrite($fp, date('Y-m-d h:i:s') . ' ' . implode(' <- ', $calls));
      fwrite($fp, "\n" . var_export($val, TRUE) . "\n");
      fclose($fp);
   }
   else { # Disable logging
      print("Warning: disabling debug logging to $debug_log\n");
      $debug_log = FALSE;
   }
}
<zabbix_export date="11.11.10" time="04.09" version="1.0">

      Template_MySQL:Process mysqld not running on {HOSTNAME}

      Template_MySQL:Slave lag more than 10m over 10m on {HOSTNAME}
      Template_MySQL:Process mysqld not running on {HOSTNAME}

      Template_MySQL:Process mysqld not running on {HOSTNAME}

      Template_MySQL:Process mysqld not running on {HOSTNAME}

      Template_MySQL:Process mysqld not running on {HOSTNAME}

      Template_MySQL:Process mysqld not running on {HOSTNAME}

      Template_MySQL:Process mysqld not running on {HOSTNAME}

            MySQL

          <graph_elements>
            <graph_element item="Template_MySQL:mysql.Key_read_requests">
              <calc_fnc>2
              157419
              1
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Key_reads">
              <calc_fnc>2
              AFECED
              0
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Key_write_requests">
              <calc_fnc>2
              862F2F
              1
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Key_writes">
              <calc_fnc>2
              F51D30
              0
              <periods_cnt>5
              0
              1

          0
          <percent_left>0.0000
          <percent_right>0.0000
          <show_3d>0
          <show_legend>1
          <show_triggers>1
          <show_work_period>1
          100.0000
          0.0000
          <ymax_item_key>
          <ymax_type>0
          <ymin_item_key>
          <ymin_type>0

            MySQL

          <graph_elements>
            <graph_element item="Template_MySQL:mysql.setting.key_buffer_size">
              <calc_fnc>2
              99B898
              1
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Key_buf_bytes_used">
              <calc_fnc>2
              2A363B
              1
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Key_buf_bytes_unflushed">
              <calc_fnc>2
              FECEA8
              1
              <periods_cnt>5
              0
              1

          0
          <percent_left>0.0000
          <percent_right>0.0000
          <show_3d>0
          <show_legend>1
          <show_triggers>1
          <show_work_period>1
          100.0000
          0.0000
          <ymax_item_key>
          <ymax_type>0
          <ymin_item_key>
          <ymin_type>0

            MySQL

          <graph_elements>
            <graph_element item="Template_MySQL:mysql.setting.pool_size">
              <calc_fnc>2
              3D1500
              1
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.database_pages">
              <calc_fnc>2
              EDAA41
              1
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.free_pages">
              <calc_fnc>2
              AA3B27
              5
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.modified_pages">
              <calc_fnc>2
              13343B
              0
              <periods_cnt>5
              0
              1

          0
          <percent_left>0.0000
          <percent_right>0.0000
          <show_3d>0
          <show_legend>1
          <show_triggers>1
          <show_work_period>1
          100.0000
          0.0000
          <ymax_item_key>
          <ymax_type>0
          <ymin_item_key>
          <ymin_type>0

            MySQL

          <graph_elements>
            <graph_element item="Template_MySQL:mysql.file_reads">
              <calc_fnc>2
              402204
              0
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.file_writes">
              <calc_fnc>2
              B3092B
              0
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.log_writes">
              <calc_fnc>2
              FFBF00
              0
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.file_fsyncs">
              <calc_fnc>2
              0ABFCC
              0
              <periods_cnt>5
              0
              1

          0
          <percent_left>0.0000
          <percent_right>0.0000
          <show_3d>0
          <show_legend>1
          <show_triggers>1
          <show_work_period>1
          100.0000
          0.0000
          <ymax_item_key>
          <ymax_type>0
          <ymin_item_key>
          <ymin_type>0

            MySQL

          <graph_elements>
            <graph_element item="Template_MySQL:mysql.ibuf_inserts">
              <calc_fnc>2
              157419
              0
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.ibuf_merged">
              <calc_fnc>2
              0000FF
              0
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.ibuf_merges">
              <calc_fnc>2
              862F2F
              0
              <periods_cnt>5
              0
              1

          0
          <percent_left>0.0000
          <percent_right>0.0000
          <show_3d>0
          <show_legend>1
          <show_triggers>1
          <show_work_period>1
          100.0000
          0.0000
          <ymax_item_key>
          <ymax_type>0
          <ymin_item_key>
          <ymin_type>0

            MySQL

          <graph_elements>
            <graph_element item="Template_MySQL:mysql.ibuf_cell_count">
              <calc_fnc>2
              793A57
              1
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.ibuf_used_cells">
              <calc_fnc>2
              8C873E
              1
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.ibuf_free_cells">
              <calc_fnc>2
              A38A5F
              5
              <periods_cnt>5
              0
              1

          0
          <percent_left>0.0000
          <percent_right>0.0000
          <show_3d>0
          <show_legend>1
          <show_triggers>1
          <show_work_period>1
          100.0000
          0.0000
          <ymax_item_key>
          <ymax_type>0
          <ymin_item_key>
          <ymin_type>0

            MySQL

          <graph_elements>
            <graph_element item="Template_MySQL:mysql.spin_rounds">
              <calc_fnc>2
              306078
              0
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.spin_waits">
              <calc_fnc>2
              4444FF
              0
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.os_waits">
              <calc_fnc>2
              157419
              0
              <periods_cnt>5
              0
              1

          0
          <percent_left>0.0000
          <percent_right>0.0000
          <show_3d>0
          <show_legend>1
          <show_triggers>1
          <show_work_period>1
          100.0000
          0.0000
          <ymax_item_key>
          <ymax_type>0
          <ymin_item_key>
          <ymin_type>0

            MySQL

          <graph_elements>
            <graph_element item="Template_MySQL:mysql.rows_read">
              <calc_fnc>2
              AFECED
              1
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.rows_deleted">
              <calc_fnc>2
              DA4725
              5
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.rows_updated">
              <calc_fnc>2
              EA8F00
              5
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.rows_inserted">
              <calc_fnc>2
              35962B
              5
              <periods_cnt>5
              0
              1

          0
          <percent_left>0.0000
          <percent_right>0.0000
          <show_3d>0
          <show_legend>1
          <show_triggers>1
          <show_work_period>1
          100.0000
          0.0000
          <ymax_item_key>
          <ymax_type>0
          <ymin_item_key>
          <ymin_type>0

            MySQL

          <graph_elements>
            <graph_element item="Template_MySQL:mysql.Table_locks_immediate">
              <calc_fnc>2
              D2D8F9
              1
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Table_locks_immediate">
              <calc_fnc>2
              002A8F
              0
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Table_locks_waited">
              <calc_fnc>2
              FF3932
              1
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Slow_queries">
              <calc_fnc>2
              35962B
              0
              <periods_cnt>5
              0
              1

          0
          <percent_left>0.0000
          <percent_right>0.0000
          <show_3d>0
          <show_legend>1
          <show_triggers>1
          <show_work_period>1
          100.0000
          0.0000
          <ymax_item_key>
          <ymax_type>0
          <ymin_item_key>
          <ymin_type>0

            MySQL

          <graph_elements>
            <graph_element item="Template_MySQL:mysql.setting.max_connections">
              <calc_fnc>2
              C0C0C0
              1
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Max_used_connections">
              <calc_fnc>2
              FFD660
              1
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Aborted_clients">
              <calc_fnc>2
              FF3932
              0
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Aborted_connects">
              <calc_fnc>2
              00FF00
              0
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Threads_connected">
              <calc_fnc>2
              FF7D00
              2
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Connections">
              <calc_fnc>2
              4444FF
              0
              <periods_cnt>5
              0
              1

          0
          <percent_left>0.0000
          <percent_right>0.0000
          <show_3d>0
          <show_legend>1
          <show_triggers>1
          <show_work_period>1
          100.0000
          0.0000
          <ymax_item_key>
          <ymax_type>0
          <ymin_item_key>
          <ymin_type>0

            MySQL

          <graph_elements>
            <graph_element item="Template_MySQL:mysql.slave_running">
              <calc_fnc>2
              96E78A
              1
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.slave_stopped">
              <calc_fnc>2
              CDCFC4
              1
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.slave_lag">
              <calc_fnc>2
              4444FF
              0
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Slave_open_temp_tables">
              <calc_fnc>2
              8D00BA
              0
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Slave_retried_transactions">
              <calc_fnc>2
              FF0000
              0
              <periods_cnt>5
              0
              1

          0
          <percent_left>0.0000
          <percent_right>0.0000
          <show_3d>0
          <show_legend>1
          <show_triggers>1
          <show_work_period>1
          100.0000
          0.0000
          <ymax_item_key>
          <ymax_type>0
          <ymin_item_key>
          <ymin_type>0

            MySQL

          <graph_elements>
            <graph_element item="Template_MySQL:mysql.Qcache_queries_in_cache">
              <calc_fnc>2
              4444FF
              2
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Qcache_hits">
              <calc_fnc>2
              EAAF00
              2
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Qcache_inserts">
              <calc_fnc>2
              157419
              0
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Qcache_not_cached">
              <calc_fnc>2
              00A0C1
              0
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Qcache_lowmem_prunes">
              <calc_fnc>2
              FF0000
              0
              <periods_cnt>5
              0
              1

          0
          <percent_left>0.0000
          <percent_right>0.0000
          <show_3d>0
          <show_legend>1
          <show_triggers>1
          <show_work_period>1
          100.0000
          0.0000
          <ymax_item_key>
          <ymax_type>0
          <ymin_item_key>
          <ymin_type>0

            MySQL

          <graph_elements>
            <graph_element item="Template_MySQL:mysql.setting.query_cache_size">
              <calc_fnc>2
              74C366
              1
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Qcache_free_memory">
              <calc_fnc>2
              FFC3C0
              1
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Qcache_total_blocks">
              <calc_fnc>2
              8D00BA
              0
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Qcache_free_blocks">
              <calc_fnc>2
              837C04
              0
              <periods_cnt>5
              0
              1

          0
          <percent_left>0.0000
          <percent_right>0.0000
          <show_3d>0
          <show_legend>1
          <show_triggers>1
          <show_work_period>1
          100.0000
          0.0000
          <ymax_item_key>
          <ymax_type>0
          <ymin_item_key>
          <ymin_type>0

            MySQL

          <graph_elements>
            <graph_element item="Template_MySQL:mysql.Questions">
              <calc_fnc>2
              FFC3C0
              1
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Com_select">
              <calc_fnc>2
              FF0000
              1
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Com_delete">
              <calc_fnc>2
              FF7D00
              5
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Com_insert">
              <calc_fnc>2
              FFF200
              5
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Com_update">
              <calc_fnc>2
              00CF00
              5
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Com_replace">
              <calc_fnc>2
              2175D9
              5
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Com_load">
              <calc_fnc>2
              55009D
              5
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Com_delete_multi">
              <calc_fnc>2
              942D0C
              5
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Com_insert_select">
              <calc_fnc>2
              AAABA1
              5
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Com_update_multi">
              <calc_fnc>2
              D8ACE0
              5
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Com_replace_select">
              <calc_fnc>2
              00B99B
              5
              <periods_cnt>5
              0
              1

          0
          <percent_left>0.0000
          <percent_right>0.0000
          <show_3d>0
          <show_legend>1
          <show_triggers>1
          <show_work_period>1
          100.0000
          0.0000
          <ymax_item_key>
          <ymax_type>0
          <ymin_item_key>
          <ymin_type>0

            MySQL

          <graph_elements>
            <graph_element item="Template_MySQL:mysql.Select_full_join">
              <calc_fnc>2
              3D1500
              1
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Select_full_range_join">
              <calc_fnc>2
              AA3B27
              5
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Select_range">
              <calc_fnc>2
              EDAA41
              5
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Select_range_check">
              <calc_fnc>2
              13343B
              5
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Select_scan">
              <calc_fnc>2
              686240
              5
              <periods_cnt>5
              0
              1

          0
          <percent_left>0.0000
          <percent_right>0.0000
          <show_3d>0
          <show_legend>1
          <show_triggers>1
          <show_work_period>1
          100.0000
          0.0000
          <ymax_item_key>
          <ymax_type>0
          <ymin_item_key>
          <ymin_type>0

            MySQL

          <graph_elements>
            <graph_element item="Template_MySQL:mysql.Sort_rows">
              <calc_fnc>2
              FFAB00
              1
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Sort_range">
              <calc_fnc>2
              157419
              0
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Sort_merge_passes">
              <calc_fnc>2
              DA4725
              0
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Sort_scan">
              <calc_fnc>2
              4444FF
              0
              <periods_cnt>5
              0
              1

          0
          <percent_left>0.0000
          <percent_right>0.0000
          <show_3d>0
          <show_legend>1
          <show_triggers>1
          <show_work_period>1
          100.0000
          0.0000
          <ymax_item_key>
          <ymax_type>0
          <ymin_item_key>
          <ymin_type>0

            MySQL

          <graph_elements>
            <graph_element item="Template_MySQL:mysql.Created_tmp_tables">
              <calc_fnc>2
              FFAB00
              1
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Created_tmp_tables">
              <calc_fnc>2
              837C04
              0
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Created_tmp_disk_tables">
              <calc_fnc>2
              F51D30
              0
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Created_tmp_files">
              <calc_fnc>2
              157419
              2
              <periods_cnt>5
              0
              1

          0
          <percent_left>0.0000
          <percent_right>0.0000
          <show_3d>0
          <show_legend>1
          <show_triggers>1
          <show_work_period>1
          100.0000
          0.0000
          <ymax_item_key>
          <ymax_type>0
          <ymin_item_key>
          <ymin_type>0

            MySQL

          <graph_elements>
            <graph_element item="Template_MySQL:mysql.Bytes_sent">
              <calc_fnc>2
              4B2744
              1
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Bytes_received">
              <calc_fnc>2
              E4C576
              1
              <periods_cnt>5
              0
              1

          0
          <percent_left>0.0000
          <percent_right>0.0000
          <show_3d>0
          <show_legend>1
          <show_triggers>1
          <show_work_period>1
          100.0000
          0.0000
          <ymax_item_key>
          <ymax_type>0
          <ymin_item_key>
          <ymin_type>0

            MySQL

          <graph_elements>
            <graph_element item="Template_MySQL:mysql.pages_created">
              <calc_fnc>2
              D6883A
              1
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.pages_read">
              <calc_fnc>2
              E6D883
              5
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.pages_written">
              <calc_fnc>2
              55AD84
              1
              <periods_cnt>5
              0
              1

          0
          <percent_left>0.0000
          <percent_right>0.0000
          <show_3d>0
          <show_legend>1
          <show_triggers>1
          <show_work_period>1
          100.0000
          0.0000
          <ymax_item_key>
          <ymax_type>0
          <ymin_item_key>
          <ymin_type>0

            MySQL

          <graph_elements>
            <graph_element item="Template_MySQL:mysql.pending_aio_log_ios">
              <calc_fnc>2
              FF0000
              0
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.pending_aio_sync_ios">
              <calc_fnc>2
              FF7D00
              0
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.pending_buf_pool_flushes">
              <calc_fnc>2
              FFF200
              0
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.pending_chkp_writes">
              <calc_fnc>2
              00A348
              0
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.pending_ibuf_aio_reads">
              <calc_fnc>2
              6DC8FE
              0
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.pending_log_flushes">
              <calc_fnc>2
              4444FF
              0
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.pending_log_writes">
              <calc_fnc>2
              55009D
              0
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.pending_normal_aio_reads">
              <calc_fnc>2
              B90054
              0
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.pending_normal_aio_writes">
              <calc_fnc>2
              8F9286
              0
              <periods_cnt>5
              0
              1

          0
          <percent_left>0.0000
          <percent_right>0.0000
          <show_3d>0
          <show_legend>1
          <show_triggers>1
          <show_work_period>1
          100.0000
          0.0000
          <ymax_item_key>
          <ymax_type>0
          <ymin_item_key>
          <ymin_type>0

            MySQL

          <graph_elements>
            <graph_element item="Template_MySQL:mysql.innodb_log_buffer_size">
              <calc_fnc>2
              6E3803
              1
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.log_bytes_written">
              <calc_fnc>2
              5B8257
              1
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.log_bytes_flushed">
              <calc_fnc>2
              AB4253
              0
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.unflushed_log">
              <calc_fnc>2
              AFECED
              1
              <periods_cnt>5
              0
              1

          0
          <percent_left>0.0000
          <percent_right>0.0000
          <show_3d>0
          <show_legend>1
          <show_triggers>1
          <show_work_period>1
          100.0000
          0.0000
          <ymax_item_key>
          <ymax_type>0
          <ymin_item_key>
          <ymin_type>0

            MySQL

          <graph_elements>
            <graph_element item="Template_MySQL:mysql.Binlog_cache_use">
              <calc_fnc>2
              35962B
              0
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Binlog_cache_disk_use">
              <calc_fnc>2
              FF0000
              0
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.binary_log_space">
              <calc_fnc>2
              8D00BA
              0
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.relay_log_space">
              <calc_fnc>2
              8F005C
              0
              <periods_cnt>5
              0
              1

          0
          <percent_left>0.0000
          <percent_right>0.0000
          <show_3d>0
          <show_legend>1
          <show_triggers>1
          <show_work_period>1
          100.0000
          0.0000
          <ymax_item_key>
          <ymax_type>0
          <ymin_item_key>
          <ymin_type>0

            MySQL

          <graph_elements>
            <graph_element item="Template_MySQL:mysql.innodb_transactions">
              <calc_fnc>2
              8F005C
              0
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.current_transactions">
              <calc_fnc>2
              4444FF
              0
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.history_list">
              <calc_fnc>2
              FF7D00
              0
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.read_views">
              <calc_fnc>2
              74C366
              0
              <periods_cnt>5
              0
              1

          0
          <percent_left>0.0000
          <percent_right>0.0000
          <show_3d>0
          <show_legend>1
          <show_triggers>1
          <show_work_period>1
          100.0000
          0.0000
          <ymax_item_key>
          <ymax_type>0
          <ymin_item_key>
          <ymin_type>0

            MySQL

          <graph_elements>
            <graph_element item="Template_MySQL:mysql.active_transactions">
              <calc_fnc>2
              C0C0C0
              1
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.locked_transactions">
              <calc_fnc>2
              FF0000
              0
              <periods_cnt>5
              0
              1

          0
          <percent_left>0.0000
          <percent_right>0.0000
          <show_3d>0
          <show_legend>1
          <show_triggers>1
          <show_work_period>1
          100.0000
          0.0000
          <ymax_item_key>
          <ymax_type>0
          <ymin_item_key>
          <ymin_type>0

            MySQL

          <graph_elements>
            <graph_element item="Template_MySQL:mysql.setting.table_cache">
              <calc_fnc>2
              D09887
              1
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Open_tables">
              <calc_fnc>2
              4A6959
              0
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Open_files">
              <calc_fnc>2
              1D1159
              0
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Opened_tables">
              <calc_fnc>2
              DE0056
              0
              <periods_cnt>5
              0
              1

          0
          <percent_left>0.0000
          <percent_right>0.0000
          <show_3d>0
          <show_legend>1
          <show_triggers>1
          <show_work_period>1
          100.0000
          0.0000
          <ymax_item_key>
          <ymax_type>0
          <ymin_item_key>
          <ymin_type>0

            MySQL

          <graph_elements>
            <graph_element item="Template_MySQL:mysql.setting.thread_cache_size">
              <calc_fnc>2
              D8ACE0
              1
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Threads_created">
              <calc_fnc>2
              DE0056
              2
              <periods_cnt>5
              0
              1

          0
          <percent_left>0.0000
          <percent_right>0.0000
          <show_3d>0
          <show_legend>1
          <show_triggers>1
          <show_work_period>1
          100.0000
          0.0000
          <ymax_item_key>
          <ymax_type>0
          <ymin_item_key>
          <ymin_type>0

            MySQL

          <graph_elements>
            <graph_element item="Template_MySQL:mysql.total_mem_alloc">
              <calc_fnc>2
              53777A
              1
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.additional_pool_alloc">
              <calc_fnc>2
              C02942
              0
              <periods_cnt>5
              0
              1

          0
          <percent_left>0.0000
          <percent_right>0.0000
          <show_3d>0
          <show_legend>1
          <show_triggers>1
          <show_work_period>1
          100.0000
          0.0000
          <ymax_item_key>
          <ymax_type>0
          <ymin_item_key>
          <ymin_type>0

            MySQL

          <graph_elements>
            <graph_element item="Template_MySQL:mysql.hash_index_cells_total">
              <calc_fnc>2
              0C4E5D
              1
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.hash_index_cells_used">
              <calc_fnc>2
              D9C7A3
              1
              <periods_cnt>5
              0
              1

          0
          <percent_left>0.0000
          <percent_right>0.0000
          <show_3d>0
          <show_legend>1
          <show_triggers>1
          <show_work_period>1
          100.0000
          0.0000
          <ymax_item_key>
          <ymax_type>0
          <ymin_item_key>
          <ymin_type>0

            MySQL

          <graph_elements>
            <graph_element item="Template_MySQL:mysql.adaptive_hash_memory">
              <calc_fnc>2
              793A57
              1
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.page_hash_memory">
              <calc_fnc>2
              8C873E
              5
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.dictionary_cache_memory">
              <calc_fnc>2
              D1C5A5
              5
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.file_system_memory">
              <calc_fnc>2
              4D3339
              5
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.lock_system_memory">
              <calc_fnc>2
              A38A5F
              5
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.recovery_system_memory">
              <calc_fnc>2
              E97F02
              5
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.thread_hash_memory">
              <calc_fnc>2
              23B0BA
              5
              <periods_cnt>5
              0
              1

          0
          <percent_left>0.0000
          <percent_right>0.0000
          <show_3d>0
          <show_legend>1
          <show_triggers>1
          <show_work_period>1
          100.0000
          0.0000
          <ymax_item_key>
          <ymax_type>0
          <ymin_item_key>
          <ymin_type>0

            MySQL

          <graph_elements>
            <graph_element item="Template_MySQL:mysql.innodb_tables_in_use">
              <calc_fnc>2
              D99362
              1
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.innodb_locked_tables">
              <calc_fnc>2
              663344
              0
              <periods_cnt>5
              0
              1

          0
          <percent_left>0.0000
          <percent_right>0.0000
          <show_3d>0
          <show_legend>1
          <show_triggers>1
          <show_work_period>1
          100.0000
          0.0000
          <ymax_item_key>
          <ymax_type>0
          <ymin_item_key>
          <ymin_type>0

            MySQL

          <graph_elements>
            <graph_element item="Template_MySQL:mysql.innodb_lock_wait_secs">
              <calc_fnc>2
              201A33
              0
              <periods_cnt>5
              0
              1

          0
          <percent_left>0.0000
          <percent_right>0.0000
          <show_3d>0
          <show_legend>1
          <show_triggers>1
          <show_work_period>1
          100.0000
          0.0000
          <ymax_item_key>
          <ymax_type>0
          <ymin_item_key>
          <ymin_type>0

            MySQL

          <graph_elements>
            <graph_element item="Template_MySQL:mysql.innodb_lock_structs">
              <calc_fnc>2
              0C4E5D
              0
              <periods_cnt>5
              0
              1

          0
          <percent_left>0.0000
          <percent_right>0.0000
          <show_3d>0
          <show_legend>1
          <show_triggers>1
          <show_work_period>1
          100.0000
          0.0000
          <ymax_item_key>
          <ymax_type>0
          <ymin_item_key>
          <ymin_type>0

            MySQL

          <graph_elements>
            <graph_element item="Template_MySQL:mysql.uncheckpointed_bytes">
              <calc_fnc>2
              661100
              0
              <periods_cnt>5
              0
              1

          0
          <percent_left>0.0000
          <percent_right>0.0000
          <show_3d>0
          <show_legend>1
          <show_triggers>1
          <show_work_period>1
          100.0000
          0.0000
          <ymax_item_key>
          <ymax_type>0
          <ymin_item_key>
          <ymin_type>0

            MySQL

          <graph_elements>
            <graph_element item="Template_MySQL:mysql.Innodb_row_lock_time">
              <calc_fnc>2
              B11D03
              1
              <periods_cnt>5
              0
              1

          0
          <percent_left>0.0000
          <percent_right>0.0000
          <show_3d>0
          <show_legend>1
          <show_triggers>1
          <show_work_period>1
          100.0000
          0.0000
          <ymax_item_key>
          <ymax_type>0
          <ymin_item_key>
          <ymin_type>0

            MySQL

          <graph_elements>
            <graph_element item="Template_MySQL:mysql.Innodb_row_lock_waits">
              <calc_fnc>2
              E84A5F
              1
              <periods_cnt>5
              0
              1

          0
          <percent_left>0.0000
          <percent_right>0.0000
          <show_3d>0
          <show_legend>1
          <show_triggers>1
          <show_work_period>1
          100.0000
          0.0000
          <ymax_item_key>
          <ymax_type>0
          <ymin_item_key>
          <ymin_type>0

            MySQL

          <graph_elements>
            <graph_element item="Template_MySQL:mysql.innodb_sem_waits">
              <calc_fnc>2
              7020AF
              1
              <periods_cnt>5
              0
              1

          0
          <percent_left>0.0000
          <percent_right>0.0000
          <show_3d>0
          <show_legend>1
          <show_triggers>1
          <show_work_period>1
          100.0000
          0.0000
          <ymax_item_key>
          <ymax_type>0
          <ymin_item_key>
          <ymin_type>0

            MySQL

          <graph_elements>
            <graph_element item="Template_MySQL:mysql.innodb_sem_wait_time_ms">
              <calc_fnc>2
              708226
              1
              <periods_cnt>5
              0
              1

          0
          <percent_left>0.0000
          <percent_right>0.0000
          <show_3d>0
          <show_legend>1
          <show_triggers>1
          <show_work_period>1
          100.0000
          0.0000
          <ymax_item_key>
          <ymax_type>0
          <ymin_item_key>
          <ymin_type>0

            MySQL

          <graph_elements>
            <graph_element item="Template_MySQL:mysql.State_closing_tables">
              <calc_fnc>2
              DE0056
              1
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.State_copying_to_tmp_table">
              <calc_fnc>2
              784890
              5
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.State_end">
              <calc_fnc>2
              D1642E
              5
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.State_freeing_items">
              <calc_fnc>2
              487860
              5
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.State_init">
              <calc_fnc>2
              907890
              5
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.State_locked">
              <calc_fnc>2
              DE0056
              5
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.State_login">
              <calc_fnc>2
              1693A7
              5
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.State_preparing">
              <calc_fnc>2
              783030
              5
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.State_reading_from_net">
              <calc_fnc>2
              FF7F00
              5
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.State_sending_data">
              <calc_fnc>2
              54382A
              5
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.State_sorting_result">
              <calc_fnc>2
              B83A04
              5
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.State_statistics">
              <calc_fnc>2
              6E3803
              5
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.State_updating">
              <calc_fnc>2
              B56414
              5
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.State_writing_to_net">
              <calc_fnc>2
              6E645A
              5
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.State_none">
              <calc_fnc>2
              521808
              5
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.State_other">
              <calc_fnc>2
              194240
              5
              <periods_cnt>5
              0
              1

          0
          <percent_left>0.0000
          <percent_right>0.0000
          <show_3d>0
          <show_legend>1
          <show_triggers>1
          <show_work_period>1
          100.0000
          0.0000
          <ymax_item_key>
          <ymax_type>0
          <ymin_item_key>
          <ymin_type>0

            MySQL

          <graph_elements>
            <graph_element item="Template_MySQL:mysql.Handler_commit">
              <calc_fnc>2
              DE0056
              0
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Handler_rollback">
              <calc_fnc>2
              784890
              0
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Handler_savepoint">
              <calc_fnc>2
              D1642E
              0
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Handler_savepoint_rollback">
              <calc_fnc>2
              487860
              0
              <periods_cnt>5
              0
              1

          0
          <percent_left>0.0000
          <percent_right>0.0000
          <show_3d>0
          <show_legend>1
          <show_triggers>1
          <show_work_period>1
          100.0000
          0.0000
          <ymax_item_key>
          <ymax_type>0
          <ymin_item_key>
          <ymin_type>0

            MySQL

          <graph_elements>
            <graph_element item="Template_MySQL:mysql.Handler_write">
              <calc_fnc>2
              4D4A47
              1
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Handler_update">
              <calc_fnc>2
              C79F71
              5
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Handler_delete">
              <calc_fnc>2
              BDB8B3
              5
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Handler_read_first">
              <calc_fnc>2
              8C286E
              5
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Handler_read_key">
              <calc_fnc>2
              BAB27F
              5
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Handler_read_next">
              <calc_fnc>2
              C02942
              5
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Handler_read_prev">
              <calc_fnc>2
              FA6900
              5
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Handler_read_rnd">
              <calc_fnc>2
              5A3D31
              5
              <periods_cnt>5
              0
              1

            <graph_element item="Template_MySQL:mysql.Handler_read_rnd_next">
              <calc_fnc>2
              69D2E7
              5
              <periods_cnt>5
              0
              1

          0
          <percent_left>0.0000
          <percent_right>0.0000
          <show_3d>0
          <show_legend>1
          <show_triggers>1
          <show_work_period>1
          100.0000
          0.0000
          <ymax_item_key>
          <ymax_type>0
          <ymin_item_key>
          <ymin_type>0

        Templates

            MySQL

          <data_type>0
          120
          0
          Ibuf cell count
          60
          0
          365

                    <delay_flex>

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          Unflushed log
          60
          0
          365
          B
                    <delay_flex>

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          State end
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          Threads connected
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Com update multi
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Handler read next
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          Qcache queries in cache
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Spin waits
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          Relay log space
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          InnoDB locked tables
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Handler read first
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          Innodb row lock time
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          Lock system memory
          60
          0
          365
          B
          <delay_flex>

            MySQL

          <data_type>0
          3600
          0
          Pool size
          60
          0
          365
          B
          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          Page hash memory
          60
          0
          365
          B
          <delay_flex>

            MySQL

          <data_type>0
          3600
          0
          Open files limit
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Ibuf merges
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          State sending data
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          Pending log flushes
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Opened tables
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Qcache not cached
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          Total mem alloc
          60
          0
          365
          B
          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          State locked
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          MyISAM Key read requests
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          Open tables
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          InnoDB transactions
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Sort range
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Handler delete
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Threads created
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Rows read
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          Read views
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Handler read key
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Sort rows
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Bytes sent
          60
          0
          365
          B
          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          Pending buf pool flushes
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          InnoDB lock wait secs
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          Slave lag
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          State init
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Log bytes written
          60
          0
          365
          B
          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Questions
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Handler rollback
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          State updating
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          Thread hash memory
          60
          0
          365
          B
          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Com replace select
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Slave retried transactions
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          Qcache total blocks
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Created tmp files
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Handler read rnd
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          MyISAM Key reads
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Com replace
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          Qcache free blocks
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Select range check
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Slow launch threads
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          MyISAM Key buf bytes unflushed
          60
          0
          365
          B
          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Select full range join
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          Current transactions
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          Active transactions
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          Pending AIO sync ios
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          Threads cached
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Handler read rnd next
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          InnoDB lock structs
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          State reading from net
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          State freeing items
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          3600
          0
          Binlog cache size
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Select range
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          MyISAM Key writes
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          State sorting result
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          Hash index cells used
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          State none
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          Open files
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Pages read
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Log bytes flushed
          60
          0
          365
          B
          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Com insert
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Com delete
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          Pending normal AIO writes
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          Free pages
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          Additional pool alloc
          60
          0
          365
          B
          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Created tmp disk tables
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          Slave running
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          State statistics
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          Database pages
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          Uncheckpointed bytes
          60
          0
          365
          B
          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Select full join
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          Pending chkp writes
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Rows updated
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          3600
          0
          Max connections
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Aborted clients
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Sort scan
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          MyISAM Key write requests
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Rows inserted
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Connections
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          State preparing
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Com select
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          OS waits
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          Recovery system memory
          60
          0
          365
          B
          <delay_flex>

            MySQL

          <data_type>0
          3600
          0
          Table cache
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Binlog cache use
          60
          0
          365
          B
          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          InnoDB sem wait time ms
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Com update
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          Qcache free memory
          60
          0
          365
          B
          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Spin rounds
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Handler savepoint
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Com delete multi
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Pages created
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Qcache lowmem prunes
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Bytes received
          60
          0
          365
          B
          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Handler read prev
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          Hash index cells total
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Qcache inserts
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Com load
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          State login
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          History list
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          60
          0
          MySQL Processes
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Qcache hits
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Binlog cache disk use
          60
          0
          365
          B
          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Handler commit
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          State other
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          Slave open temp tables
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          Pending ibuf AIO reads
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          Adaptive hash memory
          60
          0
          365
          B
          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Handler prepare
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Ibuf inserts
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Rows deleted
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Table locks immediate
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          Modified pages
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Table locks waited
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          InnoDB tables in use
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          InnoDB sem waits
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Created tmp tables
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Aborted connects
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          File fsyncs
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          3600
          0
          MyISAM key buffer size
          60
          0
          365
          B
          <delay_flex>

            MySQL

          <data_type>0
          3600
          0
          Query cache size
          60
          0
          365
          B
          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          Innodb row lock waits
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          File system memory
          60
          0
          365
          B
          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          Binary log space
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          Slave stopped
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Handler discover
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          Pending normal AIO reads
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          State copying to tmp table
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Ibuf merged
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Slow queries
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          State closing tables
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          3600
          0
          Thread cache size
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Pages written
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          File reads
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          Ibuf used cells
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Com insert select
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          Locked transactions
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          Pending AIO log ios
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          Pending log writes
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          InnoDB log buffer size
          60
          0
          365
          B
          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          Ibuf free cells
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          File writes
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          Max used connections
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Handler write
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Handler savepoint rollback
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          Threads running
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          MyISAM Key buf bytes used
          60
          0
          365
          B
          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          Dictionary cache memory
          60
          0
          365
          B
          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Handler update
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          InnoDB open files
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Log writes
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Sort merge passes
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          2
          Select scan
          60
          0
          365

          <delay_flex>

            MySQL

          <data_type>0
          120
          0
          State writing to net
          60
          0
          365

          <delay_flex>

Source: mySQL monitoring HowTo Zabbix 2.0

Posted in InformatiqueTagged Zabbix

Post navigation

Sécurisation d’un serveur CentOS 6.3
Convertir des violations selinux en règles

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Proudly powered by WordPress | Theme: micro, developed by DevriX.