Page 1 of 1

Format or Modified the Limited queries in NagiosXI APIs

Posted: Thu Nov 03, 2016 1:10 am
by network2016
Hi all

Need one help on APIs avalaible in NAgiosXI ,as I have tried the APIs for the process which define all hosts and services combine ,but is it possible to call any specific services for any particular host individually??? ,If you can provide me with any example of API to call for any single host and service ,for example

for hosts

http://192.168.150.30/nagiosxi/backend/ ... t=f0ebse4q

For services

http://192.168.150.30/nagiosxi/backend/ ... t=f0ebse4q

Now in this we need specific host and service to call ,Is it possible ,that is my question, Please advice and Help on this too.

Basically I want to modify or create/call an specific service for an single host at a give time period in APIs ,there are limited set pf APIs modification available in help menu.. for ex [below attachment]

Regards

Re: Format or Modified the Limited queries in NagiosXI APIs

Posted: Thu Nov 03, 2016 9:38 am
by rkennedy
The links you posted are for the OLD API version, but the screenshot appears to be for the NEW API. For the older backend component, here is how you could drill down to a specific host -

Code: Select all

http://192.168.3.115/nagiosxi/backend/?cmd=gethoststatus&username=nagiosadmin&ticket=32klfcka&name=localhost
Just append &name= to specify further what you're looking for.

As for the newer API, I would look at the Help -> Config Reference (this is the part that applies to making configuration changes through the API.

You can modify the time periods here as needed, as you'll see these as the optional variables.

Code: Select all

host_name 	host name
address 	ip address
max_check_attempts 	#
check_period 	timeperiod_name
contacts
or
contact_groups 	contacts
or
contact_groups
notification_interval 	#
notification_period 	timeperiod_name
An example call to do so -

Code: Select all

curl -XPOST "http://192.168.3.115/nagiosxi/api/v1/config/host?apikey=32klfcka&pretty=1" -d "host_name=testapihostapply&address=127.0.0.1&check_command=check_ping\!3000,80%\!5000,100%&max_check_attempts=2&check_period=24x7&contacts=nagiosadmin&notification_interval=5&notification_period=24x7&applyconfig=1"

Re: Format or Modified the Limited queries in NagiosXI APIs

Posted: Wed Nov 09, 2016 2:35 am
by network2016
Thanks rkennedy !!!!!!!!!!!!!!!!!!!!!!!!!

Really helpful reply!!!!

Re: Format or Modified the Limited queries in NagiosXI APIs

Posted: Wed Nov 09, 2016 11:49 am
by mcapra
Did you need additional assistance with this issue, or are we ok to close this thread and mark the issue as resolved?

Re: Format or Modified the Limited queries in NagiosXI APIs

Posted: Thu Nov 10, 2016 1:00 am
by network2016
U can please close this for now.. I am happy with the help and will return IF required any help in future

Thank you everyone ..for the Help

:)