diff --git a/main.py b/main.py index b2a781a..89e5dc8 100644 --- a/main.py +++ b/main.py @@ -189,6 +189,12 @@ async def _collect_instance(inst) -> dict | None: except Exception as e: errors.append(f"agents: {e}") + protection_groups = [] + try: + protection_groups = await client.fetch_protection_groups() + except Exception as e: + errors.append(f"protection groups: {e}") + try: agent_policies = await client.fetch_agent_policies() except Exception as e: @@ -297,6 +303,7 @@ async def _collect_instance(inst) -> dict | None: "alarms": alarms_data, "agents": agents_data, "agent_policies": agent_policies, + "protection_groups": protection_groups, "restore_points": restore_points[:50] if restore_points else [], } @@ -321,6 +328,7 @@ async def _collect_instance(inst) -> dict | None: "alarms": [], "agents": [], "agent_policies": [], + "protection_groups": [], "restore_points": [], } return error_result diff --git a/veeam_client.py b/veeam_client.py index a72385f..592f161 100644 --- a/veeam_client.py +++ b/veeam_client.py @@ -278,7 +278,10 @@ class VeeamClient: async def fetch_alarms(self) -> list[dict]: if self._is_v12(): - return await self._fetch_json_list("/api/v1/alarms") + try: + return await self._fetch_json_list("/api/v1/alarms") + except Exception: + return [] return [] async def fetch_backup_servers(self) -> list[dict]: @@ -291,6 +294,11 @@ class VeeamClient: return await self._fetch_json_list("/api/v1/agents/protectedComputers") return [] + async def fetch_protection_groups(self) -> list[dict]: + if self._is_v12(): + return await self._fetch_json_list("/api/v1/agents/protectionGroups") + return [] + async def fetch_agent_policies(self) -> list[dict]: if self._is_v12(): seen: set[str] = set() @@ -336,7 +344,7 @@ class VeeamClient: ] for t in backup_types: try: - items = await self._fetch_json_list(f"/api/v1/backups?typeFilter={t}") + items = await self._fetch_json_list(f"/api/v1/backups?jobTypeFilter={t}") for b in items: bid = b.get("id") or b.get("Id") or "" if bid and bid not in seen: