Grafana OnCall engine fork — self-hosted on-call scheduler and alert router
Find a file
Ben Sully e36757b293
Allow non-JSON custom webhook templates, provided they render as valid JSON (#639)
* Allow non-JSON custom webhook templates, provided they render as valid JSON

Previously, both the provided template _and_ the rendered template had
to be valid JSON in order for validation to pass. This was unnecessarily
restrictive: really, only the rendered template needs to be valid JSON.
It also disallowed using templates such as:

    {
      "labels": {{ alert_payload.labels | tojson }}
    }

even though this would be valid JSON after rendering.

This commit relaxes the validation of custom webhook templates so that
they don't need to be valid JSON, provided that the rendered template
_is_ valid JSON. This is checked using a dummy dictionary of render
params, which use a constant string for the `alert_group_id` field
and a `defaultdict(dict)` for the `alert_payload` field. This should
permit templates like the one above, but still deny templates such as

    {
      "labels": {{ alert_payload.labels }}
    }

which would otherwise fail later if `labels` is not valid JSON.

This should resolve #638.

* Use defaultdict(str) instead of defaultdict(lambda: "")

* Add missing comment to resolution note validation code

* Update validation of resolution notes in public API, too

* Add extra test cases for JSON webhook templates endpoint of public API
2022-10-19 12:32:21 +01:00
.github Add simple pull request template 2022-10-12 09:36:58 -06:00
docs Feat 549 - add telegram permalink to alert groups http response (#551) 2022-09-28 16:59:57 +02:00
engine Allow non-JSON custom webhook templates, provided they render as valid JSON (#639) 2022-10-19 12:32:21 +01:00
examples/terraform Terraform examples 2022-08-11 14:32:39 +05:00
grafana-plugin update 2022-10-13 15:05:36 +03:00
helm Merge pull request #623 from grafana/disable-autorestarts 2022-10-18 09:42:05 +08:00
tools PagerDuty migrator minor improvements (#659) 2022-10-18 15:32:07 +01:00
.dockerignore docker-compose polish 2022-06-10 00:18:17 +03:00
.drone.yml drone sign 2022-09-05 12:50:58 +01:00
.env.dev.example Simplify README.md commands (#578) 2022-09-29 13:06:33 +01:00
.gitignore Allow multiple database and celery broker types (#582) 2022-10-04 09:25:53 +01:00
.pre-commit-config.yaml World, meet OnCall! 2022-06-03 08:09:47 -06:00
CHANGELOG.md Update CHANGELOG.md 2022-10-05 14:55:33 -03:00
CODE_OF_CONDUCT.md Updated GOVERNANCE, added Code Of Conduct 2022-06-06 21:54:15 +03:00
DEVELOPER.md Add details about Makefile to DEVELOPER.md 2022-10-17 10:45:49 -03:00
docker-compose-developer-pg.yml Update docker-compose version to 3.8 (#577) 2022-09-29 14:09:29 +03:00
docker-compose-developer.yml Update docker-compose version to 3.8 (#577) 2022-09-29 14:09:29 +03:00
docker-compose.yml Simplify README.md commands (#578) 2022-09-29 13:06:33 +01:00
GOVERNANCE.md Minor README and GOVERNANCE updates 2022-06-13 17:31:32 -03:00
LICENSE World, meet OnCall! 2022-06-03 08:09:47 -06:00
LICENSING.md Making LICENSING.md more explicit 2022-06-03 16:21:26 +02:00
MAINTAINERS.md Update maintainers.md 2022-06-22 15:04:21 -07:00
Makefile Run migrate before run 2022-10-11 17:06:19 -03:00
README.md Simplify README.md commands (#578) 2022-09-29 13:06:33 +01:00
screenshot.png Merge dev to main (#54) 2022-06-13 16:39:58 -06:00
SECURITY.md World, meet OnCall! 2022-06-03 08:09:47 -06:00

Latest Release License Docker Pulls Slack Discussion Build Status

Developer-friendly incident response with brilliant Slack integration.

  • Collect and analyze alerts from multiple monitoring systems
  • On-call rotations based on schedules
  • Automatic escalations
  • Phone calls, SMS, Slack, Telegram notifications

Getting Started

We prepared multiple environments: production, developer and hobby:

  1. Download docker-compose.yaml:
curl -fsSL https://raw.githubusercontent.com/grafana/oncall/dev/docker-compose.yml -o docker-compose.yml
  1. Set variables:
echo "DOMAIN=http://localhost:8080
COMPOSE_PROFILES=with_grafana  # Remove this line if you want to use existing grafana
SECRET_KEY=my_random_secret_must_be_more_than_32_characters_long
RABBITMQ_PASSWORD=rabbitmq_secret_pw
MYSQL_PASSWORD=mysql_secret_pw" > .env
  1. Launch services:
docker-compose up -d
  1. Issue one-time invite token:
docker-compose run engine python manage.py issue_invite_for_the_frontend --override

Note: if you remove the plugin configuration and reconfigure it, you will need to generate a new one-time invite token for your new configuration.

  1. Go to OnCall Plugin Configuration, using log in credentials as defined above: admin/admin (or find OnCall plugin in configuration->plugins) and connect OnCall plugin with OnCall backend:
Invite token: ^^^ from the previous step.
OnCall backend URL: http://engine:8080
Grafana Url: http://grafana:3000
  1. Enjoy! Check our OSS docs if you want to set up Slack, Telegram, Twilio or SMS/calls through Grafana Cloud.

Update version

To update your Grafana OnCall hobby environment:

# Update Docker image
docker-compose pull engine

# Re-deploy
docker-compose up -d

After updating the engine, you'll also need to click the "Update" button on the plugin version page. See Grafana docs for more info on updating Grafana plugins.

Join community

Stargazers over time

Stargazers over time

Further Reading