Getting data from the Metric Insights database
This article explains how to get data from the Metric Insights (dashboard) database so that it can be used for reporting usage statistics.on your Metric Insights instance.
1. Use a MySQL user named 'mi_read'
We have a number of MySQL users already set up. You can find the credentials in the file named /etc/mi/insight.conf. You probably want the one named mi_read.
2. Logon as 'root' to configure bind address
We generally configure MySQL to listen for incoming traffic from localhost only. You'll need to open it up to all comers. (MySQL does not provide a halfway measure.)
You can do that by editing the file named /etc/mysql/conf.d/01_insight_settings.cnf and creating the following entry:
bind-address = 0.0.0.0
3. Adjust the permissions for 'mi_read' user
Launch mysql from command line, signing in with a mysql user who has root privileges. e.g., the 'root' user:
mysql -uroot -p
Within mysql, run these commands after replacing the <password> with the password for the mi_read user (you can get that from: /etc/mi/insight.conf) :
GRANT USAGE ON *.* TO 'mi_read'@'%' IDENTIFIED BY '<password>';
GRANT SELECT ON `dashboard`.* TO 'mi_read'@'%';
GRANT SELECT ON `dashboard\_report\_data\_segment\_%`.* TO 'mi_read'@'%';
Note: if you get the following error then you will need to launch mysql with user with correct privileges:
mysql> GRANT USAGE ON . TO 'mi_read'@'%' IDENTIFIED BY 'password123';
ERROR 1045 (28000): Access denied for user 'mi_setup'@'localhost' (using password: YES)
ERROR 1410 (42000): You are not allowed to create a user with GRANT