Skip to main content

Webhook

In addition to built-in notification integrations like Slack, Microsoft Teams, Pagerduty, and Opsgenie, Coroot can integrate with nearly any system using Webhooks.

To configure a Webhook integration:

  • Go to the Project SettingsIntegrations
  • Create a Webhook integration
  • Paste a Webhook URL to the form Coroot Webhook integration
  • Configure HTTP basic authentication and headers if required.
  • Define templates for incidents, deployments, and alerts.
  • Send a test alert to check the integration.

Template data

Notification templates are based on the Go templating system. Coroot applies provided templates to the following data structures:

type IncidentTemplateValues struct {
Status string // OK, WARNING, CRITICAL
Application struct {
Namespace string
Kind string
Name string
}
Reports []struct {
Name string // SLO, CPU, Memory, Net, ...
Check string // Availability, Latency, Memory leak, ...
Message string // "error budget burn rate is 26x within 1 hour", "app containers have been restarted 11 times by the OOM killer", ...
}
URL string // backlink to the incident page
}
type DeploymentTemplateValues struct {
Status string // Deployed, Cancelled, Stuck
Application struct {
Namespace string
Kind string
Name string
}
Version string // deployed application version
Summary []string // "Availability: 87% (objective: 99%)", "CPU usage: +21% (+$37/mo)", "Memory: a memory leak detected", ...
URL string // backlink to the deployment page
}
type AlertTemplateValues struct {
Status string // OK, WARNING, CRITICAL
ProjectName string // project name, e.g. "production"
Application struct {
Namespace string
Kind string
Name string
}
RuleName string // alerting rule name, e.g. "Low disk space"
Severity string // warning, critical
Summary string // human-readable description, e.g. "disk space is low on /dev/sda1 (12% free)"
Details []struct {
Name string // detail label, e.g. "Log pattern"
Value string // detail value
}
Duration string // how long the alert was active, e.g. "5m30s", "1h30m" (only set for resolved alerts)
ResolvedBy string // who resolved the alert (only set for manually resolved or suppressed alerts)
URL string // backlink to the alert page
}

Examples

If you want to customize the message format, you can utilize Go templating syntax to modify alert or deployment notifications based on the provided data structure. Below are sample templates you can use as examples.

Incident template:

{{- if eq .Status `OK` }}
{{ .Application.Name }}@{{ .Application.Namespace }} incident resolved
{{- else }}
{{ .Status }} {{ .Application.Name }}@{{ .Application.Namespace }} is not meeting its SLOs
{{- end }}
{{- range .Reports }}
• *{{ .Name }}* / {{ .Check }}: {{ .Message }}
{{- end }}
{{ .URL }}

Deployment template:

Deployment of {{ .Application.Name }}@{{ .Application.Namespace }}
*Status*: {{ .Status }}
*Version*: {{ .Version }}
{{- if .Summary }}
*Summary*:
{{- range .Summary }}
• {{ . }}
{{- end }}
{{- end }}
{{ .URL }}

Alert template:

{{- if eq .Status `OK` }}
[RESOLVED] {{ .RuleName }}: {{ .Application.Name }}@{{ .Application.Namespace }}
{{- else }}
[{{ .Status }}] {{ .RuleName }}: {{ .Application.Name }}@{{ .Application.Namespace }}
{{- end }}
{{ .Summary }}
{{- range .Details }}
• {{ .Name }}: {{ .Value }}
{{- end }}
{{ .URL }}
Looking for 24/7 support from the Coroot team? Subscribe to Coroot Enterprise:Start free trial