How to share views
-
- Posts: 128
- Joined: Wed Feb 20, 2019 3:46 pm
How to share views
I've created views that I would like all users to have. How do I share the views that I create with all users?
Re: How to share views
You can deploy dashboards to users but not views. This functionality doesn't exist in Nagios XI at the moment. The only way you could share views with users would be to provide them with the URL to the view that you would like to share (Views > My Views, right click on the view that you would like to share > Open Link in New Tab, copy the URL, and send it to your user).
Be sure to check out our Knowledgebase for helpful articles and solutions!
-
- Posts: 128
- Joined: Wed Feb 20, 2019 3:46 pm
Re: How to share views
I could not find a way to share views between users but I did come up with a way to have a list of default views to assign to new users. I'm more interested in assigning the default views to new users.
First build your default view list. Get it to look exactly the way you want.
Create the new user.
Now login to mysql using the admin id and password, usually root with default nagiosxi password unless you changed it.
mysql -uroot -p <your password> -A -Dnagiosxi
Find the user id of the user with the list of views you just created. You'll also need the new users id.
select user_id,username,name from xi_users;
xi_usermetata is the table we want. now add the views to the new user. A new user that has not logged in or accessed the view menu will not have a views entry in the table. Unfortunately you have to do this in 3 steps in mysql.
first insert a new row into xi_usermeta table for the 'views' keyname. The 9 is the user_id for the new user just created. Yours will most likely be different.
insert into xi_usermeta (user_id,keyname,autoload) values(9,'views',0);
Now get the keyvalue. It's a very long string. Copy and paste to notepad or some text file. The 1 is for the user_id that has the views we want.
select keyvalue from xi_usermeta where user_id=1 and keyname='views';
The last step is to update xi_usermeta with keyvalue you just copied. The 9 is the user_id of the new user. Keyvalue is a very long string so I wont paste it here.
update xi_usermeta set keyvalue='<keyvalue>' where keyname='views' and user_id=9;
The new user should have the default views now.
From an admin perspective, I guess you could write a tool to do this or even a tool users could access to share views with each other.
First build your default view list. Get it to look exactly the way you want.
Create the new user.
Now login to mysql using the admin id and password, usually root with default nagiosxi password unless you changed it.
mysql -uroot -p <your password> -A -Dnagiosxi
Find the user id of the user with the list of views you just created. You'll also need the new users id.
select user_id,username,name from xi_users;
xi_usermetata is the table we want. now add the views to the new user. A new user that has not logged in or accessed the view menu will not have a views entry in the table. Unfortunately you have to do this in 3 steps in mysql.
first insert a new row into xi_usermeta table for the 'views' keyname. The 9 is the user_id for the new user just created. Yours will most likely be different.
insert into xi_usermeta (user_id,keyname,autoload) values(9,'views',0);
Now get the keyvalue. It's a very long string. Copy and paste to notepad or some text file. The 1 is for the user_id that has the views we want.
select keyvalue from xi_usermeta where user_id=1 and keyname='views';
The last step is to update xi_usermeta with keyvalue you just copied. The 9 is the user_id of the new user. Keyvalue is a very long string so I wont paste it here.
update xi_usermeta set keyvalue='<keyvalue>' where keyname='views' and user_id=9;
The new user should have the default views now.
From an admin perspective, I guess you could write a tool to do this or even a tool users could access to share views with each other.
Re: How to share views
Thanks for sharing! Yes, you could share views this way, however we discourage users from modifying stuff directly in the DB...
It's a great candidate for a feature request. I will forwarded to our developers. Thank you!From an admin perspective, I guess you could write a tool to do this or even a tool users could access to share views with each other.
Be sure to check out our Knowledgebase for helpful articles and solutions!