munin-mysql icon indicating copy to clipboard operation
munin-mysql copied to clipboard

Feature request (with patch) - Support for Amazon RDS instances

Open sfrazer opened this issue 14 years ago • 6 comments

Monitoring Amazon RDS instances with Munin and your plugin poses 2 issues:

  1. you don't get SUPER or REPLICATION CLIENT privileges in RDS
  2. you can't run munin-client on the RDS instance

I've created a patch for your excellent munin plugin that overcomes both of these limitations. It uses the creation of 2 new environment variables:

mysqlhostname - used ONLY for the config "hostname example.com" output, this doesn't obviate the requirement to put a hostname in the dsn string. This allows whatever node is running this client to present separate nodes to the Munin server. There's probably a better way to do this (one that allows a single workstation to monitor multiple RDS instances) but this was the quickest way to achieve a single RDS instance.

mysqlaws - a yes or no value that defaults to no. If set to yes, the update_master and update_slave subroutines are short-circuited.

Here's the diff against the latest version:

https://gist.github.com/825490

sfrazer avatar Feb 14 '11 04:02 sfrazer

Thanks for sharing. Don't know when I might have time to look at it tough :-/

kjellm avatar May 10 '11 13:05 kjellm

I second this issue. I get plenty of

 DBD::mysql::st execute failed: Access denied; you need (at least one of) the SUPER,REPLICATION CLIENT privilege(s) for this operation at /etc/munin/plugins/mysql_network_traffic line 980.

in my munin-node.log. I did some tests with the mysql console client and it seems that the SQL like SHOW GLOBAL STATUS runs just fine, even without SUPER permission. As i'm no Perl expert i couldn't figure out, why the SUPER permission is neccessary.

Unfortunately the patch from @sfrazer does not apply to my the plugin version i have on Ubuntu 12.04.

Any chance that we see this resolved? Or is there another workaround?

mikehaertl avatar Apr 04 '13 12:04 mikehaertl

The SUPER permission is not a perl thing, but a MySQL thing. It is needed for the SHOW MASTER LOGS and SHOW SLAVE STATUS queries. You can try to apply the patch below as a workaround.

diff --git a/mysql b/mysql
index 2a728d2..2cede56 100755
--- a/mysql
+++ b/mysql
@@ -362,8 +362,8 @@ sub collect_data {

     update_variables($dbh);
     update_innodb($dbh);
-    update_master($dbh);
-    update_slave($dbh);
+    #update_master($dbh);
+    #update_slave($dbh);
     update_process_list($dbh);
 }

kjellm avatar Apr 05 '13 13:04 kjellm

That works, thanks!

mikehaertl avatar Apr 05 '13 14:04 mikehaertl

the restriction on replication client may have been relaxed: http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/MySQL.Procedural.Importing.External.Repl.html

grooverdan avatar May 05 '15 10:05 grooverdan

I added the following in munin-monitoring/munin/pull/386 https://github.com/munin-monitoring/munin/commit/2d0d9f7b9742ea7f513eb005b8d609e98ceadfea https://github.com/munin-monitoring/munin/commit/e2452e5a0994edb971bea907304c31cd25243a3f https://github.com/munin-monitoring/munin/commit/740deabc7a1c37613c8c6d89450ab34177115209

Less privs than super are required for show master status/show slave status. Could be worth adding to mysql.conf

10.0.21-MariaDB-1~jessie-log
MariaDB [(none)]> show grants;
+--------------------------------------------------------------------------------------------+
| Grants for munin@localhost                                                                 |
+--------------------------------------------------------------------------------------------+                                                       
| GRANT PROCESS, REPLICATION CLIENT ON *.* TO 'munin'@'localhost' IDENTIFIED VIA unix_socket |                                                       
+--------------------------------------------------------------------------------------------+                                                       
1 rows in set (0.00 sec)                                                                                                                             
MariaDB [(none)]> show master status;
+--------------------+----------+--------------+------------------+
| File               | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+--------------------+----------+--------------+------------------+
| mariadb-bin.011145 | 46251284 |              |                  |
+--------------------+----------+--------------+------------------+
1 row in set (0.00 sec)
MariaDB [(none)]> show slave status\G
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: 192.168.149.5
                  Master_User: replica
                  Master_Port: 3306

grooverdan avatar Aug 26 '15 22:08 grooverdan