Export User Information From Manage Users

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
jkinning
Posts: 747
Joined: Wed Oct 09, 2013 2:54 pm

Export User Information From Manage Users

Post by jkinning »

I have over 250 users within Nagios XI and about 75 of these users have a phone number they entered for SMS information along with their cell provider. Nagios will send an email to this address and they get an SMS notification. Is there a way to export this information instead of me masquerading as them to get this number and provider information? I guess export the information under Admin | Manage users whould be great but not sure how to go about doing that.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Export User Information From Manage Users

Post by tmcdonald »

Update:

Bryan Heden, our Product Development Manager came along and made it better so it actually gives all the info you want :)

Code: Select all

select t1.username as user, t2.keyvalue as phone, t3.keyvalue as provider from xi_usermeta t2 left join xi_users t1 on t2.user_id = t1.user_id left join xi_usermeta t3 on t3.user_id = t1.user_id where t2.keyname = 'mobile_number' and t3.keyname = 'mobile_provider';
----------

Nothing built in, but if you know how to get into the MySQL DB you can use this:

Code: Select all

use nagiosxi;
select xi_users.username as username,xi_usermeta.keyvalue as phone from xi_usermeta inner join xi_users on xi_usermeta.user_id = xi_users.user_id where keyname = 'mobile_number';
Let me know if you need more of an in-depth explanation. We tend to take the "Don't poke around in the DB" stance on the forums, so I am being intentionally vague :)

Also, it might need to be adjusted if you are using a system that upgraded from a 2014 or older version. Namely, it may be in Postgres still so you will need to log in there instead.
Former Nagios employee
jkinning
Posts: 747
Joined: Wed Oct 09, 2013 2:54 pm

Re: Export User Information From Manage Users

Post by jkinning »

I don't have a NagiosXI database.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| nagios |
| nagiosql |
| test |
+--------------------+
5 rows in set (0.00 sec)

I do believe this started out as a 2014 version which has been upgraded to now 5.4.13.
jkinning
Posts: 747
Joined: Wed Oct 09, 2013 2:54 pm

Re: Export User Information From Manage Users

Post by jkinning »

In addition to the sms number each user has configured I would like to export the listing of what host and services they are associated with as well.

I have been poking around but can't figure out where this information is located.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Export User Information From Manage Users

Post by tmcdonald »

jkinning wrote:I don't have a NagiosXI database.

I do believe this started out as a 2014 version which has been upgraded to now 5.4.13.
In that case you will need to run that through Postgres:

Code: Select all

psql -U nagiosxi -d nagiosxi -c "select t1.username as user, t2.keyvalue as phone, t3.keyvalue as provider from xi_usermeta t2 left join xi_users t1 on t2.user_id = t1.user_id left join xi_usermeta t3 on t3.user_id = t1.user_id where t2.keyname = 'mobile_number' and t3.keyname = 'mobile_provider'"
jkinning wrote:In addition to the sms number each user has configured I would like to export the listing of what host and services they are associated with as well.
That will be a bit harder to come up with. The trouble is that half the information is in Postgres and half is in MySQL. If it were all in one that would be easier.

Update: If you want to convert to a MySQL-only install, you can follow this guide: https://support.nagios.com/kb/article/c ... i-560.html

Then you could use the query in my original post to get the phone info.

The associated host+service bit is still more than I would be able to give you over the forum without getting a dev involved.
Former Nagios employee
jkinning
Posts: 747
Joined: Wed Oct 09, 2013 2:54 pm

Re: Export User Information From Manage Users

Post by jkinning »

Thanks I was able to get the SMS information so I will stumble around looking at what host and services they were assigned to manually looking at the Nagios WebUI.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Export User Information From Manage Users

Post by lmiltchev »

Do you want us to keep the thread open for a while or it is ok to lock it?
Be sure to check out our Knowledgebase for helpful articles and solutions!
jkinning
Posts: 747
Joined: Wed Oct 09, 2013 2:54 pm

Re: Export User Information From Manage Users

Post by jkinning »

You can close.
Locked