Export Users list along with auth level information

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
mohan23
Posts: 118
Joined: Tue Oct 03, 2017 7:11 am

Export Users list along with auth level information

Post 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
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Export Users list along with auth level information

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
mohan23
Posts: 118
Joined: Tue Oct 03, 2017 7:11 am

Re: Export Users list along with auth level information

Post 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
swolf

Re: Export Users list along with auth level information

Post 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
mohan23
Posts: 118
Joined: Tue Oct 03, 2017 7:11 am

Pull Admin user list using Nagios API

Post 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!
mohan23
Posts: 118
Joined: Tue Oct 03, 2017 7:11 am

Re: Export Users list along with auth level information

Post 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.

????
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Export Users list along with auth level information

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
mohan23
Posts: 118
Joined: Tue Oct 03, 2017 7:11 am

Re: Export Users list along with auth level information

Post by mohan23 »

So from web interface how can we export user list along with Auth level info?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Export Users list along with auth level information

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked