Back End Queries: Best Practices

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
dhruvaps
Posts: 3
Joined: Mon Aug 08, 2011 5:23 pm

Back End Queries: Best Practices

Post by dhruvaps »

Hello,

We need to access the back end. I have been looking at services provided by the Backend API URL plugin, but we need more finely-grained queries than appear to be provided.

For example, we need to be able to query the current host status, returning only those with a certain command:

http://nagiosxi/nagiosxi/backend/?cmd=g ... _host_ping[/b]

Does this plugin offer a way to do that that I may have missed? Failing that, what is the best away to achieve this functionality?

Thanks,
Dhruva
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: Back End Queries: Best Practices

Post by mguthrie »

Currently we don't have a feature like this built into the API of XI. I know some users have actually written their own, but if that's not an option you can post it as a feature request on tracker.nagios.com.
pesho318i
Posts: 2
Joined: Tue Feb 21, 2012 5:43 am

Re: Back End Queries: Best Practices

Post by pesho318i »

Hello,
I would also need to make more fine-grained queries to the back-end. Say we're monitoring 50,000 servers and I need the status of only a single one at a time. Getting the humongous xml would not be the best way I guess...
I know some users have actually written their own...
What would be the way (flow) to write such functionality?

Thank you!
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Back End Queries: Best Practices

Post by scottwilkerson »

In the newest version of the backend API (with XI 2011R2.1) you can add filters to the URL string on some calls.

For example, on a gethost status call, you can add &host_id=12345 to the url and only get info on that item.
you can also use &host_name=MYHOST

For example, this

Code: Select all

https://192.168.5.69/nagiosxi/backend/?cmd=gethoststatus&username=nagiosadmin&ticket=XXXXXXXX&host_name=localhost
will only give you the status of a host with a host_name
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
pesho318i
Posts: 2
Joined: Tue Feb 21, 2012 5:43 am

Re: Back End Queries: Best Practices

Post by pesho318i »

That's great! Thanks for the info!

Code: Select all

For example, on a gethost status call, you can add &host_id=12345 to the url and only get info on that item.
you can also use &host_name=MYHOST
But where can I see the API's documentation with a list of possible queries?
The API Component I installed a couple of days ago by default does not offer such info in its settings.

Cheers!
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Back End Queries: Best Practices

Post by scottwilkerson »

Unfortunately, we don't have documentation on this yet, it is currently an undocumented/unadvertised feature but it is on the TODO list.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked