Skip to content

Commit

Permalink
New graph: Key buffer used/unflushed/total
Browse files Browse the repository at this point in the history
  • Loading branch information
Brice Figureau committed Aug 15, 2011
1 parent 4a7bf58 commit e79faab
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 4 deletions.
24 changes: 24 additions & 0 deletions MYSQL-SERVER-MIB.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1236,5 +1236,29 @@ myInooDBSemWaitTime OBJECT-TYPE
"Total time innodb waited for semaphores"
::= { myStatus 145 }

myKeyBufBytesUnflushed OBJECT-TYPE
SYNTAX mySQLUnsigned64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Key Buffer bytes still unflushed"
::= { myStatus 146 }

myKeyBufBytesUsed OBJECT-TYPE
SYNTAX mySQLUnsigned64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Key Buffer used in bytes"
::= { myStatus 147 }

myKeyBufferSize OBJECT-TYPE
SYNTAX mySQLUnsigned64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Size of the Key Buffer"
::= { myStatus 148 }


END
17 changes: 14 additions & 3 deletions mysql-snmp
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ my @types = (
'Gauge32', 'Gauge32', 'Gauge32', 'Gauge32', # 133 - 136
'Counter64', 'Counter64', 'Counter64', 'Counter64', # 137 - 140
'Counter64', 'Counter64', 'Counter64', 'Counter64', # 141 - 144
'Counter64', # 145 - 145
'Counter64', 'Counter64', 'Counter64', 'Counter64', # 145 - 148
);

my @newkeys = (
Expand Down Expand Up @@ -550,7 +550,8 @@ my @newkeys = (
'myDictionaryCacheMemory', 'myFileSystemMemory', # 139 - 140
'myLockSystemMemory', 'myRecoverySystemMemory', # 141 - 142
'myThreadHashMemory', 'myInnoDBSemWaits', # 143 - 144
'myInnoDBSemWaitTime', # 145 - 145
'myInnoDBSemWaitTime', 'myKeyBufBytesUnflushed', # 145 - 146
'myKeyBufBytesUsed', 'myKeyBufferSize', # 147 - 148
);

my @oldkeys = (
Expand Down Expand Up @@ -626,7 +627,8 @@ my @oldkeys = (
'dictionary_cache_memory', 'file_system_memory', # 139 - 140
'lock_system_memory', 'recovery_system_memory', # 141 - 142
'thread_hash_memory', 'innodb_sem_waits', # 143 - 144
'innodb_sem_wait_time_ms', # 145 - 145
'innodb_sem_wait_time_ms', 'key_buf_bytes_unflushed', # 145 - 146
'key_buf_bytes_used', 'key_buffer_size', # 147 - 148
);

run() unless caller();
Expand Down Expand Up @@ -656,6 +658,13 @@ sub max {
return $b;
}

sub bigint($) {
my $str = shift;
return Math::BigInt->bzero() if !$str;
return new Math::BigInt $1 if $str =~ m/(\d+)/;
return Math::BigInt->bzero();
}

# This function has been translated from PHP to Perl from the
# excellent Baron Schwartz's MySQL Cacti Templates
sub fetch_mysql_data {
Expand Down Expand Up @@ -807,6 +816,8 @@ sub fetch_mysql_data {
}
}

$status{'key_buf_bytes_used'} = bigint($status{'key_buffer_size'})->bsub(bigint($status{'Key_blocks_unused'})->bmul($status{'key_cache_block_size'}));
$status{'key_buf_bytes_unflushed'} = bigint($status{'Key_blocks_not_flushed'})->bmul(bigint($status{'key_cache_block_size'}));

# Get SHOW PROCESSLIST and aggregate it by state, then add it to the array
# too.
Expand Down
3 changes: 3 additions & 0 deletions opennms/mysql.datacollection-config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@
<mibObj oid=".1.3.6.1.4.1.20267.200.1.143" instance="0" alias="myThreadHashMemory" type="Gauge64" />
<mibObj oid=".1.3.6.1.4.1.20267.200.1.144" instance="0" alias="myInnoDBSemWaits" type="Counter64" />
<mibObj oid=".1.3.6.1.4.1.20267.200.1.145" instance="0" alias="myInnoDBSemWaitTime" type="Counter64" />
<mibObj oid=".1.3.6.1.4.1.20267.200.1.146" instance="0" alias="myKeyBufBytsUnflshd" type="Gauge64" />
<mibObj oid=".1.3.6.1.4.1.20267.200.1.147" instance="0" alias="myKeyBufBytesUsed" type="Gauge64" />
<mibObj oid=".1.3.6.1.4.1.20267.200.1.148" instance="0" alias="myKeyBufferSize" type="Gauge64" />
</group>

<systemDef name="Net-Snmp">
Expand Down
26 changes: 25 additions & 1 deletion opennms/mysql.snmp-graph.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Add this to the reports list
# reports=mysql.mysqlfilesandtables, mysql.myisamindexes, mysql.mysqlnetworktraffic, mysql.mysqlquerycachememory, mysql.innodbiopending, mysql.innodbinternalhashmemoryusage, mysql.innodbactivelockedtransactions, mysql.innodblog, mysql.mysqlsorts, mysql.mysqltemporaryobjects, mysql.innodbcheckpointage, mysql.innodbtablesinuse, mysql.innodbrowoperations, mysql.innodbtransactions, mysql.innodbsemaphores, mysql.mysqlprocesslist, mysql.innodbadaptivehashindex, mysql.mysqlselecttypes, mysql.mysqlthreads, mysql.innodbinsertbufferusage, mysql.mysqlcommandcounters, mysql.innodbinsertbuffer, mysql.innodbmemoryallocation, mysql.mysqlconnections, mysql.innodblockstructures, mysql.innodbsemaphorewaittime, mysql.innodbbufferpool, mysql.mysqltablelocks, mysql.innodbsemaphorewaits, mysql.mysqlreplication, mysql.innodbio, mysql.mysqlquerycache, mysql.innodbbufferpoolactivity, mysql.mysqlbinaryrelaylogs, mysql.innodbcurrentlockwaits
# reports=mysql.mysqlfilesandtables, mysql.myisamindexes, mysql.mysqlnetworktraffic, mysql.mysqlquerycachememory, mysql.innodbiopending, mysql.innodbinternalhashmemoryusage, mysql.innodbactivelockedtransactions, mysql.innodblog, mysql.mysqlsorts, mysql.mysqltemporaryobjects, mysql.innodbcheckpointage, mysql.innodbtablesinuse, mysql.innodbrowoperations, mysql.innodbtransactions, mysql.innodbsemaphores, mysql.mysqlprocesslist, mysql.innodbadaptivehashindex, mysql.mysqlselecttypes, mysql.mysqlthreads, mysql.innodbinsertbufferusage, mysql.mysqlcommandcounters, mysql.innodbinsertbuffer, mysql.innodbmemoryallocation, mysql.mysqlconnections, mysql.innodblockstructures, mysql.innodbsemaphorewaittime, mysql.innodbbufferpool, mysql.mysqltablelocks, mysql.myisamkeycache, mysql.innodbsemaphorewaits, mysql.mysqlreplication, mysql.innodbio, mysql.mysqlquerycache, mysql.innodbbufferpoolactivity, mysql.mysqlbinaryrelaylogs, mysql.innodbcurrentlockwaits

# paste this at the end of snmp-graph.properties file
report.mysql.myisamindexes.name=MyISAM Indexes
Expand Down Expand Up @@ -1057,3 +1057,27 @@ report.mysql.innodbsemaphorewaittime.command=--title "InnoDB Semaphore Wait Time
GPRINT:myInnoDBSemWaitTime:AVERAGE:"Avg \\: %8.2lf %s" \
GPRINT:myInnoDBSemWaitTime:MIN:"Min \\: %8.2lf %s" \
GPRINT:myInnoDBSemWaitTime:MAX:"Max \\: %8.2lf %s\\n"

report.mysql.myisamkeycache.columns=myKeyBufferSize,myKeyBufBytesUsed,myKeyBufBytsUnflshd
report.mysql.myisamkeycache.type=nodeSnmp
report.mysql.myisamkeycache.width=565
report.mysql.myisamkeycache.height=200
report.mysql.myisamkeycache.command=--title "MyISAM Key Cache" \
--width 565 \
--height 200 \
DEF:myKeyBufferSize={rrd1}:myKeyBufferSize:AVERAGE \
DEF:myKeyBufBytesUsed={rrd2}:myKeyBufBytesUsed:AVERAGE \
DEF:myKeyBufBytsUnflshd={rrd3}:myKeyBufBytsUnflshd:AVERAGE \
AREA:myKeyBufferSize#99B898:"Key Buffer Size " \
GPRINT:myKeyBufferSize:AVERAGE:"Avg \\: %8.2lf %s" \
GPRINT:myKeyBufferSize:MIN:"Min \\: %8.2lf %s" \
GPRINT:myKeyBufferSize:MAX:"Max \\: %8.2lf %s\\n" \
AREA:myKeyBufBytesUsed#2A363B:"Key Buf Bytes Used " \
GPRINT:myKeyBufBytesUsed:AVERAGE:"Avg \\: %8.2lf %s" \
GPRINT:myKeyBufBytesUsed:MIN:"Min \\: %8.2lf %s" \
GPRINT:myKeyBufBytesUsed:MAX:"Max \\: %8.2lf %s\\n" \
AREA:myKeyBufBytsUnflshd#FECEA8:"Key Buf Bytes Unflushed" \
GPRINT:myKeyBufBytsUnflshd:AVERAGE:"Avg \\: %8.2lf %s" \
GPRINT:myKeyBufBytsUnflshd:MIN:"Min \\: %8.2lf %s" \
GPRINT:myKeyBufBytsUnflshd:MAX:"Max \\: %8.2lf %s\\n"

3 changes: 3 additions & 0 deletions opennms/tools/cacti2MIB.pl
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@
'thread_hash_memory' => {mib => 'myThreadHashMemory', order => 143, type => 'Gauge64'},
'innodb_sem_waits' => {mib => 'myInnoDBSemWaits', order => 144, type => 'Counter64'},
'innodb_sem_wait_time_ms' => {mib => 'myInnoDBSemWaitTime', order => 145, type => 'Counter64'},
'key_buf_bytes_unflushed' => {mib => 'myKeyBufBytesUnflushed', order => 146, type => 'Gauge64'},
'key_buf_bytes_used' => {mib => 'myKeyBufBytesUsed', order => 147, type => 'Gauge64'},
'key_buffer_size' => {mib => 'myKeyBufferSize', order => 148, type => 'Gauge64'},
},
startoid => '.1.3.6.1.4.1.20267.200.1',
}

0 comments on commit e79faab

Please sign in to comment.