Page 1 of 1
Trouble with API Authentication in Nagios XI
Posted: Fri Mar 07, 2025 3:08 am
by Claying1957
I’m having trouble with Nagios XI API authentication. I’ve set up the API key and user with permissions, but I’m getting a 401 Unauthorized error when trying to use a curl command.
Here’s the command I’m using:
Code: Select all
curl -X GET 'https://<your_nagios_xi_server>/nagiosxi/api/v1/objects/hosts?apikey=<your_api_key>'
I’ve double-checked the API key and user permissions, but no luck. Any suggestions?
Re: Trouble with API Authentication in Nagios XI
Posted: Fri Mar 07, 2025 10:22 am
by sgardil
Claying1957 wrote: ↑Fri Mar 07, 2025 3:08 am
I’m having trouble with Nagios XI API authentication. I’ve set up the API key and user with permissions, but I’m getting a 401 Unauthorized error when trying to use a curl command.
Here’s the command I’m using:
Code: Select all
curl -X GET 'https://<your_nagios_xi_server>/nagiosxi/api/v1/objects/hosts?apikey=<your_api_key>'
I’ve double-checked the API key and user permissions, but no luck. Any suggestions?
I think the issue is your searching for hosts and not host. That should fix it for you unless you want to pull for hoststatus. I would link to a pdf doc for further information but inside of XI in the help section, there are some pretty good docs for API endpoints and the structure. Have them grab the host section or modify the script to just be host and see if that works.
Re: Trouble with API Authentication in Nagios XI
Posted: Sat Jul 05, 2025 3:24 am
by CharlotteMurphy
Is your Nagios XI server using SSL with a self-signed certificate? If so, have you tried adding -k to curl to ignore certificate validation temporarily?
Re: Trouble with API Authentication in Nagios XI
Posted: Sat Jul 05, 2025 3:24 am
by SophiaRodriguez
Which version of Nagios XI are you running? Some older versions have different API behavior or known issues around API keys.
Re: Trouble with API Authentication in Nagios XI
Posted: Tue Jul 08, 2025 3:47 am
by Owenpauly
Claying1957 wrote: ↑Fri Mar 07, 2025 3:08 am
I’m having trouble with Nagios XI API authentication. I’ve set up the API key and user with permissions, but I’m getting a 401 Unauthorized error when trying to use a curl command.
Here’s the command I’m using:
Code: Select all
curl -X GET 'https://<your_nagios_xi_server>/nagiosxi/api/v1/objects/hosts?apikey=<your_api_key>'
strands hint
I’ve double-checked the API key and user permissions, but no luck. Any suggestions?
If your Nagios XI server uses a self-signed certificate, you may need to add the `-k` option to the curl command to skip SSL verification.