[icinga-users] web API filtering

Michael Friedrich Michael.Friedrich at netways.de
Wed Aug 10 09:09:46 CEST 2016


> On 09 Aug 2016, at 15:59, Seth Galitzer <sgsax at ksu.edu> wrote:
>
> It's the Icinga 2 REST API I'm looking at, reading chapter 11 of the docs. Sorry for not being clearer on that point. Is there an outline somewhere of each of the object properties so I can choose appropriate fields to filter on? The filter builder shows me things like "host_problem" and "host_acknowledged". I know the first is not an object property I've seen before, and I assume the second is not. But if I knew what to look for, I could add appropriate fields to the attrs and joins lists for queries.

Now you’re mixing the Icinga 2 API with the Icinga Web 2 query editor.

In terms of the Icinga 2 you may query all object attributes described in the “Object Types” chapter. Those can also be used to build your own filter - manually on the command line or in a programmatic fashion in your scripts.
http://docs.icinga.org/icinga2/latest/doc/module/icinga2/toc#!/icinga2/latest/doc/module/icinga2/chapter/icinga2-api#icinga2-api-config-objects-query

“A list of all available configuration types is available in the object types chapter.”

-> http://docs.icinga.org/icinga2/latest/doc/module/icinga2/toc#!/icinga2/latest/doc/module/icinga2/chapter/object-types#object-types

The best and easiest way is to query /v1/objects/hosts without any attribute filters for example, and gain insights what’s possible and what’s not possible. Accompanied by reading the documentation on simple and advanced filters.

Kind regards,
Michael

>
> Thanks.
> seth
>
> On 08/08/2016 11:16 PM, Michael Friedrich wrote:
>>
>>> On 08 Aug 2016, at 22:45, Seth Galitzer <sgsax at ksu.edu> wrote:
>>>
>>> I've been looking through documentation and list archives but have not found how to do this yet. I want to be able to query the API for host and/or service problems, but filter out any that have been acknowledged. ie only show problem states for hosts/services that have not been ack'd yet. How should I do this? And is there any other reference documentation specifically for the API other than what is on docs.icinga.org?
>>
>> Which API are you referring to?
>>
>> In case you’d want to use the Icinga Web 2 API, just use the filter editor to create an appropriate filtered list and then choose json output.
>>
>> In case you’d go for the Icinga 2 Core API, docs.icinga.org/icinga2/latest - chapter 9.
>>
>> Kind regards,
>> Michael
>>
>>>
>>> Thanks.
>>> Seth
>>>
>>> --
>>> Seth Galitzer
>>> Systems Coordinator
>>> Computing and Information Sciences
>>> Kansas State University
>>> http://www.cis.ksu.edu/~sgsax
>>> sgsax at ksu.edu
>>> 785-532-7790
>>> _______________________________________________
>>> icinga-users mailing list
>>> icinga-users at lists.icinga.org
>>> https://lists.icinga.org/mailman/listinfo/icinga-users
>>
>>
>> -- 
>> Michael Friedrich, DI (FH)
>> Senior Developer
>>
>> NETWAYS GmbH | Deutschherrnstr. 15-19 | D-90429 Nuernberg
>> Tel: +49 911 92885-0 | Fax: +49 911 92885-77
>> CEO: Julian Hein, Bernd Erk | AG Nuernberg HRB18461
>> http://www.netways.de | Michael.Friedrich at netways.de
>>
>> ** OSBConf 2016 - September - osbconf.org **
>> ** OSMC 2016 - November - netways.de/osmc **
>> _______________________________________________
>> icinga-users mailing list
>> icinga-users at lists.icinga.org
>> https://lists.icinga.org/mailman/listinfo/icinga-users
>>
>
> --
> Seth Galitzer
> Systems Coordinator
> Computing and Information Sciences
> Kansas State University
> http://www.cis.ksu.edu/~sgsax
> sgsax at ksu.edu
> 785-532-7790
> _______________________________________________
> icinga-users mailing list
> icinga-users at lists.icinga.org
> https://lists.icinga.org/mailman/listinfo/icinga-users


-- 
Michael Friedrich, DI (FH)
Senior Developer

NETWAYS GmbH | Deutschherrnstr. 15-19 | D-90429 Nuernberg
Tel: +49 911 92885-0 | Fax: +49 911 92885-77
CEO: Julian Hein, Bernd Erk | AG Nuernberg HRB18461
http://www.netways.de | Michael.Friedrich at netways.de

** OSBConf 2016 - September - osbconf.org **
** OSMC 2016 - November - netways.de/osmc **


More information about the icinga-users mailing list