Page 1 of 1
Export Users list along with auth level information
Posted: Wed Feb 20, 2019 9:27 am
by mohan23
I want to export username along with Auth level information from nagiosxi. can some one help me on how to pull this data.
I have tried pulling data using API, but its displaying data in json format, Is there any way that we can get only usernames from this json data format.
or is there any other way to get this information
curl -XGET "
http://nagioshostname/nagiosxi/api/v1/s ... &&pretty=1"
Is it possible to pull this data from xi database. can someone help on querying this
Appreciate a quick help here
Re: Export Users list along with auth level information
Posted: Wed Feb 20, 2019 4:02 pm
by npolovenko
Hello,
@mohan23. Please try the following query and let me know if that's what you were looking for:
echo "select xi_users.username as username,xi_usermeta.keyvalue as 'AuthLevel(255=admin,1=regular user)' from xi_usermeta inner join xi_users on xi_usermeta.user_id = xi_users.user_id where keyname = 'userlevel';"| mysql -u root -pnagiosxi nagiosxi
Re: Export Users list along with auth level information
Posted: Fri Feb 22, 2019 2:01 pm
by mohan23
Yes, this is working for me. Provided query provides me user list including admins and read only users. I want to pull only user list of admins . How to modify the query to pull only admin users list
Re: Export Users list along with auth level information
Posted: Fri Feb 22, 2019 3:18 pm
by swolf
Sure!
Code: Select all
echo select xi_users.username as username, xi_usermeta.keyvalue as AuthLevel from xi_usermeta inner join xi_users on xi_usermeta.user_id = xi_users.user_id where keyname = 'userlevel' and xi_usermeta.keyvalue = 255;" | mysql -u root -pnagiosxi nagiosxi
Let us know if you have any other concerns
Pull Admin user list using Nagios API
Posted: Wed Feb 27, 2019 8:06 am
by mohan23
Hi Team,
Using below API query, im able to get users information but I don't see auth level information.
http://hostname/nagiosxi/api/v1/system/ ... x&pretty=1
{
"records": 107,
"users": [
{
"user_id": "123",
"username": "smadhuk",
"name": "Madhukar, Shubhendu - Shubhendu",
"email": "
[email protected]",
"enabled": "1"
}
Can some one help me with pulling users information like above along with AuthLevel information?
Appreciate quick help on this!
Re: Export Users list along with auth level information
Posted: Wed Feb 27, 2019 11:18 am
by mohan23
If I want to export user list along with Auth level information using Nagios Rest API, how can I use this,. Below query gives user list with all information like name, email id and username but not the auth level information for the users
http://hostname/nagiosxi/api/v1/system/ ... x&pretty=1
{
"records": 107,
"users": [
{
"user_id": "123",
"username": "smadhuk",
"name": "Madhukar, Shubhendu - Shubhendu",
"email": "
[email protected]",
"enabled": "1"
}
Can you tell me what modifications to be done for above API query so that I can get username, name , email, and AuthLevel information.
????
Re: Export Users list along with auth level information
Posted: Wed Feb 27, 2019 4:56 pm
by npolovenko
@mohan23, Currently the API command only returns the list of users. It doesn't provide any info about the authorization level. So for now, the only option is to use MySQL queries or Web Interface.
Re: Export Users list along with auth level information
Posted: Wed Feb 27, 2019 8:24 pm
by mohan23
So from web interface how can we export user list along with Auth level info?
Re: Export Users list along with auth level information
Posted: Thu Feb 28, 2019 10:48 am
by scottwilkerson
mohan23 wrote:So from web interface how can we export user list along with Auth level info?
This is not currently available from the web interface, the only current way to get the info would be from the SQL provided earlier in the thread