Integrations
Grafana

Connect with Grafana

Complete these steps to set up a webhook in Grafana:

  1. Log in to your Grafana instance.

  2. Navigate to Alerting > Contact points.

  3. Click "New contact point".

  4. Give your contact point a name (e.g., "Small Hours").

  5. For "Contact point type", select "Webhook".

  6. In the "URL" field, enter:

    https://<service_id>:<api_key>@api.smallhours.dev/v1/investigate

    Replace <service_id> and <api_key> with your actual Small Hours credentials.

  7. Set the HTTP method to POST.

  8. In the "HTTP Headers" section, add a header:

    • Key: Content-Type
    • Value: application/json
  9. In the "Message" section, you can customize the JSON payload. Here's an example:

    {
      "alert": "{{ .CommonLabels.alertname }}",
      "status": "{{ .Status }}",
      "description": "{{ .CommonAnnotations.description }}",
      "labels": {{ toJson .CommonLabels }},
      "annotations": {{ toJson .CommonAnnotations }}
    }
  10. Click "Test" to ensure the webhook is working correctly.

  11. Save your contact point configuration.

Connecting the webhook to an alert rule:

  1. Go to Alerting > Alert rules.

  2. Create a new alert rule or edit an existing one.

  3. In the "Notifications" section of the alert rule, select the contact point you created earlier.

  4. Save your alert rule.

Grafana will now send alert data to Small Hours when the conditions are met. The more detailed information you include in your alert rules and webhook payload, the more accurately Small Hours can analyze and debug issues.