Dump of Users and Mobile numbers

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
uidaho
Posts: 89
Joined: Tue Feb 12, 2013 11:58 am

Dump of Users and Mobile numbers

Post by uidaho »

Where are the user's cell phone numbers kept in Nagios XI? I'm referring to the mobile number set via a users "Notification Options" -> "Notification Methods".

I have another unrelated program that needs a list of users and cell phone numbers. I'd love to get a dump from Nagios XI and use it for this other program, instead of maintaining two copies of the data.

I briefly looked in the nagios configs in /usr/local/nagios/etc, the mysql and postgress databases. Maybe I missed the table? What is the right table name?

Thanks!
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Dump of Users and Mobile numbers

Post by scottwilkerson »

you can run the following from the shell

Code: Select all

echo "select username,keyvalue as mobile from xi_users,xi_usermeta where xi_users.user_id=xi_usermeta.user_id and keyname='mobile_number';"|psql nagiosxi nagiosxi
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
uidaho
Posts: 89
Joined: Tue Feb 12, 2013 11:58 am

Re: Dump of Users and Mobile numbers

Post by uidaho »

Thanks! Very helpful.

How about also getting the corresponding Cell Provider email address?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Dump of Users and Mobile numbers

Post by scottwilkerson »

Can't easily do that in a single query, but I can show you how to get what the provider is for each username

Code: Select all

echo "select username,keyvalue as mobile_provider from xi_users,xi_usermeta where xi_users.user_id=xi_usermeta.user_id and keyname='mobile_provider';"|psql nagiosxi nagiosxi
Then the provider info is stored serialized in postgres

Code: Select all

echo "select value from xi_options where name='mobile_provider_info';"|psql nagiosxi nagiosxi
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
uidaho
Posts: 89
Joined: Tue Feb 12, 2013 11:58 am

Re: Dump of Users and Mobile numbers

Post by uidaho »

Much appreciated. Thanks.
Locked