Page 1 of 1

Retrieve all events related to a service via curl

Posted: Thu Jan 21, 2021 3:51 am
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

Re: Retrieve all events related to a service via curl

Posted: Thu Jan 21, 2021 7:05 pm
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'