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

Commit b328097

Browse files
author
Brice Figureau
committed
Initial import, for v0.6
0 parents  commit b328097

18 files changed

+3725
-0
lines changed

COPYING

+339
Large diffs are not rendered by default.

MYSQL-SERVER-MIB.txt

+935
Large diffs are not rendered by default.

Makefile

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# This program is free software: you can redistribute it and/or modify
2+
# it under the terms of the GNU General Public License as published by
3+
# the Free Software Foundation, either version 2 of the License, or
4+
# (at your option) any later version.
5+
#
6+
# This program is distributed in the hope that it will be useful,
7+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
8+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9+
# GNU General Public License for more details.
10+
#
11+
# You should have received a copy of the GNU General Public License
12+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
13+
14+
build:
15+
16+
install:
17+
install -m 755 mysql-agent.pl $(DESTDIR)/usr/sbin/mysql-agent
18+
install -m 644 MYSQL-SERVER-MIB.txt $(DESTDIR)/usr/share/snmp/mibs
19+
20+
clean:
21+
-rm $(DESTDIR)/usr/sbin/mysql-agent
22+

README

+217
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,217 @@
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+

debian/README.Debian

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
mysql-snmp for Debian
2+
---------------------
3+
4+
Snmp should allow AgentX.
5+
This can be done by adding:
6+
7+
master agentx
8+
9+
into /etc/snmp/snmpd.conf and reloading snmpd
10+
11+
-- brice <[email protected]> Thu, 17 Jul 2008 15:45:19 +0200

debian/changelog

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
mysql-snmp (0.6-1) unstable; urgency=low
2+
3+
* returns No Such OID in case of refresh issues (should prevent rrd spikes)
4+
5+
-- brice <[email protected]> Sat, 2 Aug 2008 15:58:44 +0200
6+
7+
mysql-snmp (0.5-1) unstable; urgency=low
8+
9+
* fixed myConnections type
10+
11+
-- brice <[email protected]> Tue, 22 Jul 2008 19:28:34 +0200
12+
13+
mysql-snmp (0.4-1) unstable; urgency=low
14+
15+
* installs mysql-snmp.default
16+
17+
-- brice <[email protected]> Sat, 19 Jul 2008 14:12:54 +0200
18+
19+
mysql-snmp (0.4) unstable; urgency=high
20+
21+
* new version compatible with net-snmp 5.4.1
22+
23+
-- brice <[email protected]> Sat, 19 Jul 2008 14:02:53 +0200
24+
25+
mysql-snmp (0.3) unstable; urgency=low
26+
27+
* init.d bugfixes
28+
29+
-- brice <[email protected]> Fri, 18 Jul 2008 16:13:32 +0200
30+
31+
mysql-snmp (0.2) unstable; urgency=low
32+
33+
* new release with better code
34+
35+
-- brice <[email protected]> Fri, 18 Jul 2008 15:49:53 +0200
36+
37+
mysql-snmp (0.1-1) unstable; urgency=low
38+
39+
* Initial release
40+
41+
-- brice <[email protected]> Thu, 17 Jul 2008 15:45:19 +0200
42+

debian/compat

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
5

debian/control

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Source: mysql-snmp
2+
Section: admin
3+
Priority: extra
4+
Maintainer: Brice Figureau <[email protected]>
5+
Build-Depends: debhelper (>= 5)
6+
Standards-Version: 3.7.2
7+
8+
Package: mysql-snmp
9+
Architecture: all
10+
Depends: ${perl:Depends}, snmpd, libsnmp-perl, libunix-syslog-perl, ${shlibs:Depends}, ${misc:Depends}
11+
Description: SNMP agent for mysql-server
12+
This package contains a SNMP agent/subagent to expose Mysql-server
13+
internal counters to SNMP.
14+

debian/copyright

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
This package was debianized by Brice Figureau <[email protected]> on
2+
Thu, 17 Jul 2008 15:45:19 +0200.
3+
4+
5+
Upstream Author: Brice Figureau
6+
7+
Copyright: (c) Copryright, Brice Figureau, 2008
8+
9+
License:
10+
GPL, version 2
11+
12+
The Debian packaging is (C) 2008, Brice Figureau <[email protected]> and
13+
is licensed under the GPL, see `/usr/share/common-licenses/GPL'.
14+
15+
16+

debian/dirs

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
etc/default
2+
etc/init.d
3+
usr/sbin
4+
usr/share/snmp/mibs

debian/docs

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
MYSQL-SERVER-MIB.txt
2+
README

0 commit comments

Comments
 (0)