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

Commit 12dbe36

Browse files
author
Brice Figureau
committed
Add two new graphs: innodb_sem_waits and innodb_sem_waits_time
Which respectively show the number of times innodb waited on a semaphore and the cumulated time.
1 parent 3e28cb3 commit 12dbe36

File tree

6 files changed

+75
-5
lines changed

6 files changed

+75
-5
lines changed

MYSQL-SERVER-MIB.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,4 +1220,21 @@ myThreadHashMemory OBJECT-TYPE
12201220
"InnoDB thread hash memory used"
12211221
::= { myStatus 143 }
12221222

1223+
myInnoDBSemWaits OBJECT-TYPE
1224+
SYNTAX Counter64
1225+
MAX-ACCESS read-only
1226+
STATUS current
1227+
DESCRIPTION
1228+
"Number of time innodb waited for semaphores"
1229+
::= { myStatus 144 }
1230+
1231+
myInooDBSemWaitTime OBJECT-TYPE
1232+
SYNTAX Counter64
1233+
MAX-ACCESS read-only
1234+
STATUS current
1235+
DESCRIPTION
1236+
"Total time innodb waited for semaphores"
1237+
::= { myStatus 145 }
1238+
1239+
12231240
END

mysql-snmp

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,9 @@ sub parse_innodb_status {
107107
'file_system_memory' => 0,
108108
'lock_system_memory' => 0,
109109
'recovery_system_memory' => 0,
110-
'thread_hash_memory' => 0
110+
'thread_hash_memory' => 0,
111+
'innodb_sem_waits' => 0,
112+
'innodb_sem_wait_time_ms' => 0
111113
);
112114
my $flushed_to;
113115
my $innodb_lsn;
@@ -133,6 +135,12 @@ sub parse_innodb_status {
133135
push(@os_waits, $self->tonum($row[5]));
134136
push(@os_waits, $self->tonum($row[11]));
135137
}
138+
elsif ($line =~ /seconds the semaphore:/) {
139+
# --Thread 907205 has waited at handler/ha_innodb.cc line 7156 for 1.00 seconds the semaphore:
140+
$status{'innodb_sem_waits'} += 1;
141+
$status{'innodb_sem_wait_time_ms'} += $self->tonum($row[9]) * 1000;
142+
}
143+
136144
# TRANSACTIONS
137145
elsif ($line =~ m/Trx id counter/) {
138146
# The beginning of the TRANSACTIONS section: start counting
@@ -465,7 +473,8 @@ my @types = (
465473
'Gauge32', 'Gauge32', 'Gauge32', 'Gauge32', # 129 - 132
466474
'Gauge32', 'Gauge32', 'Gauge32', 'Gauge32', # 133 - 136
467475
'Counter64', 'Counter64', 'Counter64', 'Counter64', # 137 - 140
468-
'Counter64', 'Counter64', 'Counter64', # 141 - 143
476+
'Counter64', 'Counter64', 'Counter64', 'Counter64', # 141 - 144
477+
'Counter64', # 145 - 145
469478
);
470479

471480
my @newkeys = (
@@ -540,7 +549,8 @@ my @newkeys = (
540549
'myAdaptiveHashMemory', 'myPageHashMemory', # 137 - 138
541550
'myDictionaryCacheMemory', 'myFileSystemMemory', # 139 - 140
542551
'myLockSystemMemory', 'myRecoverySystemMemory', # 141 - 142
543-
'myThreadHashMemory', # 143 - 143
552+
'myThreadHashMemory', 'myInnoDBSemWaits', # 143 - 144
553+
'myInnoDBSemWaitTime', # 145 - 145
544554
);
545555

546556
my @oldkeys = (
@@ -615,7 +625,8 @@ my @oldkeys = (
615625
'adaptive_hash_memory', 'page_hash_memory', # 137 - 138
616626
'dictionary_cache_memory', 'file_system_memory', # 139 - 140
617627
'lock_system_memory', 'recovery_system_memory', # 141 - 142
618-
'thread_hash_memory', # 143 - 143
628+
'thread_hash_memory', 'innodb_sem_waits', # 143 - 144
629+
'innodb_sem_wait_time_ms', # 145 - 145
619630
);
620631

621632
run() unless caller();

opennms/mysql.datacollection-config.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@
148148
<mibObj oid=".1.3.6.1.4.1.20267.200.1.141" instance="0" alias="myLockSystemMemory" type="Gauge64" />
149149
<mibObj oid=".1.3.6.1.4.1.20267.200.1.142" instance="0" alias="myRecoverySystmMmry" type="Gauge64" />
150150
<mibObj oid=".1.3.6.1.4.1.20267.200.1.143" instance="0" alias="myThreadHashMemory" type="Gauge64" />
151+
<mibObj oid=".1.3.6.1.4.1.20267.200.1.144" instance="0" alias="myInnoDBSemWaits" type="Counter64" />
152+
<mibObj oid=".1.3.6.1.4.1.20267.200.1.145" instance="0" alias="myInnoDBSemWaitTime" type="Counter64" />
151153
</group>
152154

153155
<systemDef name="Net-Snmp">

opennms/mysql.snmp-graph.properties

Lines changed: 29 additions & 1 deletion
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.innodbbufferpool, mysql.mysqltablelocks, 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.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
@@ -1029,3 +1029,31 @@ report.mysql.mysqlprocesslist.command=--title "MySQL Processlist" \
10291029
GPRINT:myStateOther:MIN:"Min \\: %8.2lf %s" \
10301030
GPRINT:myStateOther:MAX:"Max \\: %8.2lf %s\\n"
10311031

1032+
report.mysql.innodbsemaphorewaits.name=InnoDB Semaphore Waits
1033+
report.mysql.innodbsemaphorewaits.columns=myInnoDBSemWaits
1034+
report.mysql.innodbsemaphorewaits.type=nodeSnmp
1035+
report.mysql.innodbsemaphorewaits.width=565
1036+
report.mysql.innodbsemaphorewaits.height=200
1037+
report.mysql.innodbsemaphorewaits.command=--title "InnoDB Semaphore Waits" \
1038+
--width 565 \
1039+
--height 200 \
1040+
DEF:myInnoDBSemWaits={rrd1}:myInnoDBSemWaits:AVERAGE \
1041+
AREA:myInnoDBSemWaits#7020AF:"Innodb Sem Waits" \
1042+
GPRINT:myInnoDBSemWaits:AVERAGE:"Avg \\: %8.2lf %s" \
1043+
GPRINT:myInnoDBSemWaits:MIN:"Min \\: %8.2lf %s" \
1044+
GPRINT:myInnoDBSemWaits:MAX:"Max \\: %8.2lf %s\\n"
1045+
1046+
1047+
report.mysql.innodbsemaphorewaittime.name=InnoDB Semaphore Wait Time
1048+
report.mysql.innodbsemaphorewaittime.columns=myInnoDBSemWaitTime
1049+
report.mysql.innodbsemaphorewaittime.type=nodeSnmp
1050+
report.mysql.innodbsemaphorewaittime.width=565
1051+
report.mysql.innodbsemaphorewaittime.height=200
1052+
report.mysql.innodbsemaphorewaittime.command=--title "InnoDB Semaphore Wait Time" \
1053+
--width 565 \
1054+
--height 200 \
1055+
DEF:myInnoDBSemWaitTime={rrd1}:myInnoDBSemWaitTime:AVERAGE \
1056+
AREA:myInnoDBSemWaitTime#708226:"Innodb Sem Wait Time Ms" \
1057+
GPRINT:myInnoDBSemWaitTime:AVERAGE:"Avg \\: %8.2lf %s" \
1058+
GPRINT:myInnoDBSemWaitTime:MIN:"Min \\: %8.2lf %s" \
1059+
GPRINT:myInnoDBSemWaitTime:MAX:"Max \\: %8.2lf %s\\n"

opennms/tools/cacti2MIB.pl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@
163163
'lock_system_memory' => {mib => 'myLockSystemMemory', order => 141, type => 'Gauge64'},
164164
'recovery_system_memory' => {mib => 'myRecoverySystemMemory', order => 142, type => 'Gauge64'},
165165
'thread_hash_memory' => {mib => 'myThreadHashMemory', order => 143, type => 'Gauge64'},
166+
'innodb_sem_waits' => {mib => 'myInnoDBSemWaits', order => 144, type => 'Counter64'},
167+
'innodb_sem_wait_time_ms' => {mib => 'myInnoDBSemWaitTime', order => 145, type => 'Counter64'},
166168
},
167169
startoid => '.1.3.6.1.4.1.20267.200.1',
168170
}

tests/test.pl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ sub readfile
124124
'innodb_lock_wait_secs' => '0',
125125
'innodb_lock_structs' => '0',
126126
'innodb_tables_in_use' => '0',
127+
'innodb_sem_waits' => '0',
128+
'innodb_sem_wait_time_ms' => '0',
127129
},
128130
'tests/data/innodb_out_001.txt'
129131
);
@@ -193,6 +195,8 @@ sub readfile
193195
'innodb_locked_tables' => '0',
194196
'innodb_lock_wait_secs' => '0',
195197
'innodb_tables_in_use' => '0',
198+
'innodb_sem_waits' => '0',
199+
'innodb_sem_wait_time_ms' => '0',
196200
},
197201
'tests/data/xtradb_01.txt'
198202
);
@@ -264,6 +268,8 @@ sub readfile
264268
'innodb_lock_wait_secs' => '0',
265269
'innodb_lock_structs' => '0',
266270
'innodb_tables_in_use' => '0',
271+
'innodb_sem_waits' => '0',
272+
'innodb_sem_wait_time_ms' => '0',
267273
},
268274
'tests/data/5.0.txt'
269275
);
@@ -333,6 +339,8 @@ sub readfile
333339
'adaptive_hash_memory' => '0',
334340
'page_hash_memory' => '0',
335341
'dictionary_cache_memory' => '0',
342+
'innodb_sem_waits' => '0',
343+
'innodb_sem_wait_time_ms' => '0',
336344
},
337345
'tests/data/lock.txt'
338346
);
@@ -403,6 +411,8 @@ sub readfile
403411
'innodb_lock_wait_secs' => '0',
404412
'innodb_lock_structs' => '0',
405413
'innodb_tables_in_use' => '0',
414+
'innodb_sem_waits' => '0',
415+
'innodb_sem_wait_time_ms' => '0',
406416
},
407417
'tests/data/issue5.txt'
408418
);

0 commit comments

Comments
 (0)