diff --git a/kea_exporter/kea_http_exporter.py b/kea_exporter/kea_http_exporter.py index 11eebb4..39ed7de 100644 --- a/kea_exporter/kea_http_exporter.py +++ b/kea_exporter/kea_http_exporter.py @@ -46,8 +46,22 @@ def load_subnets(self): for module in config: for subnet in module.get("arguments", {}).get("Dhcp4", {}).get("subnet4", {}): self.subnets.update({subnet["id"]: subnet}) + self.subnets.update( + { + subnet["id"]: subnet + for shared_network in self.config["Dhcp4"].get("shared-networks", []) + for subnet in shared_network["subnet4"] + } + ) for subnet in module.get("arguments", {}).get("Dhcp6", {}).get("subnet6", {}): self.subnets6.update({subnet["id"]: subnet}) + self.subnets.update( + { + subnet["id"]: subnet + for shared_network in self.config["Dhcp6"].get("shared-networks", []) + for subnet in shared_network["subnet6"] + } + ) def update(self): # Reload subnets on update in case of configurational update diff --git a/kea_exporter/kea_socket_exporter.py b/kea_exporter/kea_socket_exporter.py index ec89e62..0f2a399 100644 --- a/kea_exporter/kea_socket_exporter.py +++ b/kea_exporter/kea_socket_exporter.py @@ -56,9 +56,19 @@ def reload(self): if "Dhcp4" in self.config: self.dhcp_version = BaseExporter.DHCPVersion.DHCP4 subnets = self.config["Dhcp4"]["subnet4"] + subnets += [ + subnet + for shared_network in self.config["Dhcp4"].get("shared-networks", []) + for subnet in shared_network["subnet4"] + ] elif "Dhcp6" in self.config: self.dhcp_version = BaseExporter.DHCPVersion.DHCP6 subnets = self.config["Dhcp6"]["subnet6"] + subnets += [ + subnet + for shared_network in self.config["Dhcp6"].get("shared-networks", []) + for subnet in shared_network["subnet6"] + ] else: click.echo( f"Socket {self.sock_path} has no supported configuration",