We are attempting to use the cgi-bin/archivejson.cgi Nagios api. When we make the following api call from a browser the user is prompted for credentials and then any subsequent calls are made without the requirement of further authentication or api key. We need to be able to make the same api call from an automated system, so we need to be able to bypass the prompt for user credentials. We have tried sending the call with an api key and also with a username and password in the URI however we get a 401 unauthorized error. We’ve validated that user account is authorized to make these api calls (we can run this call if we login with the same credentials through the browser) and also that the api key is correct. I have not been able to find any documentation o how to use cgi-bin/archivejson.cgi Nagios api with authentication information outside the browser. Is there a way to make this call with an API key or set of credentials? Some examples of the calls we have tried are the following. We’re removed the actual api key and credential values in the example.
http://serverip/nagios/cgi-bin/archivej ... 1522555200
http://serverip/nagios/cgi-bin/archivej ... 1522555200
NAGIOS API QUESTION
Re: NAGIOS API QUESTION
Have you tried using something like this:
where you substitute "username" and "password" with the actual username and password, used to log in your Nagios server?
Code: Select all
http://username:password@serverip/nagios/cgi-bin/archivejson.cgi?&query=availability&availabilityobjecttype=services&servicedescription=URL&assumeinitialstate=true&assumestateretention=true&assumedinitialservicestate=ok&starttime=1519880400&endtime=1522555200Be sure to check out our Knowledgebase for helpful articles and solutions!