Page 1 of 1

Dump of Users and Mobile numbers

Posted: Fri Apr 26, 2013 1:20 pm
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!

Re: Dump of Users and Mobile numbers

Posted: Fri Apr 26, 2013 2:58 pm
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

Re: Dump of Users and Mobile numbers

Posted: Mon Apr 29, 2013 10:33 am
by uidaho
Thanks! Very helpful.

How about also getting the corresponding Cell Provider email address?

Re: Dump of Users and Mobile numbers

Posted: Mon Apr 29, 2013 12:38 pm
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

Re: Dump of Users and Mobile numbers

Posted: Wed May 01, 2013 4:56 pm
by uidaho
Much appreciated. Thanks.