Page 1 of 1

Nagiosxi API

Posted: Sun Aug 08, 2021 8:00 am
by mejokj
Hello,

i need to update below things using API
1. mics settings status image and icon image using API.

2. bulk check for all service on given host using API.

Re: Nagiosxi API

Posted: Mon Aug 09, 2021 1:48 pm
by ssax
1. See Help > Config Reference:

You would use these in your API commands while adding/updating the host:

Code: Select all

icon_image=yourimage.png
statusmap_image=yourimage.png

Code: Select all

curl -k -L -XPUT "https://X.X.X.X/nagiosxi/api/v1/config/host/THEHOSTNAME?apikey=YOURAPIKEY&pretty=1&address=X.X.X.X&notification_interval=30&icon_image=yourimage.png&statusmap_image=yourimage.png&applyconfig=1"
For services there is only icon_image:

Code: Select all

icon_image=yourimage.png

Code: Select all

curl -k -L -XPUT "https://X.X.X.X/nagiosxi/api/v1/config/service/THEHOSTNAME/THESERVICENAME?apikey=YOURAPIKEY&pretty=1&display_name=XXXXXXX&icon_image=yourimage.png&applyconfig=1"
2. See Help > System Reference > corecommand

Code: Select all

curl -k -L -vvv -XPOST "https://X.X.X.X/nagiosxi/api/v1/system/corecommand?apikey=YOURAPIKEY" -d "cmd=SCHEDULE_FORCED_HOST_SVC_CHECKS;THEHOSTNAME;$(date +%s)"
Taken from here:

https://assets.nagios.com/downloads/nag ... and_id=130
https://assets.nagios.com/downloads/nag ... ernalcmds/