diff --git a/keep/providers/zabbix_provider/zabbix_provider.py b/keep/providers/zabbix_provider/zabbix_provider.py index 5b00a3977..10caa2d4a 100644 --- a/keep/providers/zabbix_provider/zabbix_provider.py +++ b/keep/providers/zabbix_provider/zabbix_provider.py @@ -335,9 +335,26 @@ def __send_request(self, method: str, params: dict = None): response = requests.post(url, json=data, headers=headers) - response.raise_for_status() + try: + response.raise_for_status() + except requests.HTTPError: + self.logger.exception( + "Error while sending request to Zabbix API", + extra={ + "response": response.text, + "tenant_id": self.context_manager.tenant_id, + }, + ) + raise response_json = response.json() if "error" in response_json: + self.logger.error( + "Error while querying zabbix", + extra={ + "tenant_id": self.context_manager.tenant_id, + "response_json": response_json, + }, + ) raise ProviderMethodException(response_json.get("error", {}).get("data")) return response_json