Skip to content
This repository was archived by the owner on Mar 22, 2023. It is now read-only.

Commit e79faab

Browse files
author
Brice Figureau
committed
New graph: Key buffer used/unflushed/total
1 parent 4a7bf58 commit e79faab

File tree

5 files changed

+69
-4
lines changed

5 files changed

+69
-4
lines changed

MYSQL-SERVER-MIB.txt

+24
Original file line numberDiff line numberDiff line change
@@ -1236,5 +1236,29 @@ myInooDBSemWaitTime OBJECT-TYPE
12361236
"Total time innodb waited for semaphores"
12371237
::= { myStatus 145 }
12381238

1239+
myKeyBufBytesUnflushed OBJECT-TYPE
1240+
SYNTAX mySQLUnsigned64
1241+
MAX-ACCESS read-only
1242+
STATUS current
1243+
DESCRIPTION
1244+
"Key Buffer bytes still unflushed"
1245+
::= { myStatus 146 }
1246+
1247+
myKeyBufBytesUsed OBJECT-TYPE
1248+
SYNTAX mySQLUnsigned64
1249+
MAX-ACCESS read-only
1250+
STATUS current
1251+
DESCRIPTION
1252+
"Key Buffer used in bytes"
1253+
::= { myStatus 147 }
1254+
1255+
myKeyBufferSize OBJECT-TYPE
1256+
SYNTAX mySQLUnsigned64
1257+
MAX-ACCESS read-only
1258+
STATUS current
1259+
DESCRIPTION
1260+
"Size of the Key Buffer"
1261+
::= { myStatus 148 }
1262+
12391263

12401264
END

mysql-snmp

+14-3
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ my @types = (
474474
'Gauge32', 'Gauge32', 'Gauge32', 'Gauge32', # 133 - 136
475475
'Counter64', 'Counter64', 'Counter64', 'Counter64', # 137 - 140
476476
'Counter64', 'Counter64', 'Counter64', 'Counter64', # 141 - 144
477-
'Counter64', # 145 - 145
477+
'Counter64', 'Counter64', 'Counter64', 'Counter64', # 145 - 148
478478
);
479479

480480
my @newkeys = (
@@ -550,7 +550,8 @@ my @newkeys = (
550550
'myDictionaryCacheMemory', 'myFileSystemMemory', # 139 - 140
551551
'myLockSystemMemory', 'myRecoverySystemMemory', # 141 - 142
552552
'myThreadHashMemory', 'myInnoDBSemWaits', # 143 - 144
553-
'myInnoDBSemWaitTime', # 145 - 145
553+
'myInnoDBSemWaitTime', 'myKeyBufBytesUnflushed', # 145 - 146
554+
'myKeyBufBytesUsed', 'myKeyBufferSize', # 147 - 148
554555
);
555556

556557
my @oldkeys = (
@@ -626,7 +627,8 @@ my @oldkeys = (
626627
'dictionary_cache_memory', 'file_system_memory', # 139 - 140
627628
'lock_system_memory', 'recovery_system_memory', # 141 - 142
628629
'thread_hash_memory', 'innodb_sem_waits', # 143 - 144
629-
'innodb_sem_wait_time_ms', # 145 - 145
630+
'innodb_sem_wait_time_ms', 'key_buf_bytes_unflushed', # 145 - 146
631+
'key_buf_bytes_used', 'key_buffer_size', # 147 - 148
630632
);
631633

632634
run() unless caller();
@@ -656,6 +658,13 @@ sub max {
656658
return $b;
657659
}
658660

661+
sub bigint($) {
662+
my $str = shift;
663+
return Math::BigInt->bzero() if !$str;
664+
return new Math::BigInt $1 if $str =~ m/(\d+)/;
665+
return Math::BigInt->bzero();
666+
}
667+
659668
# This function has been translated from PHP to Perl from the
660669
# excellent Baron Schwartz's MySQL Cacti Templates
661670
sub fetch_mysql_data {
@@ -807,6 +816,8 @@ sub fetch_mysql_data {
807816
}
808817
}
809818

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

811822
# Get SHOW PROCESSLIST and aggregate it by state, then add it to the array
812823
# too.

opennms/mysql.datacollection-config.xml

+3
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,9 @@
150150
<mibObj oid=".1.3.6.1.4.1.20267.200.1.143" instance="0" alias="myThreadHashMemory" type="Gauge64" />
151151
<mibObj oid=".1.3.6.1.4.1.20267.200.1.144" instance="0" alias="myInnoDBSemWaits" type="Counter64" />
152152
<mibObj oid=".1.3.6.1.4.1.20267.200.1.145" instance="0" alias="myInnoDBSemWaitTime" type="Counter64" />
153+
<mibObj oid=".1.3.6.1.4.1.20267.200.1.146" instance="0" alias="myKeyBufBytsUnflshd" type="Gauge64" />
154+
<mibObj oid=".1.3.6.1.4.1.20267.200.1.147" instance="0" alias="myKeyBufBytesUsed" type="Gauge64" />
155+
<mibObj oid=".1.3.6.1.4.1.20267.200.1.148" instance="0" alias="myKeyBufferSize" type="Gauge64" />
153156
</group>
154157

155158
<systemDef name="Net-Snmp">

opennms/mysql.snmp-graph.properties

+25-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Add this to the reports list
2-
# 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
2+
# 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
33

44
# paste this at the end of snmp-graph.properties file
55
report.mysql.myisamindexes.name=MyISAM Indexes
@@ -1057,3 +1057,27 @@ report.mysql.innodbsemaphorewaittime.command=--title "InnoDB Semaphore Wait Time
10571057
GPRINT:myInnoDBSemWaitTime:AVERAGE:"Avg \\: %8.2lf %s" \
10581058
GPRINT:myInnoDBSemWaitTime:MIN:"Min \\: %8.2lf %s" \
10591059
GPRINT:myInnoDBSemWaitTime:MAX:"Max \\: %8.2lf %s\\n"
1060+
1061+
report.mysql.myisamkeycache.columns=myKeyBufferSize,myKeyBufBytesUsed,myKeyBufBytsUnflshd
1062+
report.mysql.myisamkeycache.type=nodeSnmp
1063+
report.mysql.myisamkeycache.width=565
1064+
report.mysql.myisamkeycache.height=200
1065+
report.mysql.myisamkeycache.command=--title "MyISAM Key Cache" \
1066+
--width 565 \
1067+
--height 200 \
1068+
DEF:myKeyBufferSize={rrd1}:myKeyBufferSize:AVERAGE \
1069+
DEF:myKeyBufBytesUsed={rrd2}:myKeyBufBytesUsed:AVERAGE \
1070+
DEF:myKeyBufBytsUnflshd={rrd3}:myKeyBufBytsUnflshd:AVERAGE \
1071+
AREA:myKeyBufferSize#99B898:"Key Buffer Size " \
1072+
GPRINT:myKeyBufferSize:AVERAGE:"Avg \\: %8.2lf %s" \
1073+
GPRINT:myKeyBufferSize:MIN:"Min \\: %8.2lf %s" \
1074+
GPRINT:myKeyBufferSize:MAX:"Max \\: %8.2lf %s\\n" \
1075+
AREA:myKeyBufBytesUsed#2A363B:"Key Buf Bytes Used " \
1076+
GPRINT:myKeyBufBytesUsed:AVERAGE:"Avg \\: %8.2lf %s" \
1077+
GPRINT:myKeyBufBytesUsed:MIN:"Min \\: %8.2lf %s" \
1078+
GPRINT:myKeyBufBytesUsed:MAX:"Max \\: %8.2lf %s\\n" \
1079+
AREA:myKeyBufBytsUnflshd#FECEA8:"Key Buf Bytes Unflushed" \
1080+
GPRINT:myKeyBufBytsUnflshd:AVERAGE:"Avg \\: %8.2lf %s" \
1081+
GPRINT:myKeyBufBytsUnflshd:MIN:"Min \\: %8.2lf %s" \
1082+
GPRINT:myKeyBufBytsUnflshd:MAX:"Max \\: %8.2lf %s\\n"
1083+

opennms/tools/cacti2MIB.pl

+3
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,9 @@
165165
'thread_hash_memory' => {mib => 'myThreadHashMemory', order => 143, type => 'Gauge64'},
166166
'innodb_sem_waits' => {mib => 'myInnoDBSemWaits', order => 144, type => 'Counter64'},
167167
'innodb_sem_wait_time_ms' => {mib => 'myInnoDBSemWaitTime', order => 145, type => 'Counter64'},
168+
'key_buf_bytes_unflushed' => {mib => 'myKeyBufBytesUnflushed', order => 146, type => 'Gauge64'},
169+
'key_buf_bytes_used' => {mib => 'myKeyBufBytesUsed', order => 147, type => 'Gauge64'},
170+
'key_buffer_size' => {mib => 'myKeyBufferSize', order => 148, type => 'Gauge64'},
168171
},
169172
startoid => '.1.3.6.1.4.1.20267.200.1',
170173
}

0 commit comments

Comments
 (0)