I have to check the size of a database. No problem, I thought, will use
check_mysql_health and it will do its job. But: no way – my database forces connections via SSL, and
check_mysql_health does not seem to like that.
So what I did:
- RTFM. But there are no options for this use case
- Worked with a
.cnf, looks like this:
[client] ssl-ca = mycafile.pem ssl-mode = 'VERIFY_CA' [groupName] host = myhostname port = 3306
As soon as I use a file, it seems I cannot longer user
--hostname, and it always will connect to
localhost; that’s why I have this
groupName section in my config file. I got this idea from NagiosExchange where klaypigeon struggled similar to me. But she/he was able to solve it that way, while I’m not.
This is what I execute:
./check_mysql_health \ --hostname myhostname \ --username myusername \ --password mypassword \ --database mydatabase \ --mode connection-time \ --environment NAGIOS__SERVICEMYSQL_MYCNF='test.cnf' \ --environment NAGIOS__SERVICEMYSQL_MYCNFGROUP='groupName'
Using 2.5.5-stable (seems to ignore most of my settings):
DBI connect('database=mydatabase;mysql_read_default_file=test.cnf;mysql_read_default_group=groupName','myusername',...) failed: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) at ./check_mysql_health line 1963. CRITICAL - cannot connect to mydatabase. Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
Using 220.127.116.11-beta (ignores less, but doesn’t work either)
CRITICAL - DBI connect('database=mydatabase;host=myhostname;port=3306','myusername',...) failed: SSL connection is required. Please specify SSL options and retry. at ./check_mysql_health line 4290.
SSL secured database connections are nothing strange, are they? I’m not in love with this script in special, so if you have any suggestions to make it work: please let me know.