Format or Modified the Limited queries in NagiosXI APIs

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
network2016
Posts: 47
Joined: Tue Mar 08, 2016 11:35 am

Format or Modified the Limited queries in NagiosXI APIs

Post 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
You do not have the required permissions to view the files attached to this post.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Format or Modified the Limited queries in NagiosXI APIs

Post 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"
Former Nagios Employee
network2016
Posts: 47
Joined: Tue Mar 08, 2016 11:35 am

Re: Format or Modified the Limited queries in NagiosXI APIs

Post by network2016 »

Thanks rkennedy !!!!!!!!!!!!!!!!!!!!!!!!!

Really helpful reply!!!!
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Format or Modified the Limited queries in NagiosXI APIs

Post by mcapra »

Did you need additional assistance with this issue, or are we ok to close this thread and mark the issue as resolved?
Former Nagios employee
https://www.mcapra.com/
network2016
Posts: 47
Joined: Tue Mar 08, 2016 11:35 am

Re: Format or Modified the Limited queries in NagiosXI APIs

Post 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

:)
Locked