Skip to content

dmenache/mysql-snmp

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MySQL Server SNMP Agent.
Copyright (c) 2008,2009 Brice Figureau <brice.figureau@daysofwonder.com>

PREAMBLE
========

mysql-agent is a MySQL Net-SNMP agent written in Perl, and using the Net-Snmp 
Perl bindings.

It connects to a mysql server and returns information to Net-SNMP when needed.
It parses SHOW INNODB STATUS and other MySQL status variables.

This work is based on Baron Schwartz Mysql Cacti Templates, available at:
http://code.google.com/p/mysql-cacti-templates/

This work is based on the blog post about a SNMP agent:
http://mysqldump.azundris.com/archives/63-Sysadmins-Nightly-Mental-Pain-SNMP.html

This software is released under the GPL v2.


REQUIREMENTS
============

This package requires Net-SNMP version 5.4.2 or better.

It also to be noted that the patches I provided that was included in 5.4.2 wasn't
completely applied, thus counter64 exported from a perl subagent are broken.

It means that for the moment the only way to have correct 64 bits mib objects is 
to apply the following patch to net-snmp:
http://sourceforge.net/tracker/?func=detail&aid=2890931&group_id=12694&atid=312694

Note: this patch is now included upstream, but not yet available in a tarball version.

INSTALL
=======

Debian
------

Please build the package:
$ dpkg-buildpackage -rfakeroot -uc- b

and install it
Then, modify /etc/default/mysql-agent

Other
-----

Modify the Makefile, and:
$ sudo make install

Then create an init.d startup script. You can look to the debian one
in debian/init.d

Install the MIB file in your mibs directory.

CONFIGURE
=========

Configure net-snmp
------------------

Add:
master agentx
to /etc/snmp/snmpd.conf, and restart snmpd

Configure mysql-snmp
--------------------

Under debian, the daemon can be configured with /etc/default/mysql-snmp.
On all platform, the configuration is done with command line arguments:

-h|--host HOST          connect to mysql HOST
-P|--port PORT          port to connect to (default 3306)
-u|--user DBUSER        use DBUSER as user to connect to mysql
-p|--passwordi DBPASS   use DBPASS as password to connect to mysql
-c|--config FILE        read MySQL configuration from FILE

-m|--master             check master
-s|--slave              check slave
-b|--heartbeat DB.TABLE table for maatkit mk-heartbeat 
--oid OID               registering OID
-i|--refresh            refresh interval in seconds

You can specify the mysql connection parameters in a config file using my.cnf format, like this:
For example:

[client]
host=dbserver
port=3306
user=monitor
password=secret


OPENNMS
=======

You'll find in the opennms directory the various configuration snippets
that can be used to let opennms graph the value reported by this agent.

datacollection-config.xml
-------------------------

Add the content of opennms/mysql.datacollection-config.xml

Then add this group to your hosts:
<systemDef name="Net-Snmp">
  <sysoidMask>.1.3.6.1.4.1.8072.3.</sysoidMask>
  <collect>
    <includeGroup>mib2-host-resources-system</includeGroup>
    <includeGroup>mib2-host-resources-memory</includeGroup>
    <includeGroup>net-snmp-disk</includeGroup>
    <includeGroup>ucd-loadavg</includeGroup>
    <includeGroup>ucd-memory</includeGroup>
    <includeGroup>ucd-sysstat</includeGroup>
    <includeGroup>mysql</includeGroup>
  </collect>
</systemDef>

And now, add the graph definitions from the opennms/mysql.snmp-graph.properties file 
to your snmp-graph.properties.

Packages

No packages published

Languages

  • Perl 100.0%