diff --git a/awx/main/notifications/grafana_backend.py b/awx/main/notifications/grafana_backend.py index 153b004a5e..b9a2cbbc1e 100644 --- a/awx/main/notifications/grafana_backend.py +++ b/awx/main/notifications/grafana_backend.py @@ -53,8 +53,8 @@ class GrafanaBackend(AWXBaseEmailBackend, CustomNotificationBase): ): super(GrafanaBackend, self).__init__(fail_silently=fail_silently) self.grafana_key = grafana_key - self.dashboardId = int(dashboardId) if dashboardId is not None else None - self.panelId = int(panelId) if panelId is not None else None + self.dashboardId = int(dashboardId) if dashboardId is not None and panelId != "" else None + self.panelId = int(panelId) if panelId is not None and panelId != "" else None self.annotation_tags = annotation_tags if annotation_tags is not None else [] self.grafana_no_verify_ssl = grafana_no_verify_ssl self.isRegion = isRegion @@ -97,6 +97,7 @@ class GrafanaBackend(AWXBaseEmailBackend, CustomNotificationBase): r = requests.post( "{}/api/annotations".format(m.recipients()[0]), json=grafana_data, headers=grafana_headers, verify=(not self.grafana_no_verify_ssl) ) + if r.status_code >= 400: logger.error(smart_str(_("Error sending notification grafana: {}").format(r.status_code))) if not self.fail_silently: