Page 1 of 1

Is it possible to manually input User API Key?

Posted: Wed May 27, 2020 8:20 am
by meganwilliford
Is it possible to manually input a user's API Key? For example, if we want the API key to be the same for a user on multiple Nagios XI instances. In the interface the only option seems to be to generate a new key.

Re: Is it possible to manually input User API Key?

Posted: Wed May 27, 2020 4:03 pm
by jbrunkow
It is not currently possible to manually input an API key in the XI interface.

We may also be able to find a workaround for adding a specific API key. I can look to see if there is a way to manipulate that information in the XI database.

However, I don't think you're the first to ask about a feature like this. If you believe there is enough of a need to do this, we could submit a feature request for it to be added to a future release.

Re: Is it possible to manually input User API Key?

Posted: Thu May 28, 2020 3:13 pm
by meganwilliford
Please let me know if its possible via the database.

I think submitting it as a feature request makes sense. It would be especially useful in disaster recovery situations to be able to manage the API Key so integrations using the API are not broken.

Re: Is it possible to manually input User API Key?

Posted: Thu May 28, 2020 3:50 pm
by jbrunkow
I believe that the solution provided in topic 42467 may prove useful in your situation as well.
...you can do it in the database directly on a per-user basis:

Code: Select all

echo "UPDATE nagiosxi.xi_users SET api_key='mycoolkey' WHERE  username='nagiosadmin';" | mysql -uroot -pnagiosxi
-mcapra

Otherwise, it looks like the solution in topic 44024 may also be relevant.
You could set the Backend Ticket to the same on your server and use that for your API ticket number.

Code: Select all

mysql -u root -pnagiosxi nagiosxi -e "UPDATE xi_users SET backend_ticket = '< API key >' WHERE username='nagiosadmin'";
-tgriep