Permalink
Browse files

Made graph definitons into plugins

  • Loading branch information...
1 parent d5918d0 commit d3a21350a67b04635f39154aa31c1f37d96e36c9 Kjell-Magne Øierud committed May 13, 2011
View
@@ -17,8 +17,8 @@ all:
test: mysql
@ echo testing ... ; \
export MUNIN_CAP_MULTIGRAPH=1 ; \
- perl -Itest/mock mysql > test/values.out~; \
- perl -Itest/mock mysql config > test/config.out~; \
+ perl -Ilib -Itest/mock mysql > test/values.out~; \
+ perl -Ilib -Itest/mock mysql config > test/config.out~; \
diff -q test/values.out test/values.out~ || true; \
diff -q test/config.out test/config.out~ || true; \
echo ---------------------------------------------------------; \
@@ -0,0 +1,293 @@
+package Munin::MySQL::Graph::InnoDB;
+
+use warnings;
+use strict;
+
+my %graphs = ();
+
+#---------------------------------------------------------------------
+
+$graphs{innodb_bpool} = {
+ config => {
+ global_attrs => {
+ title => 'InnoDB Buffer Pool',
+ vlabel => 'Pages',
+ args => "--base 1024",
+ },
+ data_source_attrs => {
+ draw => 'LINE1',
+ type => 'GAUGE',
+ },
+ },
+ data_sources => [
+ {name => 'ib_bpool_size', label => 'Buffer pool size',
+ draw => 'AREA',
+ colour => 'ffd660',
+ info => 'The total number of buffer pool pages'},
+ {name => 'ib_bpool_dbpages', label => 'Database pages',
+ draw => 'AREA',
+ colour => 'cdcfc4',
+ info => 'The number of used buffer pool pages'},
+ {name => 'ib_bpool_free', label => 'Free pages',
+ info => 'The number of unused buffer pool pages'},
+ {name => 'ib_bpool_modpages', label => 'Modified pages',
+ info => 'The number of "dirty" database pages'},
+ ],
+};
+
+#---------------------------------------------------------------------
+
+$graphs{innodb_bpool_act} = {
+ config => {
+ global_attrs => {
+ title => 'InnoDB Buffer Pool Activity',
+ vlabel => 'Activity per ${graph_period}',
+ total => 'Total',
+ },
+ data_source_attrs => {
+ draw => 'LINE1',
+ },
+ },
+ data_sources => [
+ {name => 'ib_bpool_read', label => 'Pages read',
+ info => 'Pages read into the buffer pool from disk.'},
+ {name => 'ib_bpool_created', label => 'Pages created',
+ info => 'Pages created in the buffer pool without reading the corresponding disk page.'},
+ {name => 'ib_bpool_written', label => 'Pages written',
+ info => 'Pages written to disk from the buffer pool.'},
+ ],
+};
+
+
+#---------------------------------------------------------------------
+
+$graphs{innodb_checkpoint_age} = {
+ config => {
+ global_attrs => {
+ title => 'InnoDB Checkpoint Age',
+ vlabel => 'Bytes',
+ args => "--base 1024 -l 0",
+ },
+ data_source_attrs => {
+ draw => 'AREA',
+ type => 'GAUGE',
+ },
+ },
+ data_sources => [
+ {name => 'innodb_log_size', label => 'InnoDB log size',
+ colour => 'cdcfc4',
+ info => 'The size in bytes of InnoDB log space.',
+ value => sub {
+ $_[0]->{innodb_log_file_size} * $_[0]->{innodb_log_files_in_group}
+ }},
+ {name => 'ib_log_chkpt_age', label => 'Uncheckpointed bytes',
+ colour => 'ffd660',
+ info => 'The age in bytes of InnoDB checkpoint.',
+ value => sub {
+ $_[0]->{ib_log_flush} - $_[0]->{ib_log_checkpoint}
+ }},
+ ],
+};
+
+#---------------------------------------------------------------------
+
+$graphs{innodb_history_length} = {
+ config => {
+ global_attrs => {
+ title => 'InnoDB History List',
+ vlabel => 'Transactions',
+ },
+ data_source_attrs => {
+ draw => 'LINE1',
+ type => 'GAUGE',
+ },
+ },
+ data_sources => [
+ {name => 'ib_tnx_hist', label => 'History list length',
+ info => 'Number of unpurged transactions in undo space.'},
+ ],
+};
+
+#---------------------------------------------------------------------
+
+$graphs{innodb_insert_buf} = {
+ config => {
+ global_attrs => {
+ title => 'InnoDB Insert Buffer',
+ vlabel => 'Activity per ${graph_period}',
+ },
+ data_source_attrs => {
+ draw => 'LINE1',
+ },
+ },
+ data_sources => [
+ {name => 'ib_ibuf_inserts', label => 'Inserts',
+ info => 'These values shows statistics about how many buffer operations InnoDB has done. The ratio of merges to inserts gives a good idea of how efficient the buffer is.'},
+ {name => 'ib_ibuf_merged_rec', label => 'Merged Records'},
+ {name => 'ib_ibuf_merges', label => 'Merges'},
+ ],
+};
+
+#---------------------------------------------------------------------
+
+$graphs{innodb_insert_buf_size} = {
+ config => {
+ global_attrs => {
+ title => 'InnoDB Insert Buffer Size',
+ vlabel => 'Pages',
+ args => "-l 0",
+ },
+ data_source_attrs => {
+ draw => 'LINE1',
+ type => 'GAUGE',
+ },
+ },
+ data_sources => [
+ {name => 'ib_ibuf_seg_size', label => 'Segment size',
+ draw => 'AREA',
+ colour => 'cdcfc4',
+ info => 'Allocated size of insert buffer segment.'},
+ {name => 'ib_ibuf_size', label => 'Unmerged pages',
+ colour => '0022ff',
+ info => 'Number of pages containing unmerged records.'},
+ {name => 'ib_ibuf_free_len', label => 'Free pages',
+ info => 'Number of pages which are free.'},
+ ],
+};
+
+#---------------------------------------------------------------------
+
+$graphs{innodb_io} = {
+ config => {
+ global_attrs => {
+ title => 'InnoDB IO',
+ vlabel => 'IO operations per ${graph_period}',
+ },
+ data_source_attrs => {
+ draw => 'LINE1',
+ },
+ },
+ data_sources => [
+ {name => 'ib_io_read', label => 'File reads',
+ info => 'The number of calls to the OS read function.'},
+ {name => 'ib_io_write', label => 'File writes',
+ info => 'The number of calls to the OS write function.'},
+ {name => 'ib_io_log', label => 'Log writes',
+ info => 'The number of calls to the OS write function that is caused by the log subsystem.'},
+ {name => 'ib_io_fsync', label => 'File syncs',
+ info => 'The number of calls to the OS fsync function.'},
+ ],
+};
+
+#---------------------------------------------------------------------
+
+$graphs{innodb_io_pend} = {
+ config => {
+ global_attrs => {
+ title => 'InnoDB IO Pending',
+ vlabel => 'Pending operations',
+ },
+ data_source_attrs => {
+ draw => 'LINE1',
+ },
+ },
+ data_sources => [
+ {name => 'ib_iop_log', label => 'AIO Log'},
+ {name => 'ib_iop_sync', label => 'AIO Sync'},
+ {name => 'ib_iop_flush_bpool', label => 'Buf Pool Flush'},
+ {name => 'ib_iop_flush_log', label => 'Log Flushes'},
+ {name => 'ib_iop_ibuf_aio', label => 'Insert Buf AIO Read'},
+ {name => 'ib_iop_aioread', label => 'Normal AIO Reads'},
+ {name => 'ib_iop_aiowrite', label => 'Normal AIO Writes'},
+ ],
+};
+
+#---------------------------------------------------------------------
+
+$graphs{innodb_log} = {
+ config => {
+ global_attrs => {
+ title => 'InnoDB Log',
+ vlabel => 'Log activity per ${graph_period}',
+ },
+ data_source_attrs => {
+ draw => 'LINE1',
+ },
+ },
+ data_sources => [
+ {name => 'innodb_log_buffer_size', label => 'Buffer Size',
+ type => 'GAUGE',
+ draw => 'AREA',
+ colour => 'fafd9e',
+ info => 'The size in bytes of the buffer that InnoDB uses to write to the log files on disk.'},
+ {name => 'ib_log_flush', label => 'KB Flushed',
+ info => 'Number of bytes flushed to the transaction log file.'},
+ {name => 'ib_log_written', label => 'KB Written',
+ info => 'Number of bytes written to the transaction log buffer.'},
+ ],
+};
+
+#---------------------------------------------------------------------
+
+$graphs{innodb_rows} = {
+ config => {
+ global_attrs => {
+ title => 'InnoDB Row Operations',
+ vlabel => 'Operations per ${graph_period}',
+ total => 'Total',
+ },
+ data_source_attrs => {},
+ },
+ data_sources => [
+ {name => 'Innodb_rows_deleted', label => 'Deletes',
+ info => 'The number of rows deleted from InnoDB tables.'},
+ {name => 'Innodb_rows_inserted', label => 'Inserts',
+ info => 'The number of rows inserted into InnoDB tables.'},
+ {name => 'Innodb_rows_read', label => 'Reads',
+ info => 'The number of rows read from InnoDB tables.'},
+ {name => 'Innodb_rows_updated', label => 'Updates',
+ info => 'The number of rows updated in InnoDB tables.'},
+ ],
+};
+
+#---------------------------------------------------------------------
+
+$graphs{innodb_semaphores} = {
+ config => {
+ global_attrs => {
+ title => 'InnoDB Semaphores',
+ vlabel => 'Semaphores per ${graph_period}',
+ },
+ data_source_attrs => {
+ draw => 'LINE1',
+ },
+ },
+ data_sources => [
+ {name => 'ib_spin_rounds', label => 'Spin Rounds'},
+ {name => 'ib_spin_waits', label => 'Spin Waits'},
+ {name => 'ib_os_waits', label => 'OS Waits'},
+ ],
+};
+
+#---------------------------------------------------------------------
+
+$graphs{innodb_tnx} = {
+ config => {
+ global_attrs => {
+ title => 'InnoDB Transactions',
+ vlabel => 'Transactions per ${graph_period}',
+ },
+ data_source_attrs => {
+ draw => 'LINE1',
+ },
+ },
+ data_sources => [
+ {name => 'ib_tnx', label => 'Transactions created',
+ info => 'Number of transactions created.'},
+ ],
+};
+
+sub graphs { return \%graphs; }
+
+1;
+
@@ -0,0 +1,78 @@
+package Munin::MySQL::Graph::MyISAM;
+
+use warnings;
+use strict;
+
+my %graphs = ();
+
+#---------------------------------------------------------------------
+
+$graphs{myisam_indexes} = {
+ config => {
+ global_attrs => {
+ title => 'MyISAM Indexes',
+ vlabel => 'Requests per ${graph_period}',
+ },
+ data_source_attrs => {
+ draw => 'LINE1',
+ min => '',
+ },
+ },
+ data_sources => [
+ {name => 'Key_read_requests', label => 'Key read requests',
+ info => 'The number of requests to read a key block from the cache.',
+ draw => 'AREA',
+ colour => '008800',
+ min => '0'},
+ {name => 'Key_reads', label => 'Key reads',
+ info => 'The number of physical reads of a key block from disk.',
+ colour => '00FF00',
+ min => '0'},
+ # plot as negative as long as munin does not support different colours for above and below the line
+ {name => 'Key_write_requests', label => 'Key write requests',
+ info => 'The number of requests to write a key block to the cache.',
+ cdef => 'Key_write_requests,-1,*',
+ draw => 'AREA',
+ colour => '880000'},
+ {name => 'Key_writes', label => 'Key writes',
+ info => 'The number of physical writes of a key block to disk.',
+ cdef => 'Key_writes,-1,*',
+ colour => 'FF0000'},
+ ],
+};
+
+#---------------------------------------------------------------------
+
+$graphs{myisam_key_cache} = {
+ config => {
+ global_attrs => {
+ title => 'MyISAM Key Cache',
+ vlabel => 'Bytes',
+ },
+ data_source_attrs => {
+ type => 'GAUGE',
+ },
+ },
+ data_sources => [
+ {name => 'key_buffer_size', label => 'Key buffer size',
+ draw => 'AREA',
+ colour => '99B898'},
+ {name => 'Key_buf_unused', label => 'Key buffer bytes unused',
+ draw => 'AREA',
+ colour => '2A363B',
+ value => sub {
+ $_[0]->{Key_blocks_unused} * $_[0]->{key_cache_block_size}
+ }},
+ {name => 'Key_buf_unflush', label => 'Key buffer bytes unflushed',
+ draw => 'AREA',
+ colour => 'FECEA8',
+ value => sub {
+ $_[0]->{Key_blocks_not_flushed} * $_[0]->{key_cache_block_size}
+ }},
+ ],
+};
+
+sub graphs { return \%graphs; }
+
+1;
+
Oops, something went wrong.

0 comments on commit d3a2135

Please sign in to comment.