Unsupported
While safe, this procedure is not supported. It is offered as a courtesy to users who feel comfortable modifying the database. Use at your own risk.Why
For different reasons, you may want to change the ownership of a dashboard in OP5 Monitor. While there is currently no way in the product to do this, it's trivial to change the owner in the database.
How
Before doing anything, run op5-backup
or at the very least backup your dashboards table by making a snapshot of the entire table to file:
# mysqldump merlin dashboards --complete-insert --extended-insert=FALSE | gzip -9 > /tmp/dashboards.gz
To roll back and replace your dashboards table completely with the contents of this dump file, run:
# zcat /tmp/dashboards.gz | mysql -D merlin
Now that you have a backup, start by inspecting all of your dashboards, and identify the one that you wish to transfer ownership of:
# mysql -D merlin -e "select * from dashboards" +----+------------------------+----------+--------+-----------+ | id | name | username | layout | read_perm | +----+------------------------+----------+--------+-----------+ | 1 | Dashboard for monitor | monitor | 1,3,2 | | | 2 | MONITOR_DASHBOARD | monitor | 3,2,1 | | | 3 | Dashboard for monitor2 | monitor2 | 1,3,2 | | +----+------------------------+----------+--------+-----------+
In this case, the MONITOR_DASHBOARD currently owned by monitor will have its ownership transferred to monitor2.
1. Find Dashboard ID
Every dashboard has a unique ID, in the query above we can see that the dashboard we wish to move has id 2. Begin by creating a select query that selects only this row on its most unique value, meaning the ID:
2. Select Dashboard ID
Enter your ID in a query like so:
# mysql -D merlin -e "select * from dashboards where id = 2"
Only one row is returned, which tells us that this query is unique enough.
3. Update by Dashboard ID
Instead of selecting, we will now update this unique row, identified by ID. Run the following query and take extra care to verify the values:
# mysql -D merlin -e "update dashboards set username = 'monitor2' where id = 2"
Or in general terms with pseudo-values:
# mysql -D merlin -e "update dashboards set username = 'new_owner' where id = your_dashboard_id"
4. Verify
When done, verify the change by showing all dashboards again:
# mysql -D merlin -e "select * from dashboards"
Or, show only the dashboards belonging to a certain user:
# mysql -D merlin -e "select * from dashboards where username = 'monitor2'"
-
Tags:
- mysql
- Dashboard
- unsupported
- dashboards
- mysqldump
- OP5 Monitor
Comments
0 comments
Please sign in to leave a comment.