Nagios XI Rest API

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
neosecurearg
Posts: 8
Joined: Wed Mar 09, 2016 8:47 am

Nagios XI Rest API

Post by neosecurearg »

Hi! We want to see all the Nagios audit from the last 7 days. As I'm seeing, the following command will show the last day:

$ curl -XGET 'https://127.0.0.1/nagiosxi/api/v1/objec ... y&pretty=1

How can I run it to see the last 7 days?

Thanks!
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Nagios XI Rest API

Post by scottwilkerson »

you need to add the following to the URL (from the docs)
starttime <timestamp> (Default: -24 hours) objects/statehistory?starttime=1506089409 - Displays the last week of data until now.
endttime <timestamp> (Default: now) objects/statehistory?starttime=1505484609&endtime=1506089409 - Displays 1 week of data starting 2 weeks ago. Should be used with starttime.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
neosecurearg
Posts: 8
Joined: Wed Mar 09, 2016 8:47 am

Re: Nagios XI Rest API

Post by neosecurearg »

Hi, thanks for your quick answer, one additional question: Is there any way to list all the audit entries through REST with logentry_data like '%NOTIFICATION%'?

Thanks in advance!
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Nagios XI Rest API

Post by scottwilkerson »

Yes, you can add the following to the URL

Code: Select all

&logentry_data=lk:NOTIFICATION
See the section at the top of the Help -> "Objects Reference" in XI for all available options, you can click on the <type>: next to <column> to see all the operators.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
neosecurearg
Posts: 8
Joined: Wed Mar 09, 2016 8:47 am

Re: Nagios XI Rest API

Post by neosecurearg »

Hi! Thanks for your time, we are not familiar yet with the help of Nagios XI, thanks for additionally show me where to find it.

Now we have found a new issue, we tought the /nagiosxi/api/v1/objects/logentries call includes the Audit Log, but it doesn't... is there any REST call to get the Nagios Audit Log (with the same events availables at Admin > Audit Log)?

Thanks in advance.-
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Nagios XI Rest API

Post by scottwilkerson »

This isn't available yet but will be added in the foture.

For the time being, you can pull a CSV version using the following URI structure

Code: Select all

/nagiosxi/admin/auditlog.php?reportperiod=custom&startdate=2017-10-01&enddate=2017-10-02&mode=getreport&mode=csv&apikey=YOUR_API_KEY
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked