Set API key for NagosXI

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
nagwindmon
Posts: 92
Joined: Mon Dec 01, 2014 3:39 pm

Set API key for NagosXI

Post by nagwindmon »

I have created scripts utilizing APIs and it works great in my testing... using my user key to access the API and my login credentials into NagosXI based off my AD account
Now I'm ready to move those into prod environment where scripts will be running on several different windows boxes so is there a way to set the key on each XI server and it wont be tied to individual user?
NagiosXI ver 5.4.4
Thanks!
Last edited by dwhitfield on Fri May 26, 2017 1:55 pm, edited 1 time in total.
Reason: marking with green check mark
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Set API key for NagosXI

Post by dwhitfield »

You can just create a separate account for API usage. If you have another account other than nagiosadmin, you could just use nagiosadmin.
nagwindmon
Posts: 92
Joined: Mon Dec 01, 2014 3:39 pm

Re: Set API key for NagosXI

Post by nagwindmon »

dwhitfield wrote:You can just create a separate account for API usage. If you have another account other than nagiosadmin, you could just use nagiosadmin.
I'm not sure I got this... may need more of your help here please, so if I go ahead and use nagiosadmin then where API key for this user can be found, is this something I can view thru UI, or database query into nagios?
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Set API key for NagosXI

Post by dwhitfield »

Apologies. It's in the same place for each user: http://YOURSERVER/nagiosxi/account/

You'll need to be logged in as that user (masquerading or otherwise) to access their account page.

Please let us know if you need any additional info.
nagwindmon
Posts: 92
Joined: Mon Dec 01, 2014 3:39 pm

Re: Set API key for NagosXI

Post by nagwindmon »

I'm new to Nagios and the API, so let me rephrase my question:
We will have quite a few of XI servers so keeping track of the individual api keys is prohibitive.
Is there a way to set the key on each XI?
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Set API key for NagosXI

Post by tgriep »

You could set the Backend Ticket to the same on your server and use that for your API ticket number.
Run the following as root, but change '12345678' to the API key you want to use and this will set the backend ticket key for the nagiosadmin backend API.

Code: Select all

mysql -u root -pnagiosxi nagiosxi -e "UPDATE xi_users SET backend_ticket = '12345678' WHERE username='nagiosadmin'";
Then, you can use this API as the ticket number in the calls and not the user unique API key.
Be sure to check out our Knowledgebase for helpful articles and solutions!
nagwindmon
Posts: 92
Joined: Mon Dec 01, 2014 3:39 pm

Re: Set API key for NagosXI

Post by nagwindmon »

looks like our set up is different from standard, no nagiosxi db?
Please advise
You do not have the required permissions to view the files attached to this post.
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Set API key for NagosXI

Post by dwhitfield »

It's possible your db is offloaded.

Can you PM me your Profile? You can download it by going to Admin > System Config > System Profile and click the ***Download Profile*** button towards the top. If for whatever reason you *cannot* download the profile, please put the output of View System Info (5.3.4+, Show Profile if older) in the thread (that will at least get us some info). This will give us access to many of the logs we would otherwise ask for individually. If security is a concern, you can unzip the profile take out what you like, and then zip it up again. We may end up needing something you remove, but we can ask for that specifically.

After you PM the profile, please update this thread. Updating this thread is the only way for it to show back up on our dashboard.
nagwindmon
Posts: 92
Joined: Mon Dec 01, 2014 3:39 pm

Re: Set API key for NagosXI

Post by nagwindmon »

*cannot* download the profile:
PROFILE BUILD FAILED
Array
(
[0] => Request rejected by Privilege Manager
)

CODE: 1

System Info file has been attached
You do not have the required permissions to view the files attached to this post.
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Set API key for NagosXI

Post by dwhitfield »

nagwindmon wrote: [0] => Request rejected by Privilege Manager
That is likely to be the case in a lot of situations. For now, see https://support.nagios.com/kb/article.p ... ategory=44
Locked