Child pages
  • In depth material about copying dashboards between users
Skip to end of metadata
Go to start of metadata

In OP5 Monitor version 7.2.6, we introduced Sharable Dashboards. We also have a how-to guide that features a Python script to clone multiple dashboards to another user.

This how-to guide 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

  1. Start with a preconfigured dashboard that will be propagated to users;
  2. 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;
  3. Make sure that none of the users to whom you will be propagating the dashboards are logged in;
  4. 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

  1. 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 users dashboard from two tables: 'dashboards' and 'dashboard_widgets'.


  2. To remove the current dashboard for the user 'readonly', execute the following:

    removing after copying
    mysql> DELETE FROM dashboard_widgets WHERE dashboard_id = '3'; 
    mysql> DELETE FROM dashboards where id = '3'; 


  3. Repeat the procedure above for all users that should have a predefined dashboard.

  4. Download the custom script that has been developed for this process to your op5 server: https://download.op5.com/fm/20101/copy-dashboard.php

  5. 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>'; 
  6. 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'); 


  7. Once you have double-checked the target and the source users, execute the script:

    # php copy-dashboard.php 
  8. Log into OP5 Monitor with one of the target users that were specified as target in the script to verify.

There is no content with the specified labels