]> arthur.barton.de Git - netdata.git/commitdiff
more mysql charts
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Fri, 20 Nov 2015 23:29:25 +0000 (01:29 +0200)
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Fri, 20 Nov 2015 23:29:25 +0000 (01:29 +0200)
charts.d/mysql.chart.sh

index b9bb93775db838d867b6463946263af58cfeba69..48433ca10bb1568ff1a509b067dc43a88b0efa7f 100755 (executable)
@@ -83,9 +83,7 @@ DIMENSION Queries queries incremental 1 $((1 * mysql_update_every))
 DIMENSION Questions questions incremental 1 $((1 * mysql_update_every))
 DIMENSION Slow_queries slow_queries incremental -1 $((1 * mysql_update_every))
 
-CHART mysql_$m.operations '' "mysql Operations" "operations / sec" mysql_$m mysql line 20003 $mysql_update_every
-DIMENSION Opened_tables opened_tables incremental 1 $((1 * mysql_update_every))
-DIMENSION Flush_commands flush incremental 1 $((1 * mysql_update_every))
+CHART mysql_$m.handlers '' "mysql Handlers" "handlers / sec" mysql_$m mysql line 20003 $mysql_update_every
 DIMENSION Handler_commit commit incremental 1 $((1 * mysql_update_every))
 DIMENSION Handler_delete delete incremental 1 $((1 * mysql_update_every))
 DIMENSION Handler_prepare prepare incremental 1 $((1 * mysql_update_every))
@@ -105,7 +103,7 @@ CHART mysql_$m.table_locks '' "mysql Tables Locks" "locks / sec" mysql_$m mysql
 DIMENSION Table_locks_immediate immediate incremental 1 $((1 * mysql_update_every))
 DIMENSION Table_locks_waited waited incremental -1 $((1 * mysql_update_every))
 
-CHART mysql_$m.select_issues '' "mysql Select Issues" "issues / sec" mysql_$m mysql line 20005 $mysql_update_every
+CHART mysql_$m.join_issues '' "mysql Select Join Issues" "joins / sec" mysql_$m mysql line 20005 $mysql_update_every
 DIMENSION Select_full_join full_join incremental 1 $((1 * mysql_update_every))
 DIMENSION Select_full_range_join full_range_join incremental 1 $((1 * mysql_update_every))
 DIMENSION Select_range range incremental 1 $((1 * mysql_update_every))
@@ -116,6 +114,71 @@ CHART mysql_$m.sort_issues '' "mysql Sort Issues" "issues / sec" mysql_$m mysql
 DIMENSION Sort_merge_passes merge_passes incremental 1 $((1 * mysql_update_every))
 DIMENSION Sort_range range incremental 1 $((1 * mysql_update_every))
 DIMENSION Sort_scan scan incremental 1 $((1 * mysql_update_every))
+
+CHART mysql_$m.tmp '' "mysql Tmp Operations" "counter" mysql_$m mysql line 20007 $mysql_update_every
+DIMENSION Created_tmp_disk_tables disk_tables incremental 1 $((1 * mysql_update_every))
+DIMENSION Created_tmp_files files incremental 1 $((1 * mysql_update_every))
+DIMENSION Created_tmp_tables tables incremental 1 $((1 * mysql_update_every))
+
+CHART mysql_$m.connection_errors '' "mysql Connection Errors" "connections/s" mysql_$m mysql line 20008 $mysql_update_every
+DIMENSION Connection_errors_accept accept incremental 1 $((1 * mysql_update_every))
+DIMENSION Connection_errors_internal internal incremental 1 $((1 * mysql_update_every))
+DIMENSION Connection_errors_max_connections max incremental 1 $((1 * mysql_update_every))
+DIMENSION Connection_errors_peer_addr peer_addr incremental 1 $((1 * mysql_update_every))
+DIMENSION Connection_errors_select select incremental 1 $((1 * mysql_update_every))
+DIMENSION Connection_errors_tcpwrap tcpwrap incremental 1 $((1 * mysql_update_every))
+
+CHART mysql_$m.connections '' "mysql Connections" "connections/s" mysql_$m mysql line 20009 $mysql_update_every
+DIMENSION Connections all incremental 1 $((1 * mysql_update_every))
+DIMENSION Aborted_connects aborded incremental 1 $((1 * mysql_update_every))
+
+CHART mysql_$m.binlog_cache '' "mysql Binlog Cache" "transactions/s" mysql_$m mysql line 20010 $mysql_update_every
+DIMENSION Binlog_cache_disk_use disk incremental 1 $((1 * mysql_update_every))
+DIMENSION Binlog_cache_use all incremental 1 $((1 * mysql_update_every))
+
+CHART mysql_$m.binlog_stmt_cache '' "mysql Binlog Statement Cache" "statements/s" mysql_$m mysql line 20011 $mysql_update_every
+DIMENSION Binlog_stmt_cache_disk_use disk incremental 1 $((1 * mysql_update_every))
+DIMENSION Binlog_stmt_cache_use all incremental 1 $((1 * mysql_update_every))
+
+CHART mysql_$m.threads '' "mysql Threads" "threads" mysql_$m mysql line 20012 $mysql_update_every
+DIMENSION Threads_connected connected absolute 1 $((1 * mysql_update_every))
+DIMENSION Threads_created created incremental 1 $((1 * mysql_update_every))
+DIMENSION Threads_cached cached absolute -1 $((1 * mysql_update_every))
+DIMENSION Threads_running running absolute 1 $((1 * mysql_update_every))
+
+CHART mysql_$m.thread_cache_misses '' "mysql Threads Cache Misses" "misses" mysql_$m mysql area 20013 $mysql_update_every
+DIMENSION misses misses absolute 1 $((100 * mysql_update_every))
+
+CHART mysql_$m.innodb_io '' "mysql InnoDB I/O Bandwidth" "kbps" mysql_$m mysql area 20014 $mysql_update_every
+DIMENSION Innodb_data_read read incremental 8 $((1000 * mysql_update_every))
+DIMENSION Innodb_data_written write incremental -8 $((1000 * mysql_update_every))
+
+CHART mysql_$m.innodb_io_ops '' "mysql InnoDB I/O Operations" "operations/s" mysql_$m mysql line 20015 $mysql_update_every
+DIMENSION Innodb_data_reads reads incremental 1 $((1 * mysql_update_every))
+DIMENSION Innodb_data_writes writes incremental -1 $((1 * mysql_update_every))
+
+CHART mysql_$m.innodb_log '' "mysql InnoDB Log Operations" "operations/s" mysql_$m mysql line 20016 $mysql_update_every
+DIMENSION Innodb_log_waits waits incremental 1 $((1 * mysql_update_every))
+DIMENSION Innodb_log_write_requests write_requests incremental -1 $((1 * mysql_update_every))
+DIMENSION Innodb_log_writes writes incremental -1 $((1 * mysql_update_every))
+
+CHART mysql_$m.innodb_os_log '' "mysql InnoDB OS Log Operations" "operations/s" mysql_$m mysql line 20017 $mysql_update_every
+DIMENSION Innodb_os_log_fsyncs fsyncs incremental 1 $((1 * mysql_update_every))
+DIMENSION Innodb_os_log_pending_fsyncs pending_fsyncs incremental 1 $((1 * mysql_update_every))
+DIMENSION Innodb_os_log_pending_writes pending_writes incremental -1 $((1 * mysql_update_every))
+
+CHART mysql_$m.innodb_os_log_io '' "mysql InnoDB OS Log Bandwidth" "kbps" mysql_$m mysql area 20018 $mysql_update_every
+DIMENSION Innodb_os_log_written write incremental -8 $((1000 * mysql_update_every))
+
+CHART mysql_$m.innodb_cur_row_lock '' "mysql InnoDB Current Row Locks" "operations" mysql_$m mysql area 20019 $mysql_update_every
+DIMENSION Innodb_row_lock_current_waits current_waits absolute 1 $((1 * mysql_update_every))
+
+CHART mysql_$m.innodb_rows '' "mysql InnoDB Row Operations" "operations/s" mysql_$m mysql area 20020 $mysql_update_every
+DIMENSION Innodb_rows_read read incremental 1 $((1 * mysql_update_every))
+DIMENSION Innodb_rows_deleted deleted incremental -1 $((1 * mysql_update_every))
+DIMENSION Innodb_rows_inserted inserted incremental 1 $((1 * mysql_update_every))
+DIMENSION Innodb_rows_updated updated incremental -1 $((1 * mysql_update_every))
+
 EOF
        done
        return 0
@@ -145,7 +208,75 @@ mysql_update() {
        for m in "${!mysql_ids[@]}"
        do
                x="${mysql_ids[$m]}"
+
+               unset \
+                       mysql_Bytes_received \
+                       mysql_Bytes_sent \
+                       mysql_Queries \
+                       mysql_Questions \
+                       mysql_Slow_queries \
+                       mysql_Handler_commit \
+                       mysql_Handler_delete \
+                       mysql_Handler_prepare \
+                       mysql_Handler_read_first \
+                       mysql_Handler_read_key \
+                       mysql_Handler_read_next \
+                       mysql_Handler_read_prev \
+                       mysql_Handler_read_rnd \
+                       mysql_Handler_read_rnd_next \
+                       mysql_Handler_rollback \
+                       mysql_Handler_savepoint \
+                       mysql_Handler_savepoint_rollback \
+                       mysql_Handler_update \
+                       mysql_Handler_write \
+                       mysql_Table_locks_immediate \
+                       mysql_Table_locks_waited \
+                       mysql_Select_full_join \
+                       mysql_Select_full_range_join \
+                       mysql_Select_range \
+                       mysql_Select_range_check \
+                       mysql_Select_scan \
+                       mysql_Sort_merge_passes \
+                       mysql_Sort_range \
+                       mysql_Sort_scan \
+                       mysql_Created_tmp_disk_tables \
+                       mysql_Created_tmp_files \
+                       mysql_Created_tmp_tables \
+                       mysql_Connection_errors_accept \
+                       mysql_Connection_errors_internal \
+                       mysql_Connection_errors_max_connections \
+                       mysql_Connection_errors_peer_addr \
+                       mysql_Connection_errors_select \
+                       mysql_Connection_errors_tcpwrap \
+                       mysql_Connections \
+                       mysql_Aborted_connects \
+                       mysql_Binlog_cache_disk_use \
+                       mysql_Binlog_cache_use \
+                       mysql_Binlog_stmt_cache_disk_use \
+                       mysql_Binlog_stmt_cache_use \
+                       mysql_Threads_connected \
+                       mysql_Threads_created \
+                       mysql_Threads_cached \
+                       mysql_Threads_running \
+                       mysql_Innodb_data_read \
+                       mysql_Innodb_data_written \
+                       mysql_Innodb_data_reads \
+                       mysql_Innodb_data_writes \
+                       mysql_Innodb_log_waits \
+                       mysql_Innodb_log_write_requests \
+                       mysql_Innodb_log_writes \
+                       mysql_Innodb_os_log_fsyncs \
+                       mysql_Innodb_os_log_pending_fsyncs \
+                       mysql_Innodb_os_log_pending_writes \
+                       mysql_Innodb_os_log_written \
+                       mysql_Innodb_row_lock_current_waits \
+                       mysql_Innodb_rows_inserted \
+                       mysql_Innodb_rows_read \
+                       mysql_Innodb_rows_updated \
+                       mysql_Innodb_rows_deleted
+
                mysql_plugin_command_failure=0
+               
                eval "$(mysql_get "${mysql_cmds[$m]}" ${mysql_opts[$m]} |\
                        sed -e "s/[[:space:]]\+/ /g" -e "s/\./_/g" -e "s/^\([a-zA-Z0-9_]\+\)[[:space:]]\+\([0-9]\+\)$/local mysql_\1=\2/g" |\
                        egrep "^local mysql_[a-zA-Z0-9_]+=[[:digit:]]+$")"
@@ -159,8 +290,12 @@ mysql_update() {
                        continue
                fi
 
-       # write the result of the work.
-       cat <<VALUESEOF
+               local misses=0
+               [ -z "$mysql_Connections" ] && mysql_Connections=0
+               [ $(( mysql_Connections + 1 - 1 )) -gt 0 ] && misses=$(( mysql_Threads_created * 10000 / mysql_Connections ))
+
+               # write the result of the work.
+               cat <<VALUESEOF
 BEGIN mysql_$x.bandwidth $1
 SET Bytes_received = $mysql_Bytes_received
 SET Bytes_sent = $mysql_Bytes_sent
@@ -170,9 +305,7 @@ SET Queries = $mysql_Queries
 SET Questions = $mysql_Questions
 SET Slow_queries = $mysql_Slow_queries
 END
-BEGIN mysql_$x.operations $1
-SET Opened_tables = $mysql_Opened_tables
-SET Flush_commands = $mysql_Flush_commands
+BEGIN mysql_$x.handlers $1
 SET Handler_commit = $mysql_Handler_commit
 SET Handler_delete = $mysql_Handler_delete
 SET Handler_prepare = $mysql_Handler_prepare
@@ -192,7 +325,7 @@ BEGIN mysql_$x.table_locks $1
 SET Table_locks_immediate = $mysql_Table_locks_immediate
 SET Table_locks_waited = $mysql_Table_locks_waited
 END
-BEGIN mysql_$x.select_issues $1
+BEGIN mysql_$x.join_issues $1
 SET Select_full_join = $mysql_Select_full_join
 SET Select_full_range_join = $mysql_Select_full_range_join
 SET Select_range = $mysql_Select_range
@@ -204,6 +337,70 @@ SET Sort_merge_passes = $mysql_Sort_merge_passes
 SET Sort_range = $mysql_Sort_range
 SET Sort_scan = $mysql_Sort_scan
 END
+BEGIN mysql_$m.tmp $1
+SET Created_tmp_disk_tables = $mysql_Created_tmp_disk_tables
+SET Created_tmp_files = $mysql_Created_tmp_files
+SET Created_tmp_tables = $mysql_Created_tmp_tables
+END
+BEGIN mysql_$m.connection_errors $1
+SET Connection_errors_accept = $mysql_Connection_errors_accept
+SET Connection_errors_internal = $mysql_Connection_errors_internal
+SET Connection_errors_max_connections = $mysql_Connection_errors_max_connections
+SET Connection_errors_peer_addr = $mysql_Connection_errors_peer_addr
+SET Connection_errors_select = $mysql_Connection_errors_select
+SET Connection_errors_tcpwrap = $mysql_Connection_errors_tcpwrap
+END
+BEGIN mysql_$m.connections $1
+SET Connections = $mysql_Connections
+SET Aborted_connects = $mysql_Aborted_connects
+END
+BEGIN mysql_$m.binlog_cache $1
+SET Binlog_cache_disk_use = $mysql_Binlog_cache_disk_use
+SET Binlog_cache_use = $mysql_Binlog_cache_use
+END
+BEGIN mysql_$m.binlog_stmt_cache $1
+SET Binlog_stmt_cache_disk_use = $mysql_Binlog_stmt_cache_disk_use
+SET Binlog_stmt_cache_use = $mysql_Binlog_stmt_cache_use
+END
+BEGIN mysql_$m.threads $1
+SET Threads_connected = $mysql_Threads_connected
+SET Threads_created = $mysql_Threads_created
+SET Threads_cached = $mysql_Threads_cached
+SET Threads_running = $mysql_Threads_running
+END
+BEGIN mysql_$m.thread_cache_misses $1
+SET misses = $misses
+END
+BEGIN mysql_$m.innodb_io $1
+SET Innodb_data_read = $mysql_Innodb_data_read
+SET Innodb_data_written = $mysql_Innodb_data_written
+END
+BEGIN mysql_$m.innodb_io_ops $1
+SET Innodb_data_reads = $mysql_Innodb_data_reads
+SET Innodb_data_writes = $mysql_Innodb_data_writes
+END
+BEGIN mysql_$m.innodb_log $1
+SET Innodb_log_waits = $mysql_Innodb_log_waits
+SET Innodb_log_write_requests = $mysql_Innodb_log_write_requests
+SET Innodb_log_writes = $mysql_Innodb_log_writes
+END
+BEGIN mysql_$m.innodb_os_log $1
+SET Innodb_os_log_fsyncs = $mysql_Innodb_os_log_fsyncs
+SET Innodb_os_log_pending_fsyncs = $mysql_Innodb_os_log_pending_fsyncs
+SET Innodb_os_log_pending_writes = $mysql_Innodb_os_log_pending_writes
+END
+BEGIN mysql_$m.innodb_os_log_io $1
+SET Innodb_os_log_written = $mysql_Innodb_os_log_written
+END
+BEGIN mysql_$m.innodb_cur_row_lock $1
+SET Innodb_row_lock_current_waits = $mysql_Innodb_row_lock_current_waits
+END
+BEGIN mysql_$m.innodb_rows $1
+SET Innodb_rows_inserted = $mysql_Innodb_rows_inserted
+SET Innodb_rows_read = $mysql_Innodb_rows_read
+SET Innodb_rows_updated = $mysql_Innodb_rows_updated
+SET Innodb_rows_deleted = $mysql_Innodb_rows_deleted
+END
 VALUESEOF
        done