INFO
ITRS does not officially support the below instructions but provides them as is.
In OP5 Monitor version 7.2.6, Sharable Dashboards were introduced. There is also a how-to guide that features a Python script to clone multiple dashboards to another user.
This how-to guide, however, goes more involved in what happens when you copy a dashboard from one user to another. We include here some extended features that also delete the target user's dashboard.
Step-by-step guide
Preconditions
- Start with a preconfigured dashboard that will be propagated to users;
- You need to remove the existing dashboard for the user before copying the new one. This must be done after the upgrade to 7.2.6, since the database layout has changed;
- Make sure that none of the users to whom you will be propagating the dashboards are logged in;
- Have a look at the database for dashboards:
dash-copy.sql
# mysql merlin mysql> select * from dashboards; This will give you a long list of usernames with corresponding dashboards: +----+-----------------------------------+--------------+--------+ | id | name | username | layout | +----+-----------------------------------+--------------+--------+ | 1 | Dashboard for <user> | <user> | 1,3,2 | | 2 | Dashboard for reports | reports | 3,2,1 | | 3 | Dashboard for readonly | readonly | 3,2,1 | [..]
Steps
-
Save this information to a text file for later use.
ID-Column
Notice the column 'id', this is very important to have to be able to delete the user's dashboard from two tables: 'dashboards' and 'dashboard_widgets'.
-
To remove the current dashboard for the user 'readonly', execute the following:
removing after copyingmysql> DELETE FROM dashboard_widgets WHERE dashboard_id = '3'; mysql> DELETE FROM dashboards where id = '3';
-
Repeat the procedure above for all users that should have a predefined dashboard.
-
Download the custom script that you can find at the bottom of this article in zip format (contains copy-dashboard.php). It has been developed for this process to your op5 server
-
Edit the script and change the parameters below, in this example I will copy the dashboard from the user '<user>' as the source user:
// Name of the dashboard to copy to the users $dashboard_name = 'Dashboard for <user>'; // Name of the user that owns (created) the dashboard $dashboard_user = '<user>';
-
Use the aforementioned list of users that was saved from the database to insert into the array below:
// List of usernames to copy the dashboard to, // could be fetched from multiple locations $target_users = array('reports, 'readonly');
-
Once you have double-checked the target and the source users, execute the script:
# php copy-dashboard.php
-
Log into OP5 Monitor with one of the target users that were specified as a target in the script to verify.
Comments
0 comments
Please sign in to leave a comment.