Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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.
  • Loading branch information...
commit 12dbe36302e60b5179f5806910eee1833726fe21 1 parent 3e28cb3
Brice Figureau authored August 14, 2011
17  MYSQL-SERVER-MIB.txt
@@ -1220,4 +1220,21 @@ myThreadHashMemory OBJECT-TYPE
1220 1220
     "InnoDB thread hash memory used"
1221 1221
     ::= { myStatus 143 }
1222 1222
 
  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
+
1223 1240
 END
19  mysql-snmp
@@ -107,7 +107,9 @@ sub parse_innodb_status {
107 107
         'file_system_memory'        => 0,
108 108
         'lock_system_memory'        => 0,
109 109
         '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
111 113
     );
112 114
     my $flushed_to;
113 115
     my $innodb_lsn;
@@ -133,6 +135,12 @@ sub parse_innodb_status {
133 135
             push(@os_waits,   $self->tonum($row[5]));
134 136
             push(@os_waits,   $self->tonum($row[11]));
135 137
         }
  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
+
136 144
         # TRANSACTIONS
137 145
         elsif ($line =~ m/Trx id counter/) {
138 146
             # The beginning of the TRANSACTIONS section: start counting
@@ -465,7 +473,8 @@ my @types = (
465 473
     'Gauge32',   'Gauge32',   'Gauge32',   'Gauge32',      # 129 - 132
466 474
     'Gauge32',   'Gauge32',   'Gauge32',   'Gauge32',      # 133 - 136
467 475
     'Counter64', 'Counter64', 'Counter64', 'Counter64',    # 137 - 140
468  
-    'Counter64', 'Counter64', 'Counter64',                 # 141 - 143
  476
+    'Counter64', 'Counter64', 'Counter64', 'Counter64',    # 141 - 144
  477
+    'Counter64',                                           # 145 - 145
469 478
 );
470 479
 
471 480
 my @newkeys = (
@@ -540,7 +549,8 @@ my @newkeys = (
540 549
     'myAdaptiveHashMemory',       'myPageHashMemory',            # 137 - 138
541 550
     'myDictionaryCacheMemory',    'myFileSystemMemory',          # 139 - 140
542 551
     'myLockSystemMemory',         'myRecoverySystemMemory',      # 141 - 142
543  
-    'myThreadHashMemory',                                        # 143 - 143
  552
+    'myThreadHashMemory',         'myInnoDBSemWaits',            # 143 - 144
  553
+    'myInnoDBSemWaitTime',                                       # 145 - 145
544 554
 );
545 555
 
546 556
 my @oldkeys = (
@@ -615,7 +625,8 @@ my @oldkeys = (
615 625
     'adaptive_hash_memory',       'page_hash_memory',              # 137 - 138
616 626
     'dictionary_cache_memory',    'file_system_memory',            # 139 - 140
617 627
     '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
619 630
 );
620 631
 
621 632
 run() unless caller();
2  opennms/mysql.datacollection-config.xml
@@ -148,6 +148,8 @@
148 148
   <mibObj oid=".1.3.6.1.4.1.20267.200.1.141" instance="0" alias="myLockSystemMemory" type="Gauge64" />
149 149
   <mibObj oid=".1.3.6.1.4.1.20267.200.1.142" instance="0" alias="myRecoverySystmMmry" type="Gauge64" />
150 150
   <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" />
151 153
 </group>
152 154
 
153 155
 <systemDef name="Net-Snmp">
30  opennms/mysql.snmp-graph.properties
... ...
@@ -1,5 +1,5 @@
1 1
 # 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
3 3
 
4 4
 # paste this at the end of snmp-graph.properties file
5 5
 report.mysql.myisamindexes.name=MyISAM Indexes
@@ -1029,3 +1029,31 @@ report.mysql.mysqlprocesslist.command=--title "MySQL Processlist" \
1029 1029
  GPRINT:myStateOther:MIN:"Min \\: %8.2lf %s" \
1030 1030
  GPRINT:myStateOther:MAX:"Max \\: %8.2lf %s\\n"
1031 1031
 
  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"
2  opennms/tools/cacti2MIB.pl
@@ -163,6 +163,8 @@
163 163
         'lock_system_memory'        => {mib => 'myLockSystemMemory',            order => 141, type => 'Gauge64'},
164 164
         'recovery_system_memory'    => {mib => 'myRecoverySystemMemory',        order => 142, type => 'Gauge64'},
165 165
         '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'},
166 168
     },
167 169
     startoid => '.1.3.6.1.4.1.20267.200.1',
168 170
 }
10  tests/test.pl
@@ -124,6 +124,8 @@ sub readfile
124 124
        'innodb_lock_wait_secs'     => '0',
125 125
        'innodb_lock_structs'       => '0',
126 126
        'innodb_tables_in_use'      => '0',
  127
+       'innodb_sem_waits'          => '0',
  128
+       'innodb_sem_wait_time_ms'   => '0',
127 129
    },
128 130
    'tests/data/innodb_out_001.txt'
129 131
 );
@@ -193,6 +195,8 @@ sub readfile
193 195
        'innodb_locked_tables'      => '0',
194 196
        'innodb_lock_wait_secs'     => '0',
195 197
        'innodb_tables_in_use'      => '0',
  198
+       'innodb_sem_waits'          => '0',
  199
+       'innodb_sem_wait_time_ms'   => '0',
196 200
    },
197 201
    'tests/data/xtradb_01.txt'
198 202
 );
@@ -264,6 +268,8 @@ sub readfile
264 268
        'innodb_lock_wait_secs'     => '0',
265 269
        'innodb_lock_structs'       => '0',
266 270
        'innodb_tables_in_use'      => '0',
  271
+       'innodb_sem_waits'          => '0',
  272
+       'innodb_sem_wait_time_ms'   => '0',
267 273
    },
268 274
    'tests/data/5.0.txt'
269 275
 );
@@ -333,6 +339,8 @@ sub readfile
333 339
        'adaptive_hash_memory'      => '0',
334 340
        'page_hash_memory'          => '0',
335 341
        'dictionary_cache_memory'   => '0',
  342
+       'innodb_sem_waits'          => '0',
  343
+       'innodb_sem_wait_time_ms'   => '0',
336 344
    },
337 345
    'tests/data/lock.txt'
338 346
 );
@@ -403,6 +411,8 @@ sub readfile
403 411
        'innodb_lock_wait_secs'     => '0',
404 412
        'innodb_lock_structs'       => '0',
405 413
        'innodb_tables_in_use'      => '0',
  414
+       'innodb_sem_waits'          => '0',
  415
+       'innodb_sem_wait_time_ms'   => '0',
406 416
    },
407 417
    'tests/data/issue5.txt'
408 418
 );

0 notes on commit 12dbe36

Please sign in to comment.
Something went wrong with that request. Please try again.