06-17-2025 06:58 AM
Is there a optimal way of querying the NBI to find endStation data under a network CIDR? I can successfully query individual addresses with the query below so expect I could iterate through each IP address inside the CIDR but that seems inefficient. Can the NBI take inputs somehow with an actual CIDR or worst case, string wildcards? So far I haven't found anything in documentation for a non-iterative way.
I am primarily interested in mac and last seen data. Example query for a single IP (i.e. 192.168.10.100) that I am trying to implment over a whole CIDR (i.e. 192.168.10.0/24).
query = {
accessControl {
endSystemByIp(ipAddress: "192.168.10.100") {
endSystem {
macAddress
ipAddress
operatingSystemName
hostName
lastSeenTime
}
}
}
}
Solved! Go to Solution.
06-23-2025 05:26 AM
The NBI is meant for scripting so the idea here is to get all end systems and iterate over that using a script. I dont see an option to filter based on a subnet.
06-23-2025 05:26 AM
The NBI is meant for scripting so the idea here is to get all end systems and iterate over that using a script. I dont see an option to filter based on a subnet.
06-25-2025 04:54 AM
Thanks for the response, and verifying I didn't just miss a CIDR filter option. I had looked at getting all end systems and processing them in my code but we have around 125k end systems currently (school is out at the moment so that is low). Doing a big batch get with paging overhead then getting it down to a subset of ~512 or smaller endpoints seemed just as inefficient as calling each IP address directly. I wish there was an option to make a CIDR or at the very least wildcard address query happen.