|
| 1 | +MySQL Server SNMP Agent. |
| 2 | +Copyright (c) 2008,2009 Brice Figureau < [email protected]> |
| 3 | + |
| 4 | +PREAMBLE |
| 5 | +======== |
| 6 | + |
| 7 | +Mysql-snmp is a MySQL Net-SNMP agent written in Perl, and using the Net-Snmp |
| 8 | +Perl bindings. |
| 9 | + |
| 10 | +It connects to a mysql server and returns information to Net-SNMP when needed. |
| 11 | +It parses SHOW INNODB STATUS and other MySQL status variables. |
| 12 | + |
| 13 | +This work is based on Baron Schwartz Mysql Cacti Templates, available at: |
| 14 | +http://code.google.com/p/mysql-cacti-templates/ |
| 15 | + |
| 16 | +This work is based on the blog post about a SNMP agent: |
| 17 | +http://mysqldump.azundris.com/archives/63-Sysadmins-Nightly-Mental-Pain-SNMP.html |
| 18 | + |
| 19 | +This software is released under the GPL v2. |
| 20 | + |
| 21 | + |
| 22 | +REQUIREMENTS |
| 23 | +============ |
| 24 | + |
| 25 | +This package requires Net-SNMP version 5.4.2 or better (because of some |
| 26 | +bugs in previous versions). |
| 27 | + |
| 28 | +INSTALL |
| 29 | +======= |
| 30 | + |
| 31 | +Debian |
| 32 | +------ |
| 33 | + |
| 34 | +Please build the package: |
| 35 | +$ dpkg-buildpackage -rfakeroot -uc- b |
| 36 | + |
| 37 | +and install it |
| 38 | +Then, modify /etc/default/mysql-agent |
| 39 | + |
| 40 | +Other |
| 41 | +----- |
| 42 | + |
| 43 | +Modify the Makefile, and: |
| 44 | +$ sudo make install |
| 45 | + |
| 46 | +Then create an init.d startup script. You can look to the debian one |
| 47 | +in debian/init.d |
| 48 | + |
| 49 | +Install the MIB file in your mibs directory. |
| 50 | + |
| 51 | +CONFIGURE |
| 52 | +========= |
| 53 | + |
| 54 | +Configure net-snmp |
| 55 | +------------------ |
| 56 | + |
| 57 | +Add: |
| 58 | +master agentx |
| 59 | +to /etc/snmp/snmpd.conf, and restart snmpd |
| 60 | + |
| 61 | +Configure mysql-snmp |
| 62 | +-------------------- |
| 63 | + |
| 64 | +Under debian, the daemon can be configured with /etc/default/mysql-snmp. |
| 65 | +On all platform, the configuration is done with command line arguments: |
| 66 | + |
| 67 | +-u DBUSER use DBUSER as user to connect to mysql |
| 68 | +-p DBPASS use DBPASS as password to connect to mysql |
| 69 | +-h|--host HOST connect to mysql HOST |
| 70 | +-P|--port PORT port to connect to (default 3306) |
| 71 | +-m|--master check master |
| 72 | +-s|--slave check slave |
| 73 | +--oid OID registering OID |
| 74 | +-i|--refresh refresh interval in seconds |
| 75 | + |
| 76 | + |
| 77 | +OPENNMS |
| 78 | +======= |
| 79 | + |
| 80 | +You'll find in the opennms directory the various configuration snippets |
| 81 | +that can be used to let opennms graph the value reported by this agent. |
| 82 | + |
| 83 | +datacollection-config.xml |
| 84 | +------------------------- |
| 85 | + |
| 86 | +Add this to the datacollection-config.xml file: |
| 87 | + |
| 88 | + <!-- MySQL-SERVER MIB --> |
| 89 | + <group name="mysql" ifType="ignore"> |
| 90 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.1" instance="0" alias="myKeyReadRequests" type="Counter32" /> |
| 91 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.2" instance="0" alias="myKeyReads" type="Counter32" /> |
| 92 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.3" instance="0" alias="myKeyWriteRequests" type="Counter32" /> |
| 93 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.4" instance="0" alias="myKeyWrites" type="Counter32" /> |
| 94 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.5" instance="0" alias="myHistoryList" type="Gauge32" /> |
| 95 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.6" instance="0" alias="myInnodbTransactins" type="Counter64" /> |
| 96 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.7" instance="0" alias="myReadViews" type="Gauge32" /> |
| 97 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.8" instance="0" alias="myCurrentTransactns" type="Gauge32" /> |
| 98 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.9" instance="0" alias="myLockedTransactins" type="Gauge32" /> |
| 99 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.10" instance="0" alias="myActiveTransactins" type="Gauge32" /> |
| 100 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.11" instance="0" alias="myPoolSize" type="Gauge32" /> |
| 101 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.12" instance="0" alias="myFreePages" type="Gauge32" /> |
| 102 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.13" instance="0" alias="myDatabasePages" type="Gauge32" /> |
| 103 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.14" instance="0" alias="myModifiedPages" type="Gauge32" /> |
| 104 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.15" instance="0" alias="myPagesRead" type="Counter32" /> |
| 105 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.16" instance="0" alias="myPagesCreated" type="Counter32" /> |
| 106 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.17" instance="0" alias="myPagesWritten" type="Counter32" /> |
| 107 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.18" instance="0" alias="myFileFsyncs" type="Counter32" /> |
| 108 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.19" instance="0" alias="myFileReads" type="Counter32" /> |
| 109 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.20" instance="0" alias="myFileWrites" type="Counter32" /> |
| 110 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.21" instance="0" alias="myLogWrites" type="Counter32" /> |
| 111 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.22" instance="0" alias="myPendingAIOLogIOs" type="Gauge32" /> |
| 112 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.23" instance="0" alias="myPendingAIOSyncIOs" type="Gauge32" /> |
| 113 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.24" instance="0" alias="myPendingBufPlFlshs" type="Gauge32" /> |
| 114 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.25" instance="0" alias="myPendingChkpWrites" type="Gauge32" /> |
| 115 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.26" instance="0" alias="myPendingIbufAIORds" type="Gauge32" /> |
| 116 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.27" instance="0" alias="myPendingLogFlushes" type="Gauge32" /> |
| 117 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.28" instance="0" alias="myPendingLogWrites" type="Gauge32" /> |
| 118 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.29" instance="0" alias="myPendingNrmlAIORds" type="Gauge32" /> |
| 119 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.30" instance="0" alias="myPendngNrmlAIOWrts" type="Gauge32" /> |
| 120 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.31" instance="0" alias="myIbufInserts" type="Counter32" /> |
| 121 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.32" instance="0" alias="myIbufMerged" type="Counter32" /> |
| 122 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.33" instance="0" alias="myIbufMerges" type="Counter32" /> |
| 123 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.34" instance="0" alias="mySpinWaits" type="Counter32" /> |
| 124 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.35" instance="0" alias="mySpinRounds" type="Counter32" /> |
| 125 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.36" instance="0" alias="myOsWaits" type="Counter32" /> |
| 126 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.37" instance="0" alias="myRowsInserted" type="Counter32" /> |
| 127 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.38" instance="0" alias="myRowsUpdated" type="Counter32" /> |
| 128 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.39" instance="0" alias="myRowsDeleted" type="Counter32" /> |
| 129 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.40" instance="0" alias="myRowsRead" type="Counter32" /> |
| 130 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.41" instance="0" alias="myTableLocksWaited" type="Counter32" /> |
| 131 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.42" instance="0" alias="myTableLocksImmedit" type="Counter32" /> |
| 132 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.43" instance="0" alias="mySlowQueries" type="Counter32" /> |
| 133 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.44" instance="0" alias="myOpenFiles" type="Gauge32" /> |
| 134 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.45" instance="0" alias="myOpenTables" type="Gauge32" /> |
| 135 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.46" instance="0" alias="myOpenedTables" type="Counter32" /> |
| 136 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.47" instance="0" alias="myInnodbOpenFiles" type="Counter32" /> |
| 137 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.48" instance="0" alias="myOpenFilesLimit" type="Counter32" /> |
| 138 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.49" instance="0" alias="myTableCache" type="Counter32" /> |
| 139 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.50" instance="0" alias="myAbortedClients" type="Counter32" /> |
| 140 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.51" instance="0" alias="myAbortedConnects" type="Counter32" /> |
| 141 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.52" instance="0" alias="myMaxUsedConnectins" type="Counter32" /> |
| 142 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.53" instance="0" alias="mySlowLaunchThreads" type="Counter32" /> |
| 143 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.54" instance="0" alias="myThreadsCached" type="Gauge32" /> |
| 144 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.55" instance="0" alias="myThreadsConnected" type="Gauge32" /> |
| 145 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.56" instance="0" alias="myThreadsCreated" type="Counter32" /> |
| 146 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.57" instance="0" alias="myThreadsRunning" type="Gauge32" /> |
| 147 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.58" instance="0" alias="myMaxConnections" type="Gauge32" /> |
| 148 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.59" instance="0" alias="myThreadCacheSize" type="Gauge32" /> |
| 149 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.60" instance="0" alias="myConnections" type="Counter32" /> |
| 150 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.61" instance="0" alias="mySlaveRunning" type="Gauge32" /> |
| 151 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.62" instance="0" alias="mySlaveStopped" type="Gauge32" /> |
| 152 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.63" instance="0" alias="mySlaveRtrdTrnsctns" type="Counter32" /> |
| 153 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.64" instance="0" alias="mySlaveLag" type="Gauge32" /> |
| 154 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.65" instance="0" alias="mySlaveOpenTempTbls" type="Gauge32" /> |
| 155 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.66" instance="0" alias="myQcacheFreeBlocks" type="Gauge32" /> |
| 156 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.67" instance="0" alias="myQcacheFreeMemory" type="Gauge32" /> |
| 157 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.68" instance="0" alias="myQcacheHits" type="Counter32" /> |
| 158 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.69" instance="0" alias="myQcacheInserts" type="Counter32" /> |
| 159 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.70" instance="0" alias="myQcacheLowmemPruns" type="Counter32" /> |
| 160 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.71" instance="0" alias="myQcacheNotCached" type="Counter32" /> |
| 161 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.72" instance="0" alias="myQcacheQuerisInCch" type="Gauge32" /> |
| 162 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.73" instance="0" alias="myQcacheTotalBlocks" type="Gauge32" /> |
| 163 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.74" instance="0" alias="myQueryCacheSize" type="Counter32" /> |
| 164 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.75" instance="0" alias="myQuestions" type="Counter32" /> |
| 165 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.76" instance="0" alias="myComUpdate" type="Counter32" /> |
| 166 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.77" instance="0" alias="myComInsert" type="Counter32" /> |
| 167 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.78" instance="0" alias="myComSelect" type="Counter32" /> |
| 168 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.79" instance="0" alias="myComDelete" type="Counter32" /> |
| 169 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.80" instance="0" alias="myComReplace" type="Counter32" /> |
| 170 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.81" instance="0" alias="myComLoad" type="Counter32" /> |
| 171 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.82" instance="0" alias="myComUpdateMulti" type="Counter32" /> |
| 172 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.83" instance="0" alias="myComInsertSelect" type="Counter32" /> |
| 173 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.84" instance="0" alias="myComDeleteMulti" type="Counter32" /> |
| 174 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.85" instance="0" alias="myComReplaceSelect" type="Counter32" /> |
| 175 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.86" instance="0" alias="mySelectFullJoin" type="Counter32" /> |
| 176 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.87" instance="0" alias="mySelectFullRangeJn" type="Counter32" /> |
| 177 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.88" instance="0" alias="mySelectRange" type="Counter32" /> |
| 178 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.89" instance="0" alias="mySelectRangeCheck" type="Counter32" /> |
| 179 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.90" instance="0" alias="mySelectScan" type="Counter32" /> |
| 180 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.91" instance="0" alias="mySortMergePasses" type="Counter32" /> |
| 181 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.92" instance="0" alias="mySortRange" type="Counter32" /> |
| 182 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.93" instance="0" alias="mySortRows" type="Counter32" /> |
| 183 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.94" instance="0" alias="mySortScan" type="Counter32" /> |
| 184 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.95" instance="0" alias="myCreatedTmpTables" type="Counter32" /> |
| 185 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.96" instance="0" alias="myCreatedTmpDskTbls" type="Counter32" /> |
| 186 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.97" instance="0" alias="myCreatedTmpFiles" type="Counter32" /> |
| 187 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.98" instance="0" alias="myBytesSent" type="Counter32" /> |
| 188 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.99" instance="0" alias="myBytesReceived" type="Counter32" /> |
| 189 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.100" instance="0" alias="myInnodbLogBufferSz" type="Gauge32" /> |
| 190 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.101" instance="0" alias="myUnflushedLog" type="Gauge32" /> |
| 191 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.102" instance="0" alias="myLogBytesFlushed" type="Counter64" /> |
| 192 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.103" instance="0" alias="myLogBytesWritten" type="Counter64" /> |
| 193 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.104" instance="0" alias="myRelayLogSpace" type="Counter32" /> |
| 194 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.105" instance="0" alias="myBinlogCacheSize" type="Gauge32" /> |
| 195 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.106" instance="0" alias="myBinlogCacheDiskUs" type="Counter32" /> |
| 196 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.107" instance="0" alias="myBinlogCacheUse" type="Counter32" /> |
| 197 | + <mibObj oid=".1.3.6.1.4.1.20267.200.1.108" instance="0" alias="myBinaryLogSpace" type="Counter32" /> |
| 198 | + </group> |
| 199 | + |
| 200 | +Then add this group to your hosts: |
| 201 | +<systemDef name="Net-Snmp"> |
| 202 | + <sysoidMask>.1.3.6.1.4.1.8072.3.</sysoidMask> |
| 203 | + <collect> |
| 204 | + <includeGroup>mib2-host-resources-system</includeGroup> |
| 205 | + <includeGroup>mib2-host-resources-memory</includeGroup> |
| 206 | + <includeGroup>net-snmp-disk</includeGroup> |
| 207 | + <includeGroup>ucd-loadavg</includeGroup> |
| 208 | + <includeGroup>ucd-memory</includeGroup> |
| 209 | + <includeGroup>ucd-sysstat</includeGroup> |
| 210 | + <includeGroup>mysql</includeGroup> |
| 211 | + </collect> |
| 212 | +</systemDef> |
| 213 | + |
| 214 | +And now, add the graph definitions from the mysql.snmp-graph.properties file |
| 215 | +to your snmp-graph.properties. |
| 216 | + |
| 217 | + |
0 commit comments