Retrieve all events related to a service via curl

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
jribeauv
Posts: 1
Joined: Wed Jan 20, 2021 3:43 am

Retrieve all events related to a service via curl

Post by jribeauv »

Hi,
By using a NRPE plugin which sends timely based events whose status is always O.K.
but attached datas are modified , I want to list them by using curl API such as :
curl -XGET "http://x.x.x.x/nagiosxi/api/v1/objects/ ... x&pretty=1

By using this request I retrieve only the newest one ..
How may in change this request in order to get all the events ?
Thx for help.
Regards,
J.P. Ribeauville
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Retrieve all events related to a service via curl

Post by ssax »

You would want to use the objects/statehistory endpoint for this, see here on your system:

Code: Select all

http://YOURXISERER/nagiosxi/help/api-object-reference.php#objects-statehistory

Code: Select all

curl -k -L 'http://YOURXISERVER/nagiosxi/api/v1/objects/statehistory?apikey=YOURAPIKEY&pretty=1&host_name=YOURHOSTNAME&service_description=YOURSERVICEDESC'
Locked