Hello,
I’m working on a Perl Script which use the Icinga2 API to query information about all monitored Hosts.
The Script should list all monitored Host IPs of a specific VLAN. So i will be able check which of my Hosts aren’t monitored yet.
I wonder if there is a way to get all those Host IPs listed.
Does anyone already implemented that?
Have you had a look a the docs already?
The parts about the API are pretty good imo, and more or less show you everything you need for basic queries with some filters. You just have to adapt the examples to what you want.
What you need is a query for hosts with attributes name and address and a filter to the hosts addresses belonging to that VLAN.
Just to add one more to @log1c quite good hints. Depending on if you can get the information of the matching VLAN for the host already based on existing fields or not, looking at cidr_match for the filter could be a good idea.