I finally gave up and went to debug this one myself.
Based on @SelivanovPavel's answer I turned up debugging on
zencommand and waited, and sure enough, the ZenPack was failing.
2012-08-16 18:16:14,092 INFO zen.zencommand: Datasource MySQL/mysql command: /opt/zenoss/ZenPacks/ZenPacks.zenoss.MySqlMonitor-2.2.0-py2.7.egg/ZenPacks/zenoss/MySqlMonitor/libexec/check_mysql_stats.py -H 2001:db8:81:2c::2 -p 3306 -u zenoss -w 'password' -g
2012-08-16 18:16:14,100 DEBUG zen.zencommand: Running /opt/zenoss/ZenPacks/ZenPacks.zenoss.MySqlMonitor-2.2.0-py2.7.egg/ZenPacks/zenoss/MySqlMonitor/libexec/check_mysql_stats.py
2012-08-16 18:16:14,544 DEBUG zen.zencommand: Datasource: mysql Received exit code: 1 Output: 'MySQL Error: (2003, "Can\'t connect to MySQL server on \'2001:db8:81:2c::2\' (-9)")\n'
2012-08-16 18:16:14,545 DEBUG zen.zencommand: Process MySQL/mysql stopped (1), 0.43 seconds elapsed
So I dug into the ZenPack and found out it was importing (an apparently old version of)
On testing from the python command line I discovered where the exception was being thrown from:
>>> sys.path.insert(0, "/opt/zenoss/lib/python");
>>> import pymysql
>>> import MySQLdb
>>> self.conn = MySQLdb.connect(host="2001:db8:81:2c::2", port=3306, db='', user='zenoss', passwd='password')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/zenoss/lib/python/pymysql/__init__.py", line 93, in Connect
return Connection(*args, **kwargs)
File "/opt/zenoss/lib/python/pymysql/connections.py", line 504, in __init__
File "/opt/zenoss/lib/python/pymysql/connections.py", line 673, in _connect
raise OperationalError(2003, "Can't connect to MySQL server on %r (%s)" % (self.host, e.args))
pymysql.err.OperationalError: (2003, "Can't connect to MySQL server on '2001:db8:81:2c::2' (-9)")
And on inspecting
connections.py in that general vicinity I discovered to my horror that it was attempting to open an
AF_INET socket, and there was no code anywhere to open an
AF_INET6 socket. Boom, instant fail.
The current version of
pymysql also seems to contain this deficiency; no IPv6 support whatsoever.
So the "answer" is I'm going to have to fix
pymysql. Not how I wanted to spend my afternoon.
This bit of nasty hackery gets things working (though you need Python 2.6). Open up
/opt/zenoss/lib/python/pymysql/connections.py and search for
AF_INET around line 660. Then make the following change:
if DEBUG: print 'connected using unix_socket'
- sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- t = sock.gettimeout()
- sock.connect((self.host, self.port))
+ sock = socket.create_connection((self.host, self.port), self.connect_timeout)
self.host_info = "socket %s:%d" % (self.host, self.port)
if DEBUG: print 'connected using socket'
This has since been fixed in upstream pymysql and should be available in a future release.