Merge dev
This commit is contained in:
commit
81702ba52d
61 changed files with 419 additions and 138 deletions
|
|
@ -1,8 +1,15 @@
|
|||
# Change Log
|
||||
|
||||
## v1.0.50 (TBD)
|
||||
## v1.0.51 (TBD)
|
||||
|
||||
- Allow use of API keys as alternative to account auth token for Twilio
|
||||
|
||||
## v1.0.50 (2022-11-03)
|
||||
|
||||
- Updates to documentation
|
||||
- Improvements to web schedules
|
||||
- Bug fixes
|
||||
|
||||
## v1.0.49 (2022-11-01)
|
||||
|
||||
- Enable SMTP email backend by default
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@
|
|||
|
||||
## Developer quickstart
|
||||
|
||||
Related: [How to develop integrations](/engine/config_integrations/README.md)
|
||||
|
||||
### Code style
|
||||
|
||||
- [isort](https://github.com/PyCQA/isort), [black](https://github.com/psf/black) and [flake8](https://github.com/PyCQA/flake8) are used to format backend code
|
||||
|
|
|
|||
|
|
@ -87,5 +87,6 @@ See [Grafana docs](https://grafana.com/docs/grafana/latest/administration/plugin
|
|||
|
||||
- _Migration from the PagerDuty_ - [Migrator](https://github.com/grafana/oncall/tree/dev/tools/pagerduty-migrator)
|
||||
- _Documentation_ - [Grafana OnCall](https://grafana.com/docs/grafana-cloud/oncall/)
|
||||
- _How To Add Integration_ - [How to Add Integration](https://github.com/grafana/oncall/tree/dev/engine/config_integrations/README.md)
|
||||
- _Blog Post_ - [Announcing Grafana OnCall, the easiest way to do on-call management](https://grafana.com/blog/2021/11/09/announcing-grafana-oncall/)
|
||||
- _Presentation_ - [Deep dive into the Grafana, Prometheus, and Alertmanager stack for alerting and on-call management](https://grafana.com/go/observabilitycon/2021/alerting/?pg=blog)
|
||||
|
|
|
|||
|
|
@ -8,4 +8,4 @@ pull:
|
|||
|
||||
.PHONY: docs
|
||||
docs: pull
|
||||
docker run -v '$(shell pwd)/sources:$(CONTENT_PATH):Z' -p $(PORT) --rm -it $(IMAGE)
|
||||
docker run -v '$(shell pwd)/sources:$(CONTENT_PATH):Z' -v '$(shell pwd)/sources:/jugo/content/docs/grafana-cloud/oncall:Z' -p $(PORT) --rm -it $(IMAGE)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
aliases:
|
||||
- /docs/grafana-cloud/oncall/
|
||||
- /docs/oncall/latest/
|
||||
canonical: https://grafana.com/docs/oncall/latest/
|
||||
keywords:
|
||||
- Grafana Cloud
|
||||
- Alerts
|
||||
|
|
@ -11,7 +11,6 @@ keywords:
|
|||
- OnCall
|
||||
- irm
|
||||
title: Grafana OnCall
|
||||
canonical: "https://grafana.com/docs/oncall/latest/"
|
||||
weight: 1000
|
||||
---
|
||||
|
||||
|
|
@ -22,7 +21,7 @@ weight: 1000
|
|||
|
||||
Grafana OnCall is an open source incident response management tool built to help teams improve their collaboration and resolve incidents faster. Some of the core strengths of Grafana OnCall include:
|
||||
|
||||
- **Support for a broad set of monitoring systems:** Grafana OnCall supports integrations with many monitoring systems, including Grafana, Prometheus, AlertManager, Zabbix, and more.
|
||||
- **Support for a broad set of monitoring systems:** Grafana OnCall supports integrations with many monitoring systems, including Grafana, Prometheus, Alertmanager, Zabbix, and more.
|
||||
- **Reduce alert noise:** Automatic alert grouping helps avoid alert storms and reduce noise during incidents. Auto-resolve settings can resolve without human intervention when the resolve conditions are met, enabling you to control alert noise and reduce alert fatigue.
|
||||
- **Automatic escalation to on-call rotations:** Grafana OnCall’s flexible calendar integration allows you to define your on-call rotations while managing on-call schedules in your preferred calendar application with iCal format. Configurable alert escalation automatically escalates alerts to on-call team members, notifies slack channels, and more.
|
||||
- **ChatOps focused:** Grafana OnCall integrates closely with your slack workspace to deliver alert notifications to individuals and groups, making daily alerts more visible and easier to manage.
|
||||
|
|
|
|||
20
docs/sources/alert-behavior/_index.md
Normal file
20
docs/sources/alert-behavior/_index.md
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
---
|
||||
aliases:
|
||||
- /docs/oncall/latest/alert-behavior/
|
||||
canonical: https://grafana.com/docs/oncall/latest/alert-behavior/
|
||||
title: Configure alert behavior for Grafana OnCall
|
||||
weight: 900
|
||||
---
|
||||
|
||||
# Configure alert behavior for Grafana OnCall
|
||||
|
||||
The available alert configurations in Grafana OnCall allow you to define how certain alerts are handled and ensure that alerts are routed, escalated, and grouped to fit your specific alerting needs. Grafana OnCall can receive alerts from any monitoring system that sends alerts via webhook.
|
||||
|
||||
|
||||
## About alert behavior
|
||||
|
||||
Once Grafana OnCall receives an alert, the following occurs, based on the alert content:
|
||||
|
||||
- Default or customized alert templates are applied to deliver the most useful alert fields with the most valuable information, in a readable format.
|
||||
- Alerts are grouped based on your alert grouping configurations, combining similar or related alerts to reduce alert noise.
|
||||
- Alerts automatically resolve if an alert from the monitoring system matches the resolve condition for that alert.
|
||||
|
|
@ -1,18 +1,19 @@
|
|||
---
|
||||
aliases:
|
||||
- /docs/oncall/latest/integrations/create-custom-templates/
|
||||
- ../integrations/create-custom-templates/
|
||||
- /docs/oncall/latest/alert-behavior/alert-templates/
|
||||
canonical: https://grafana.com/docs/oncall/latest/alert-behavior/alert-templates/
|
||||
keywords:
|
||||
- Grafana Cloud
|
||||
- Alerts
|
||||
- Notifications
|
||||
- on-call
|
||||
- Jinja
|
||||
title: Configure alerts in Grafana OnCall
|
||||
canonical: "https://grafana.com/docs/oncall/latest/integrations/create-custom-templates/"
|
||||
title: Configure alert templates
|
||||
weight: 300
|
||||
---
|
||||
|
||||
# Configure alerts in Grafana OnCall
|
||||
# Configure alert templates
|
||||
|
||||
Grafana OnCall can integrate with any monitoring systems that can send alerts using webhooks with JSON payloads. By default, webhooks deliver raw JSON payloads. When Grafana OnCall receives an alert and parses its payload, a default pre configured alert template is applied to modify the alert payload to be more human readable. These alert templates are customizable for any integration.
|
||||
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
---
|
||||
aliases:
|
||||
- /docs/oncall/latest/integrations/configure-outgoing-webhooks/
|
||||
- ../integrations/configure-outgoing-webhooks/
|
||||
- /docs/oncall/latest/alert-behavior/outgoing-webhooks/
|
||||
canonical: https://grafana.com/docs/oncall/latest/alert-behavior/outgoing-webhooks/
|
||||
keywords:
|
||||
- Grafana Cloud
|
||||
- Alerts
|
||||
|
|
@ -9,7 +11,6 @@ keywords:
|
|||
- amixr
|
||||
- webhooks
|
||||
title: Configure outgoing webhooks for Grafana OnCall
|
||||
canonical: "https://grafana.com/docs/oncall/latest/integrations/configure-outgoing-webhooks/"
|
||||
weight: 500
|
||||
---
|
||||
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
aliases:
|
||||
- /docs/oncall/latest/calendar-schedules/
|
||||
canonical: https://grafana.com/docs/oncall/latest/calendar-schedules/
|
||||
description: ""
|
||||
keywords:
|
||||
- Grafana
|
||||
|
|
@ -8,7 +9,6 @@ keywords:
|
|||
- on-call
|
||||
- calendar
|
||||
title: Configure and manage on-call schedules
|
||||
canonical: "https://grafana.com/docs/oncall/latest/calendar-schedules/"
|
||||
weight: 1100
|
||||
---
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
aliases:
|
||||
- /docs/oncall/latest/configure-user-settings/
|
||||
canonical: https://grafana.com/docs/oncall/latest/configure-user-setting/
|
||||
keywords:
|
||||
- Grafana Cloud
|
||||
- Alerts
|
||||
|
|
@ -10,7 +11,6 @@ keywords:
|
|||
- oncall
|
||||
- integrations
|
||||
title: Manage users and teams for Grafana OnCall
|
||||
canonical: "https://grafana.com/docs/oncall/latest/configure-user-setting/"
|
||||
weight: 1300
|
||||
---
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,12 @@
|
|||
---
|
||||
title: Configure escalation chains and routes for Grafana OnCall
|
||||
weight: 700
|
||||
canonical: "https://grafana.com/docs/oncall/latest/escalation-policies/"
|
||||
aliases:
|
||||
- /docs/oncall/latest/chat-options/escalation-policies/
|
||||
- /docs/oncall/latest/escalation-policies/
|
||||
canonical: https://grafana.com/docs/oncall/latest/escalation-policies/
|
||||
title: Escalation Chains and Routes
|
||||
weight: 700
|
||||
---
|
||||
|
||||
|
||||
# Configure escalation chains and routes for Grafana OnCall
|
||||
# Escalation Chains and Routes
|
||||
|
||||
Escalation chains and routes for Grafana OnCall
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
aliases:
|
||||
- /docs/oncall/latest/escalation-policies/configure-escalation-chains/
|
||||
canonical: https://grafana.com/docs/oncall/latest/escalation-policies/configure-escalation-chains/
|
||||
keywords:
|
||||
- Grafana Cloud
|
||||
- Alerts
|
||||
|
|
@ -10,7 +11,6 @@ keywords:
|
|||
- oncall
|
||||
- integrations
|
||||
title: Configure and manage Escalation Chains
|
||||
canonical: "https://grafana.com/docs/oncall/latest/escalation-policies/configure-escalation-chains/"
|
||||
weight: 100
|
||||
---
|
||||
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
aliases:
|
||||
- /docs/oncall/latest/escalation-policies/configure-routes/
|
||||
canonical: https://grafana.com/docs/oncall/latest/escalation-policies/configure-routes/
|
||||
keywords:
|
||||
- Grafana Cloud
|
||||
- Alerts
|
||||
|
|
@ -10,11 +11,10 @@ keywords:
|
|||
- oncall
|
||||
- integrations
|
||||
title: Configure and manage routes
|
||||
canonical: "https://grafana.com/docs/oncall/latest/escalation-policies/configure-routes/"
|
||||
weight: 300
|
||||
---
|
||||
|
||||
# Configure and manage routes
|
||||
# Configure and manage Routes
|
||||
|
||||
Set up escalation chains and routes to configure escalation behavior for alert group notifications.
|
||||
|
||||
|
|
@ -1,13 +1,13 @@
|
|||
---
|
||||
aliases:
|
||||
- /docs/grafana-cloud/oncall/getting-started/
|
||||
- /docs/oncall/latest/getting-started/
|
||||
- /docs/oncall/latest/get-started/
|
||||
- /getting-started/
|
||||
canonical: https://grafana.com/docs/oncall/latest/get-started/
|
||||
keywords:
|
||||
- Get started
|
||||
- On call
|
||||
- Grafana Cloud
|
||||
title: Get started with Grafana OnCall
|
||||
canonical: "https://grafana.com/docs/oncall/latest/getting-started/"
|
||||
weight: 300
|
||||
---
|
||||
|
||||
|
|
@ -59,7 +59,7 @@ Regardless of where your alerts originate, you can send them to Grafana OnCall v
|
|||
2. Explore the alert by clicking on the title of the alert.
|
||||
3. Acknowledge and resolve the test alert.
|
||||
|
||||
For more information on Grafana OnCall integrations and further configuration guidance, refer to, [Connect to Grafana OnCall]({{< relref "../integrations" >}})
|
||||
For more information on Grafana OnCall integrations and further configuration guidance, refer to, [Grafana OnCall integrations]({{< relref "../integrations" >}})
|
||||
|
||||
|
||||
### Configure Escalation Chains
|
||||
|
|
@ -105,7 +105,7 @@ To configure Slack for Grafana OnCall:
|
|||
5. Click Allow to allow Grafana OnCall to access Slack.
|
||||
6. Ensure users verify their Slack accounts in their user profile in Grafana OnCall.
|
||||
|
||||
For further instruction on connecting to your Slack workspace, refer to [Connect Slack to Grafana OnCall]({{< relref "../chat-options/configure-slack" >}})
|
||||
For further instruction on connecting to your Slack workspace, refer to [Slack integration for Grafana OnCall]({{< relref "../integrations/chatops-integrations/configure-slack/" >}})
|
||||
|
||||
|
||||
### Add your on-call schedule
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
aliases:
|
||||
- /docs/grafana-cloud/oncall/integrations/
|
||||
- /docs/oncall/latest/integrations/
|
||||
canonical: https://grafana.com/docs/oncall/latest/integrations/
|
||||
keywords:
|
||||
- Grafana Cloud
|
||||
- Alerts
|
||||
|
|
@ -10,12 +10,11 @@ keywords:
|
|||
- amixr
|
||||
- oncall
|
||||
- integrations
|
||||
title: Connect to Grafana OnCall
|
||||
canonical: "https://grafana.com/docs/oncall/latest/integrations/"
|
||||
title: Grafana OnCall integrations
|
||||
weight: 500
|
||||
---
|
||||
|
||||
# Connect to Grafana OnCall
|
||||
# Grafana OnCall integrations
|
||||
|
||||
Integrations allow you to connect monitoring systems of your choice to send alerts to Grafana OnCall. Regardless of where your alerts originate, you can configure alerts to be sent to Grafana OnCall for alert escalation and notification. Grafana OnCall receives alerts in JSON format via a POST request, OnCall then parses alert data using preconfigured alert templates to determine alert grouping, apply routes, and determine correct escalation.
|
||||
|
||||
|
|
@ -53,7 +52,7 @@ To customize alert grouping for an integration:
|
|||
2. Select **Alert Behavior** from the dropdown menu next to **Edit template for**.
|
||||
3. Edit the **grouping id**, **acknowledge condition**, and **resolve condition** templates as needed to customize your alert behavior.
|
||||
|
||||
For more information on alert templates, see [Configure alerts in Grafana OnCall]({{< relref "create-custom-templates/" >}})
|
||||
For more information on alert templates, see [Configure alerts templates]({{< relref "../alert-behavior/alert-templates" >}})
|
||||
|
||||
#### Add Routes
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
aliases:
|
||||
- /docs/grafana-cloud/oncall/integrations/add-integration/
|
||||
- /docs/oncall/latest/integrations/available-integrations/
|
||||
canonical: https://grafana.com/docs/oncall/latest/integrations/available-integrations/
|
||||
keywords:
|
||||
- Grafana Cloud
|
||||
- Alerts
|
||||
|
|
@ -10,15 +10,14 @@ keywords:
|
|||
- Alertmanager
|
||||
- Prometheus
|
||||
title: Currently available integrations for Grafana OnCall
|
||||
canonical: "https://grafana.com/docs/oncall/latest/integrations/available-integrations/"
|
||||
weight: 100
|
||||
---
|
||||
|
||||
# Currently available integrations
|
||||
# Available integrations
|
||||
|
||||
Grafana OnCall can connect directly to the monitoring services where your alerts originate. All currently available integrations are listed in the Grafana OnCall **Create Integration** section.
|
||||
|
||||
If the integration you're looking for isn't currently listed, see [Configure Webhook integrations for Grafana OnCall]({{< relref "../add-webhook-integration/" >}}) to integration your monitoring system with Grafana OnCall.
|
||||
If the integration you're looking for isn't currently listed, see [Webhook integrations for Grafana OnCall]({{< relref "../available-integrations/configure-webhook" >}}) to integration your monitoring system with Grafana OnCall.
|
||||
|
||||
> **Note:** Some integrations are available for Grafana Cloud instances only. See individual integration guides for more information.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
---
|
||||
aliases:
|
||||
- /docs/grafana-cloud/oncall/available-integrations/add-alertmanager/
|
||||
- /docs/oncall/latest/integrations/available-integrations /add-alertmanager/
|
||||
- add-alertmanager/
|
||||
- /docs/oncall/latest/integrations/available-integrations/configure-alertmanager/
|
||||
canonical: https://grafana.com/docs/oncall/latest/integrations/available-integrations/configure-alertmanager/
|
||||
keywords:
|
||||
- Grafana Cloud
|
||||
- Alerts
|
||||
|
|
@ -9,12 +10,11 @@ keywords:
|
|||
- on-call
|
||||
- Alertmanager
|
||||
- Prometheus
|
||||
title: Connect Alertmanager to Grafana OnCall
|
||||
canonical: "https://grafana.com/docs/oncall/latest/integrations/available-integrations/add-alertmanager/"
|
||||
title: Alertmanager integration for Grafana OnCall
|
||||
weight: 300
|
||||
---
|
||||
|
||||
# Connect Alertmanager to Grafana OnCall
|
||||
# Alertmanager integration for Grafana OnCall
|
||||
|
||||
The Alertmanager integration for Grafana OnCall handles alerts sent by client applications such as the Prometheus server.
|
||||
|
||||
|
|
@ -1,19 +1,19 @@
|
|||
---
|
||||
aliases:
|
||||
- /docs/grafana-cloud/oncall/integrations/add-grafana-alerting/
|
||||
- /docs/oncall/latest/integrations/available-integrations /add-grafana-alerting/
|
||||
- add-grafana-alerting/
|
||||
- /docs/oncall/latest/integrations/available-integrations/configure-grafana-alerting/
|
||||
canonical: https://grafana.com/docs/oncall/latest/integrations/available-integrations/configure-grafana-alerting/
|
||||
keywords:
|
||||
- Grafana Cloud
|
||||
- Alerts
|
||||
- Notifications
|
||||
- on-call
|
||||
- Prometheus
|
||||
title: Connect Grafana Alerting to Grafana OnCall
|
||||
canonical: "https://grafana.com/docs/oncall/latest/integrations/available-integrations/add-grafana-alerting/"
|
||||
title: Grafana Alerting integration for Grafana OnCall
|
||||
weight: 100
|
||||
---
|
||||
|
||||
# Connect Grafana Alerting to Grafana OnCall
|
||||
# Grafana Alerting integration for Grafana OnCall
|
||||
|
||||
Grafana Alerting for Grafana OnCall can be set up using two methods:
|
||||
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
---
|
||||
aliases:
|
||||
- /docs/oncall/latest/integrations/add-webhook-integration/
|
||||
- ../add-webhook-integration/
|
||||
- /docs/oncall/latest/integrations/available-integrations/configure-webhook/
|
||||
canonical: https://grafana.com/docs/oncall/latest/integrations/available-integrations/configure-webhook/
|
||||
keywords:
|
||||
- Grafana Cloud
|
||||
- Alerts
|
||||
|
|
@ -9,11 +11,10 @@ keywords:
|
|||
- Alertmanager
|
||||
- Prometheus
|
||||
title: Webhook integration for Grafana OnCall
|
||||
canonical: "https://grafana.com/docs/oncall/latest/integrations/add-webhook-integration/"
|
||||
weight: 700
|
||||
---
|
||||
|
||||
# Configure Webhook integrations for Grafana OnCall
|
||||
# Webhook integrations for Grafana OnCall
|
||||
|
||||
Grafana OnCall directly supports many integrations, those that aren’t currently listed in the Integrations menu can be connected using the webhook integration and configured alert templates.
|
||||
|
||||
|
|
@ -56,4 +57,4 @@ For example:
|
|||
}'
|
||||
```
|
||||
|
||||
To learn how to use custom alert templates for formatted webhooks, see [Configure alerts in Grafana OnCall]({{< relref "../integrations/create-custom-templates/" >}}).
|
||||
To learn how to use custom alert templates for formatted webhooks, see [Configure alerts templates]({{< relref "../../../alert-behavior/alert-templates/" >}}).
|
||||
|
|
@ -1,18 +1,19 @@
|
|||
---
|
||||
aliases:
|
||||
- /docs/oncall/latest/integrations/available-integrations /add-zabbix/
|
||||
- add-zabbix/
|
||||
- /docs/oncall/latest/integrations/available-integrations/configure-zabbix/
|
||||
canonical: https://grafana.com/docs/oncall/latest/integrations/available-integrations/configure-zabbix/
|
||||
keywords:
|
||||
- Grafana Cloud
|
||||
- Alerts
|
||||
- Notifications
|
||||
- on-call
|
||||
- Zabbix
|
||||
title: Connect Zabbix to Grafana OnCall
|
||||
canonical: "https://grafana.com/docs/oncall/latest/integrations/available-integrations/add-zabbix/"
|
||||
title: Zabbix integration for Grafana OnCall
|
||||
weight: 500
|
||||
---
|
||||
|
||||
# Connect Zabbix to Grafana OnCall
|
||||
# Zabbix integration for Grafana OnCall
|
||||
|
||||
Zabbix is an open-source monitoring software tool for diverse IT components, including networks, servers, virtual machines, and cloud services. Zabbix provides monitoring for metrics such as network utilization, CPU load, and disk space consumption.
|
||||
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
---
|
||||
aliases:
|
||||
- /docs/oncall/latest/chat-options/
|
||||
- ../chat-options/
|
||||
- /docs/oncall/latest/integrations/chatops-integrations/
|
||||
canonical: https://grafana.com/docs/oncall/latest/integrations/chatops-integrations/
|
||||
keywords:
|
||||
- Grafana Cloud
|
||||
- Alerts
|
||||
|
|
@ -9,14 +11,13 @@ keywords:
|
|||
- amixr
|
||||
- oncall
|
||||
- slack
|
||||
title: Connect ChatOps to Grafana OnCall
|
||||
canonical: "https://grafana.com/docs/oncall/latest/chat-options/"
|
||||
weight: 900
|
||||
title: Available ChatOps integrations
|
||||
weight: 300
|
||||
---
|
||||
|
||||
# Connect ChatOps to Grafana OnCall
|
||||
# Available ChatOps integrations
|
||||
|
||||
Grafana OnCall directly supports the export of alert notifications to some popular messaging applications like Slack and Telegram. You can use outgoing webhooks to applications that aren't directly supported. For information on configuring outgoing webhooks, see [Send alert group notifications by webhook]({{< relref "../integrations/configure-outgoing-webhooks.md" >}}).
|
||||
Grafana OnCall directly supports the export of alert notifications to some popular messaging applications like Slack and Telegram. You can use outgoing webhooks to applications that aren't directly supported. For information on configuring outgoing webhooks, see [Send alert group notifications by webhook]({{< relref "../../alert-behavior/outgoing-webhooks/" >}}).
|
||||
|
||||
To configure supported messaging apps, see the following topics:
|
||||
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
---
|
||||
aliases:
|
||||
- /docs/oncall/latest/chat-options/configure-slack/
|
||||
- ../../chat-options/configure-slack/
|
||||
- /docs/oncall/latest/integrations/chatops-integrations/configure-slack/
|
||||
canonical: https://grafana.com/docs/oncall/latest/integrations/chatops-integrations/configure-slack/
|
||||
keywords:
|
||||
- Grafana Cloud
|
||||
- Alerts
|
||||
|
|
@ -10,7 +12,6 @@ keywords:
|
|||
- oncall
|
||||
- slack
|
||||
title: Slack integration for Grafana OnCall
|
||||
canonical: "https://grafana.com/docs/oncall/latest/chat-options/configure-slack/"
|
||||
weight: 100
|
||||
---
|
||||
|
||||
|
|
@ -25,7 +26,7 @@ Integrating your Slack workspace with Grafana OnCall allows users and teams to b
|
|||
|
||||
To install the Slack integration, you must have Admin permissions in your Grafana instance as well as the Slack workspace that you’d like to integrate with.
|
||||
|
||||
For Open Source Grafana OnCall Slack installation guidance, refer to [Open Source Grafana OnCall]({{< relref "../open-source" >}}).
|
||||
For Open Source Grafana OnCall Slack installation guidance, refer to [Open Source Grafana OnCall]({{< relref "../../../open-source/" >}}).
|
||||
|
||||
## Install Slack integration for Grafana OnCall
|
||||
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
---
|
||||
aliases:
|
||||
- /docs/oncall/latest/chat-options/configure-teams/
|
||||
- ../../chat-options/configure-teams/
|
||||
- /docs/oncall/latest/integrations/chatops-integrations/configure-teams/
|
||||
canonical: https://grafana.com/docs/oncall/latest/integrations/chatops-integrations/configure-teams/
|
||||
keywords:
|
||||
- Grafana Cloud
|
||||
- Alerts
|
||||
|
|
@ -11,7 +13,6 @@ keywords:
|
|||
- MS Team
|
||||
- Microsoft
|
||||
title: Microsoft Teams integration for Grafana OnCall
|
||||
canonical: "https://grafana.com/docs/oncall/latest/chat-options/configure-teams/"
|
||||
weight: 500
|
||||
---
|
||||
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
---
|
||||
aliases:
|
||||
- /docs/oncall/latest/chat-options/configure-telegram/
|
||||
- ../../chat-options/configure-telegram/
|
||||
- /docs/oncall/latest/integrations/chatops-integrations/configure-telegram/
|
||||
canonical: https://grafana.com/docs/oncall/latest/integrations/chatops-integrations/configure-telegram/
|
||||
keywords:
|
||||
- Grafana Cloud
|
||||
- Alerts
|
||||
|
|
@ -10,7 +12,6 @@ keywords:
|
|||
- oncall
|
||||
- telegram
|
||||
title: Telegram integration for Grafana OnCall
|
||||
canonical: "https://grafana.com/docs/oncall/latest/chat-options/configure-telegram/"
|
||||
weight: 300
|
||||
---
|
||||
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
---
|
||||
aliases:
|
||||
- /docs/oncall/latest/oncall-api-reference/
|
||||
canonical: https://grafana.com/docs/oncall/latest/oncall-api-reference/
|
||||
title: Grafana OnCall HTTP API reference
|
||||
canonical: "https://grafana.com/docs/oncall/latest/oncall-api-reference/"
|
||||
weight: 1500
|
||||
---
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
---
|
||||
aliases:
|
||||
- /docs/grafana-cloud/oncall/oncall-api-reference/alertgroups/
|
||||
- /docs/oncall/latest/oncall-api-reference/alertgroups/
|
||||
canonical: https://grafana.com/docs/oncall/latest/oncall-api-reference/alertgroups/
|
||||
title: Alert groups HTTP API
|
||||
canonical: "https://grafana.com/docs/oncall/latest/oncall-api-reference/alertgroups/"
|
||||
weight: 400
|
||||
---
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
---
|
||||
aliases:
|
||||
- /docs/grafana-cloud/oncall/oncall-api-reference/alerts/
|
||||
- /docs/oncall/latest/oncall-api-reference/alerts/
|
||||
canonical: https://grafana.com/docs/oncall/latest/oncall-api-reference/alerts/
|
||||
title: Alerts HTTP API
|
||||
canonical: "https://grafana.com/docs/oncall/latest/oncall-api-reference/alerts/"
|
||||
weight: 100
|
||||
---
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
---
|
||||
aliases:
|
||||
- /docs/grafana-cloud/oncall/oncall-api-reference/escalation_chains/
|
||||
- /docs/oncall/latest/oncall-api-reference/escalation_chains/
|
||||
canonical: https://grafana.com/docs/oncall/latest/oncall-api-reference/escalation_chains/
|
||||
title: Escalation Chains HTTP API
|
||||
canonical: "https://grafana.com/docs/oncall/latest/oncall-api-reference/escalation_chains/"
|
||||
weight: 200
|
||||
---
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
---
|
||||
aliases:
|
||||
- /docs/grafana-cloud/oncall/oncall-api-reference/escalation_policies/
|
||||
- /docs/oncall/latest/oncall-api-reference/escalation_policies/
|
||||
canonical: https://grafana.com/docs/oncall/latest/oncall-api-reference/escalation_policies/
|
||||
title: Escalation Policies HTTP API
|
||||
canonical: "https://grafana.com/docs/oncall/latest/oncall-api-reference/escalation_policies/"
|
||||
weight: 300
|
||||
---
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
---
|
||||
aliases:
|
||||
- /docs/grafana-cloud/oncall/oncall-api-reference/integrations/
|
||||
- /docs/oncall/latest/oncall-api-reference/integrations/
|
||||
canonical: https://grafana.com/docs/oncall/latest/oncall-api-reference/integrations/
|
||||
title: Integrations HTTP API
|
||||
canonical: "https://grafana.com/docs/oncall/latest/oncall-api-reference/integrations/"
|
||||
weight: 500
|
||||
---
|
||||
|
||||
|
|
@ -68,7 +67,7 @@ The above command returns JSON structured in the following way:
|
|||
```
|
||||
|
||||
Integrations are sources of alerts and alert groups for Grafana OnCall.
|
||||
For example, to learn how to integrate Grafana OnCall with Alertmanager see [Alertmanager]({{< relref "../integrations/available-integrations/add-alertmanager/" >}}).
|
||||
For example, to learn how to integrate Grafana OnCall with Alertmanager see [Alertmanager]({{< relref "../integrations/available-integrations/configure-alertmanager/" >}}).
|
||||
|
||||
**HTTP request**
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
---
|
||||
aliases:
|
||||
- /docs/grafana-cloud/oncall/oncall-api-reference/on_call_shifts/
|
||||
- /docs/oncall/latest/oncall-api-reference/on_call_shifts/
|
||||
canonical: https://grafana.com/docs/oncall/latest/oncall-api-reference/on_call_shifts/
|
||||
title: OnCall shifts HTTP API
|
||||
canonical: "https://grafana.com/docs/oncall/latest/oncall-api-reference/on_call_shifts/"
|
||||
weight: 600
|
||||
---
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
---
|
||||
aliases:
|
||||
- /docs/grafana-cloud/oncall/oncall-api-reference/outgoing_webhooks/
|
||||
- /docs/oncall/latest/oncall-api-reference/outgoing_webhooks/
|
||||
canonical: https://grafana.com/docs/oncall/latest/oncall-api-reference/outgoing_webhooks/
|
||||
title: Outgoing webhooks HTTP API
|
||||
canonical: "https://grafana.com/docs/oncall/latest/oncall-api-reference/outgoing_webhooks/"
|
||||
weight: 700
|
||||
---
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
---
|
||||
aliases:
|
||||
- /docs/grafana-cloud/oncall/oncall-api-reference/personal_notification_rules/
|
||||
- /docs/oncall/latest/oncall-api-reference/personal_notification_rules/
|
||||
canonical: https://grafana.com/docs/oncall/latest/oncall-api-reference/personal_notification_rules/
|
||||
title: Personal Notification Rules HTTP API
|
||||
canonical: "https://grafana.com/docs/oncall/latest/oncall-api-reference/personal_notification_rules/"
|
||||
weight: 800
|
||||
---
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
---
|
||||
aliases:
|
||||
- /docs/grafana-cloud/oncall/oncall-api-reference/postmortem_messages/
|
||||
- /docs/oncall/latest/oncall-api-reference/postmortem_messages/
|
||||
canonical: https://grafana.com/docs/oncall/latest/oncall-api-reference/postmortem_messages/
|
||||
draft: true
|
||||
title: Postmortem Messages HTTP API
|
||||
canonical: "https://grafana.com/docs/oncall/latest/oncall-api-reference/postmortem_messages/"
|
||||
weight: 900
|
||||
---
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
---
|
||||
aliases:
|
||||
- /docs/grafana-cloud/oncall/oncall-api-reference/postmortems/
|
||||
- /docs/oncall/latest/oncall-api-reference/postmortems/
|
||||
canonical: https://grafana.com/docs/oncall/latest/oncall-api-reference/postmortems/
|
||||
draft: true
|
||||
title: Postmortem HTTP API
|
||||
canonical: "https://grafana.com/docs/oncall/latest/oncall-api-reference/postmortems/"
|
||||
weight: 1000
|
||||
---
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
---
|
||||
aliases:
|
||||
- /docs/grafana-cloud/oncall/oncall-api-reference/routes/
|
||||
- /docs/oncall/latest/oncall-api-reference/routes/
|
||||
canonical: https://grafana.com/docs/oncall/latest/oncall-api-reference/routes/
|
||||
title: Routes HTTP API
|
||||
canonical: "https://grafana.com/docs/oncall/latest/oncall-api-reference/routes/"
|
||||
weight: 1100
|
||||
---
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
---
|
||||
aliases:
|
||||
- /docs/grafana-cloud/oncall/oncall-api-reference/schedules/
|
||||
- /docs/oncall/latest/oncall-api-reference/schedules/
|
||||
canonical: https://grafana.com/docs/oncall/latest/oncall-api-reference/schedules/
|
||||
title: Schedule HTTP API
|
||||
canonical: "https://grafana.com/docs/oncall/latest/oncall-api-reference/schedules/"
|
||||
weight: 1200
|
||||
---
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
---
|
||||
aliases:
|
||||
- /docs/grafana-cloud/oncall/oncall-api-reference/slack_channels/
|
||||
- /docs/oncall/latest/oncall-api-reference/slack_channels/
|
||||
canonical: https://grafana.com/docs/oncall/latest/oncall-api-reference/slack_channels/
|
||||
title: Slack Channels HTTP API
|
||||
canonical: "https://grafana.com/docs/oncall/latest/oncall-api-reference/slack_channels/"
|
||||
weight: 1300
|
||||
---
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
---
|
||||
aliases:
|
||||
- /docs/grafana-cloud/oncall/oncall-api-reference/user_groups/
|
||||
- /docs/oncall/latest/oncall-api-reference/user_groups/
|
||||
canonical: https://grafana.com/docs/oncall/latest/oncall-api-reference/user_groups/
|
||||
title: OnCall User Groups HTTP API
|
||||
canonical: "https://grafana.com/docs/oncall/latest/oncall-api-reference/user_groups/"
|
||||
weight: 1400
|
||||
---
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
---
|
||||
aliases:
|
||||
- /docs/grafana-cloud/oncall/oncall-api-reference/users/
|
||||
- /docs/oncall/latest/oncall-api-reference/users/
|
||||
canonical: https://grafana.com/docs/oncall/latest/oncall-api-reference/users/
|
||||
title: Grafana OnCall Users HTTP API
|
||||
canonical: "https://grafana.com/docs/oncall/latest/oncall-api-reference/users/"
|
||||
weight: 1500
|
||||
---
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
---
|
||||
aliases:
|
||||
- /docs/grafana-cloud/oncall/open-source/
|
||||
- /docs/oncall/latest/open-source/
|
||||
keywords:
|
||||
- Open Source
|
||||
|
|
@ -195,6 +194,7 @@ Grafana OnCall is capable of sending emails using SMTP as a user notification st
|
|||
- `EMAIL_HOST_USER` - SMTP server user
|
||||
- `EMAIL_HOST_PASSWORD` - SMTP server password
|
||||
- `EMAIL_PORT` (default is `587`) - SMTP server port
|
||||
- `EMAIL_USE_TLS` (default is `True`) - to enable/disable TLS
|
||||
- `EMAIL_USE_TLS` (default is `True`) - To enable/disable TLS
|
||||
- `EMAIL_FROM_ADDRESS` (optional) - Email address used to send emails. If not specified, `EMAIL_HOST_USER` will be used.
|
||||
|
||||
After enabling the email integration, it will be possible to use the `Notify by email` notification step in user settings.
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ from apps.base.models import LiveSetting
|
|||
|
||||
class LiveSettingSerializer(serializers.ModelSerializer):
|
||||
id = serializers.CharField(read_only=True, source="public_primary_key")
|
||||
value = serializers.JSONField(allow_null=False)
|
||||
value = serializers.JSONField(allow_null=True)
|
||||
|
||||
class Meta:
|
||||
model = LiveSetting
|
||||
|
|
|
|||
|
|
@ -264,7 +264,13 @@ class ScheduleView(
|
|||
if filter_by is not None and filter_by != EVENTS_FILTER_BY_FINAL:
|
||||
filter_by = OnCallSchedule.PRIMARY if filter_by == EVENTS_FILTER_BY_ROTATION else OnCallSchedule.OVERRIDES
|
||||
events = schedule.filter_events(
|
||||
user_tz, starting_date, days=days, with_empty=True, with_gap=resolve_schedule, filter_by=filter_by
|
||||
user_tz,
|
||||
starting_date,
|
||||
days=days,
|
||||
with_empty=True,
|
||||
with_gap=resolve_schedule,
|
||||
filter_by=filter_by,
|
||||
all_day_datetime=True,
|
||||
)
|
||||
else: # return final schedule
|
||||
events = schedule.final_events(user_tz, starting_date, days)
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ class LiveSetting(models.Model):
|
|||
"EMAIL_HOST_USER",
|
||||
"EMAIL_HOST_PASSWORD",
|
||||
"EMAIL_USE_TLS",
|
||||
"EMAIL_FROM_ADDRESS",
|
||||
"TWILIO_ACCOUNT_SID",
|
||||
"TWILIO_AUTH_TOKEN",
|
||||
"TWILIO_API_KEY_SID",
|
||||
|
|
@ -63,6 +64,7 @@ class LiveSetting(models.Model):
|
|||
"EMAIL_HOST_USER": "SMTP server user",
|
||||
"EMAIL_HOST_PASSWORD": "SMTP server password",
|
||||
"EMAIL_USE_TLS": "SMTP enable/disable TLS",
|
||||
"EMAIL_FROM_ADDRESS": "Email address used to send emails. If not specified, EMAIL_HOST_USER will be used.",
|
||||
"SLACK_SIGNING_SECRET": (
|
||||
"Check <a href='"
|
||||
"https://grafana.com/docs/grafana-cloud/oncall/open-source/#slack-setup"
|
||||
|
|
|
|||
|
|
@ -16,6 +16,16 @@ MAX_RETRIES = 1 if settings.DEBUG else 10
|
|||
logger = get_task_logger(__name__)
|
||||
|
||||
|
||||
def get_from_email(user):
|
||||
if live_settings.EMAIL_FROM_ADDRESS:
|
||||
return live_settings.EMAIL_FROM_ADDRESS
|
||||
|
||||
if settings.LICENSE == settings.CLOUD_LICENSE_NAME:
|
||||
return "oncall@{}.grafana.net".format(user.organization.stack_slug)
|
||||
|
||||
return live_settings.EMAIL_HOST_USER
|
||||
|
||||
|
||||
@shared_dedicated_queue_retry_task(autoretry_for=(Exception,), retry_backoff=True, max_retries=MAX_RETRIES)
|
||||
def notify_user_async(user_pk, alert_group_pk, notification_policy_pk):
|
||||
# imported here to avoid circular import error
|
||||
|
|
@ -76,7 +86,7 @@ def notify_user_async(user_pk, alert_group_pk, notification_policy_pk):
|
|||
subject, html_message = build_subject_and_message(alert_group, emails_left)
|
||||
|
||||
message = strip_tags(html_message)
|
||||
email_from = settings.EMAIL_HOST_USER
|
||||
from_email = get_from_email(user)
|
||||
recipient_list = [user.email]
|
||||
|
||||
connection = get_connection(
|
||||
|
|
@ -90,7 +100,7 @@ def notify_user_async(user_pk, alert_group_pk, notification_policy_pk):
|
|||
)
|
||||
|
||||
try:
|
||||
send_mail(subject, message, email_from, recipient_list, html_message=html_message, connection=connection)
|
||||
send_mail(subject, message, from_email, recipient_list, html_message=html_message, connection=connection)
|
||||
EmailMessage.objects.create(
|
||||
represents_alert_group=alert_group,
|
||||
notification_policy=notification_policy,
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ from django.core import mail
|
|||
from django.core.mail.backends.locmem import EmailBackend
|
||||
|
||||
from apps.base.models import UserNotificationPolicy, UserNotificationPolicyLogRecord
|
||||
from apps.email.tasks import notify_user_async
|
||||
from apps.email.tasks import get_from_email, notify_user_async
|
||||
from apps.user_management.subscription_strategy.free_public_beta_subscription_strategy import (
|
||||
FreePublicBetaSubscriptionStrategy,
|
||||
)
|
||||
|
|
@ -155,3 +155,38 @@ def test_notify_user_no_emails_left(
|
|||
log_record = notification_policy.personal_log_records.last()
|
||||
assert log_record.type == UserNotificationPolicyLogRecord.TYPE_PERSONAL_NOTIFICATION_FAILED
|
||||
assert log_record.notification_error_code == UserNotificationPolicyLogRecord.ERROR_NOTIFICATION_MAIL_LIMIT_EXCEEDED
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
@pytest.mark.parametrize(
|
||||
"license_name,email_host_user,email_from_address,expected",
|
||||
[
|
||||
("Cloud", "user", "from_address", "from_address"),
|
||||
("OpenSource", "user", "from_address", "from_address"),
|
||||
("Cloud", "user", None, "oncall@slug.grafana.net"),
|
||||
("Cloud", None, None, "oncall@slug.grafana.net"),
|
||||
("OpenSource", "user", None, "user"),
|
||||
("OpenSource", None, None, None),
|
||||
],
|
||||
)
|
||||
def test_get_from_email(
|
||||
settings,
|
||||
make_organization,
|
||||
make_user_for_organization,
|
||||
license_name,
|
||||
email_host_user,
|
||||
email_from_address,
|
||||
expected,
|
||||
):
|
||||
settings.EMAIL_BACKEND = "django.core.mail.backends.locmem.EmailBackend"
|
||||
settings.EMAIL_HOST = "test"
|
||||
settings.EMAIL_HOST_PASSWORD = "password"
|
||||
|
||||
settings.LICENSE = license_name
|
||||
settings.EMAIL_HOST_USER = email_host_user
|
||||
settings.EMAIL_FROM_ADDRESS = email_from_address
|
||||
|
||||
organization = make_organization(stack_slug="slug")
|
||||
user = make_user_for_organization(organization)
|
||||
|
||||
assert get_from_email(user) == expected
|
||||
|
|
|
|||
|
|
@ -202,7 +202,16 @@ class OnCallSchedule(PolymorphicModel):
|
|||
"""Return public primary keys for all users referenced in the schedule."""
|
||||
return set()
|
||||
|
||||
def filter_events(self, user_timezone, starting_date, days, with_empty=False, with_gap=False, filter_by=None):
|
||||
def filter_events(
|
||||
self,
|
||||
user_timezone,
|
||||
starting_date,
|
||||
days,
|
||||
with_empty=False,
|
||||
with_gap=False,
|
||||
filter_by=None,
|
||||
all_day_datetime=False,
|
||||
):
|
||||
"""Return filtered events from schedule."""
|
||||
shifts = (
|
||||
list_of_oncall_shifts_from_ical(
|
||||
|
|
@ -212,13 +221,18 @@ class OnCallSchedule(PolymorphicModel):
|
|||
)
|
||||
events = []
|
||||
for shift in shifts:
|
||||
all_day = type(shift["start"]) == datetime.date
|
||||
start = shift["start"]
|
||||
all_day = type(start) == datetime.date
|
||||
# fix confusing end date for all-day event
|
||||
end = shift["end"] - timezone.timedelta(days=1) if all_day else shift["end"]
|
||||
if all_day and all_day_datetime:
|
||||
start = datetime.datetime.combine(start, datetime.datetime.min.time(), tzinfo=pytz.UTC)
|
||||
end = datetime.datetime.combine(end, datetime.datetime.max.time(), tzinfo=pytz.UTC)
|
||||
is_gap = shift.get("is_gap", False)
|
||||
shift_json = {
|
||||
"all_day": all_day,
|
||||
"start": shift["start"],
|
||||
# fix confusing end date for all-day event
|
||||
"end": shift["end"] - timezone.timedelta(days=1) if all_day else shift["end"],
|
||||
"start": start,
|
||||
"end": end,
|
||||
"users": [
|
||||
{
|
||||
"display_name": user.username,
|
||||
|
|
@ -246,7 +260,9 @@ class OnCallSchedule(PolymorphicModel):
|
|||
|
||||
def final_events(self, user_tz, starting_date, days):
|
||||
"""Return schedule final events, after resolving shifts and overrides."""
|
||||
events = self.filter_events(user_tz, starting_date, days=days, with_empty=True, with_gap=True)
|
||||
events = self.filter_events(
|
||||
user_tz, starting_date, days=days, with_empty=True, with_gap=True, all_day_datetime=True
|
||||
)
|
||||
events = self._resolve_schedule(events)
|
||||
return events
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,20 @@ SUMMARY:@Alex
|
|||
TRANSP:TRANSPARENT
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DTSTART;VALUE=DATE:20210127
|
||||
DTEND;VALUE=DATE:20210129
|
||||
DTSTAMP:20210127T154139Z
|
||||
UID:7q00jpu4hdlr9e3j4fftbv7kt8@google.com
|
||||
CREATED:20210127T143802Z
|
||||
DESCRIPTION:
|
||||
LAST-MODIFIED:20210127T143802Z
|
||||
LOCATION:
|
||||
SEQUENCE:0
|
||||
STATUS:CONFIRMED
|
||||
SUMMARY:@Alice
|
||||
TRANSP:TRANSPARENT
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DTSTART;TZID=Asia/Yekaterinburg:20210127T130000
|
||||
DTEND;TZID=Asia/Yekaterinburg:20210127T220000
|
||||
DTSTAMP:20210127T154139Z
|
||||
|
|
|
|||
|
|
@ -45,8 +45,9 @@ def test_recurring_ical_events_with_all_day_event(get_ical):
|
|||
parsed_iso_day_to_check - timezone.timedelta(days=1),
|
||||
parsed_iso_day_to_check + timezone.timedelta(days=1),
|
||||
)
|
||||
assert len(events) == 4
|
||||
assert len(events) == 5
|
||||
assert events[0]["SUMMARY"] == "@Alex"
|
||||
assert events[1]["SUMMARY"] == "@Bob"
|
||||
assert events[2]["SUMMARY"] == "@Bernard Desruisseaux"
|
||||
assert events[1]["SUMMARY"] == "@Alice"
|
||||
assert events[2]["SUMMARY"] == "@Bob"
|
||||
assert events[3]["SUMMARY"] == "@Bernard Desruisseaux"
|
||||
assert events[4]["SUMMARY"] == "@Bernard Desruisseaux"
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ def test_shifts_dict_all_day_middle_event(make_organization, make_schedule, get_
|
|||
parsed_iso_day_to_check = datetime.datetime.fromisoformat(day_to_check_iso).replace(tzinfo=pytz.UTC)
|
||||
requested_date = (parsed_iso_day_to_check - timezone.timedelta(days=1)).date()
|
||||
shifts = list_of_oncall_shifts_from_ical(schedule, requested_date, days=3, with_empty_shifts=True)
|
||||
assert len(shifts) == 4
|
||||
assert len(shifts) == 5
|
||||
for s in shifts:
|
||||
start = s["start"].date() if isinstance(s["start"], datetime.datetime) else s["start"]
|
||||
end = s["end"].date() if isinstance(s["end"], datetime.datetime) else s["end"]
|
||||
|
|
|
|||
|
|
@ -235,7 +235,7 @@ def test_filter_events_ical_all_day(make_organization, make_user_for_organizatio
|
|||
organization = make_organization()
|
||||
schedule = make_schedule(organization, schedule_class=OnCallScheduleCalendar)
|
||||
schedule.cached_ical_file_primary = calendar.to_ical()
|
||||
for u in ("@Bernard Desruisseaux", "@Bob", "@Alex"):
|
||||
for u in ("@Bernard Desruisseaux", "@Bob", "@Alex", "@Alice"):
|
||||
make_user_for_organization(organization, username=u)
|
||||
# clear users pks <-> organization cache (persisting between tests)
|
||||
memoized_users_in_ical.cache_clear()
|
||||
|
|
@ -246,14 +246,44 @@ def test_filter_events_ical_all_day(make_organization, make_user_for_organizatio
|
|||
|
||||
events = schedule.final_events("UTC", start_date, days=2)
|
||||
expected_events = [
|
||||
# all_day, users, start
|
||||
(False, ["@Bernard Desruisseaux"], datetime.datetime(2021, 1, 26, 8, 0, tzinfo=pytz.UTC)),
|
||||
(True, ["@Alex"], datetime.date(2021, 1, 27)),
|
||||
(False, ["@Bob"], datetime.datetime(2021, 1, 27, 8, 0, tzinfo=pytz.UTC)),
|
||||
# all_day, users, start, end
|
||||
(
|
||||
False,
|
||||
["@Bernard Desruisseaux"],
|
||||
datetime.datetime(2021, 1, 26, 8, 0, tzinfo=pytz.UTC),
|
||||
datetime.datetime(2021, 1, 26, 17, 0, tzinfo=pytz.UTC),
|
||||
),
|
||||
(
|
||||
True,
|
||||
["@Alex"],
|
||||
datetime.datetime(2021, 1, 27, 0, 0, tzinfo=pytz.UTC),
|
||||
datetime.datetime(2021, 1, 27, 23, 59, 59, 999999, tzinfo=pytz.UTC),
|
||||
),
|
||||
(
|
||||
True,
|
||||
["@Alice"],
|
||||
datetime.datetime(2021, 1, 27, 0, 0, tzinfo=pytz.UTC),
|
||||
datetime.datetime(2021, 1, 28, 23, 59, 59, 999999, tzinfo=pytz.UTC),
|
||||
),
|
||||
(
|
||||
False,
|
||||
["@Bob"],
|
||||
datetime.datetime(2021, 1, 27, 8, 0, tzinfo=pytz.UTC),
|
||||
datetime.datetime(2021, 1, 27, 17, 0, tzinfo=pytz.UTC),
|
||||
),
|
||||
]
|
||||
expected = [
|
||||
{"all_day": all_day, "users": users, "start": start, "end": end}
|
||||
for all_day, users, start, end in expected_events
|
||||
]
|
||||
expected = [{"all_day": all_day, "users": users, "start": start} for all_day, users, start in expected_events]
|
||||
returned = [
|
||||
{"all_day": e["all_day"], "users": [u["display_name"] for u in e["users"]], "start": e["start"]} for e in events
|
||||
{
|
||||
"all_day": e["all_day"],
|
||||
"users": [u["display_name"] for u in e["users"]],
|
||||
"start": e["start"],
|
||||
"end": e["end"],
|
||||
}
|
||||
for e in events
|
||||
]
|
||||
assert returned == expected
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
# Generated by Django 3.2.15 on 2022-10-25 03:16
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('user_management', '0003_user_hide_phone_number'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Region',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=300)),
|
||||
('slug', models.CharField(max_length=50, unique=True)),
|
||||
('oncall_backend_url', models.URLField(null=True)),
|
||||
],
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='organization',
|
||||
name='region_slug',
|
||||
field=models.CharField(default=None, max_length=300, null=True),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='organization',
|
||||
name='migration_destination',
|
||||
field=models.ForeignKey(db_column='migration_destination_slug', default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='regions', to='user_management.region', to_field='slug'),
|
||||
),
|
||||
]
|
||||
21
engine/config_integrations/README.md
Normal file
21
engine/config_integrations/README.md
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
# Contribute the new Integration to OnCall
|
||||
|
||||
Related: [DEVELOPER.md](/DEVELOPER.md)
|
||||
|
||||
"Integration" in OnCall is a pre-configured webhook for alert consumption from alert sources. Usually, alert sources are monitoring systems such as Grafana or Zabbix.
|
||||
|
||||
Integration is a set of "templates" which are dumped from the integration config once the integration is created. Further changes to "templates" don't reflect on the integration config. Read more about templates [here](https://grafana.com/docs/oncall/latest/integrations/create-custom-templates/).
|
||||
|
||||
This instruction is supposed to help you to build templates to integrate OnCall with a new source of alerts. If you don't want to contribute to OnCall and are looking for a help integrating with custom alert source as a user, refer to [this](https://grafana.com/docs/oncall/latest/integrations/create-custom-templates/) instruction.
|
||||
|
||||
# Files related to Integrations
|
||||
0. Refer to "Grafana" integration as the most complete example.
|
||||
1. Each integration should have a `{{integration_name_in_snake_case}}.py` file in `/engine/config_integrations`. There you'll find Templates that will be copied to the Integration Templates once the integration is created by the user in the OnCall UI; Example Payload; and Tests which should match the result of the rendering of Example Payload as using Templates. The best way to build such a file is to create Webhook Integration, write & debug templates in the UI first and copy-paste them to the file after.
|
||||
2. Each integration should be listed in the `/engine/settings/base.py` file, section `INSTALLED_ONCALL_INTEGRATIONS`.
|
||||
3. Each integration should have "How to connect" instruction stored as `integration_{{integration_name_in_snake_case}}.html` in the `engine/apps/integrations/html` folder. `.py` file has a `slug` field that is used to locate `.html` file.
|
||||
|
||||
# What do we expect from high-quality integration?
|
||||
|
||||
1. User-friendly integration instruction.
|
||||
2. Proper grouping following source's logics. If source generates multiple alerts per "detection" it would be nice to provide suitable grouping & resolving configuration in the templates.
|
||||
3. Awesome rendering. We all love when alerts look good in Slack, SMS and all other rendering destinations.
|
||||
62
engine/config_integrations/zabbix.py
Normal file
62
engine/config_integrations/zabbix.py
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
# Main
|
||||
enabled = True
|
||||
title = "Zabbix"
|
||||
slug = "zabbix"
|
||||
short_description = None
|
||||
description = None
|
||||
is_displayed_on_web = True
|
||||
is_featured = False
|
||||
is_able_to_autoresolve = True
|
||||
is_demo_alert_enabled = True
|
||||
|
||||
description = None
|
||||
|
||||
# Default templates
|
||||
slack_title = """\
|
||||
*<{{ grafana_oncall_link }}|#{{ grafana_oncall_incident_id }} {{ payload.get("title", "Title undefined (check Slack Title Template)") }}>* via {{ integration_name }}
|
||||
{% if source_link %}
|
||||
(*<{{ source_link }}|source>*)
|
||||
{%- endif %}"""
|
||||
|
||||
slack_message = '{{ payload.get("message", "") }}'
|
||||
|
||||
slack_image_url = '{{ payload.get("image_url", "") }}'
|
||||
|
||||
web_title = '{{ payload.get("title", "Title undefined (check Web Title Template)") }}'
|
||||
|
||||
web_message = slack_message
|
||||
|
||||
web_image_url = slack_image_url
|
||||
|
||||
sms_title = web_title
|
||||
|
||||
phone_call_title = sms_title
|
||||
|
||||
email_title = web_title
|
||||
|
||||
email_message = web_message
|
||||
|
||||
telegram_title = sms_title
|
||||
|
||||
telegram_message = slack_message
|
||||
|
||||
telegram_image_url = slack_image_url
|
||||
|
||||
source_link = "{{ payload.link_to_upstream_details }}"
|
||||
|
||||
grouping_id = '{{ payload.get("alert_uid", "")}}'
|
||||
|
||||
resolve_condition = '{{ payload.get("state", "").upper() == "OK" }}'
|
||||
|
||||
acknowledge_condition = None
|
||||
|
||||
group_verbose_name = web_title
|
||||
|
||||
example_payload = {
|
||||
"alert_uid": "08d6891a-835c-e661-39fa-96b6a9e26552",
|
||||
"title": "TestAlert: The whole system is down",
|
||||
"image_url": "https://upload.wikimedia.org/wikipedia/commons/e/ee/Grumpy_Cat_by_Gage_Skidmore.jpg",
|
||||
"state": "alerting",
|
||||
"link_to_upstream_details": "https://en.wikipedia.org/wiki/Downtime",
|
||||
"message": "This alert was sent by user for the demonstration purposes\nSmth happened. Oh no!",
|
||||
}
|
||||
|
|
@ -23,19 +23,21 @@ class RequestTimeLoggingMiddleware(MiddlewareMixin):
|
|||
seconds = (dt - request._logging_start_dt).total_seconds()
|
||||
status_code = 0 if response is None else response.status_code
|
||||
content_length = request.headers.get("content-length", default=0)
|
||||
integration_type = "N/A"
|
||||
integration_token = "N/A"
|
||||
message = (
|
||||
"inbound "
|
||||
f"latency={str(seconds)} status={status_code} method={request.method} path={request.path} "
|
||||
f"content-length={content_length} slow={int(seconds > settings.SLOW_THRESHOLD_SECONDS)} "
|
||||
)
|
||||
if hasattr(request, "user") and request.user and request.user.id:
|
||||
user_id = request.user.id
|
||||
org_id = request.user.organization_id
|
||||
message += f"user_id={user_id} org_id={org_id} "
|
||||
if request.path.startswith("/integrations/v1"):
|
||||
split_path = request.path.split("/")
|
||||
integration_type = split_path[3]
|
||||
integration_token = split_path[4]
|
||||
logging.info(
|
||||
"inbound "
|
||||
f"latency={str(seconds)} status={status_code} method={request.method} path={request.path} "
|
||||
f"content-length={content_length} slow={int(seconds > settings.SLOW_THRESHOLD_SECONDS)} "
|
||||
f"integration_type={integration_type} "
|
||||
f"integration_token={integration_token}"
|
||||
)
|
||||
message += f"integration_type={integration_type} integration_token={integration_token} "
|
||||
logging.info(message)
|
||||
|
||||
def process_request(self, request):
|
||||
self.log_message(request, None, "request")
|
||||
|
|
|
|||
|
|
@ -570,7 +570,7 @@ EMAIL_HOST_USER = os.getenv("EMAIL_HOST_USER")
|
|||
EMAIL_HOST_PASSWORD = os.getenv("EMAIL_HOST_PASSWORD")
|
||||
EMAIL_PORT = getenv_integer("EMAIL_PORT", 587)
|
||||
EMAIL_USE_TLS = getenv_boolean("EMAIL_USE_TLS", True)
|
||||
DEFAULT_FROM_EMAIL = os.getenv("DEFAULT_FROM_EMAIL")
|
||||
EMAIL_FROM_ADDRESS = os.getenv("EMAIL_FROM_ADDRESS")
|
||||
|
||||
if FEATURE_EMAIL_INTEGRATION_ENABLED:
|
||||
EXTRA_MESSAGING_BACKENDS = [("apps.email.backend.EmailBackend", 8)]
|
||||
|
|
@ -588,6 +588,7 @@ INSTALLED_ONCALL_INTEGRATIONS = [
|
|||
"config_integrations.maintenance",
|
||||
"config_integrations.manual",
|
||||
"config_integrations.slack_channel",
|
||||
"config_integrations.zabbix",
|
||||
]
|
||||
|
||||
if OSS_INSTALLATION:
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ type: application
|
|||
# This is the chart version. This version number should be incremented each time you make changes
|
||||
# to the chart and its templates, including the app version.
|
||||
# Versions are expected to follow Semantic Versioning (https://semver.org/)
|
||||
version: 1.0.7
|
||||
version: 1.0.8
|
||||
|
||||
# This is the version number of the application being deployed. This version number should be
|
||||
# incremented each time you make changes to the application. Versions are not expected to
|
||||
|
|
|
|||
|
|
@ -224,6 +224,11 @@ externalRabbitmq:
|
|||
port:
|
||||
user:
|
||||
password:
|
||||
protocol:
|
||||
vhost:
|
||||
existingSecret: ""
|
||||
passwordKey: password
|
||||
usernameKey: username
|
||||
```
|
||||
|
||||
### Connect external Redis
|
||||
|
|
|
|||
|
|
@ -237,13 +237,21 @@
|
|||
|
||||
{{- define "snippet.rabbitmq.env" -}}
|
||||
{{- if eq .Values.broker.type "rabbitmq" -}}
|
||||
{{- if and (not .Values.rabbitmq.enabled) (not .Values.externalRabbitmq.existingSecret) (not .Values.externalRabbitmq.usernameKey) .Values.externalRabbitmq.user }}
|
||||
- name: RABBITMQ_USERNAME
|
||||
value: {{ include "snippet.rabbitmq.user" . }}
|
||||
{{- else if and (not .Values.rabbitmq.enabled) .Values.externalRabbitmq.existingSecret .Values.externalRabbitmq.usernameKey (not .Values.externalRabbitmq.user) }}
|
||||
- name: RABBITMQ_USERNAME
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ include "snippet.rabbitmq.password.secret.name" . }}
|
||||
key: {{ .Values.externalRabbitmq.usernameKey }}
|
||||
{{- end }}
|
||||
- name: RABBITMQ_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ include "snippet.rabbitmq.password.secret.name" . }}
|
||||
key: rabbitmq-password
|
||||
key: {{ include "snippet.rabbitmq.password.secret.key" . }}
|
||||
- name: RABBITMQ_HOST
|
||||
value: {{ include "snippet.rabbitmq.host" . }}
|
||||
- name: RABBITMQ_PORT
|
||||
|
|
@ -298,11 +306,21 @@
|
|||
{{- define "snippet.rabbitmq.password.secret.name" -}}
|
||||
{{- if and (not .Values.rabbitmq.enabled) .Values.externalRabbitmq.password -}}
|
||||
{{ include "oncall.fullname" . }}-rabbitmq-external
|
||||
{{- else if and (not .Values.rabbitmq.enabled) .Values.externalRabbitmq.existingSecret -}}
|
||||
{{ .Values.externalRabbitmq.existingSecret }}
|
||||
{{- else -}}
|
||||
{{ include "oncall.rabbitmq.fullname" . }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "snippet.rabbitmq.password.secret.key" -}}
|
||||
{{- if and (not .Values.rabbitmq.enabled) .Values.externalRabbitmq.passwordKey -}}
|
||||
{{ .Values.externalRabbitmq.passwordKey }}
|
||||
{{- else -}}
|
||||
rabbitmq-password
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "snippet.redis.host" -}}
|
||||
{{- if and (not .Values.redis.enabled) .Values.externalRedis.host -}}
|
||||
{{- required "externalRedis.host is required if not redis.enabled" .Values.externalRedis.host | quote }}
|
||||
|
|
@ -348,7 +366,7 @@
|
|||
key: smtp-password
|
||||
- name: EMAIL_USE_TLS
|
||||
value: {{ .Values.oncall.smtp.tls | toString | title | quote }}
|
||||
- name: DEFAULT_FROM_EMAIL
|
||||
- name: EMAIL_FROM_ADDRESS
|
||||
value: {{ .Values.oncall.smtp.fromEmail | quote }}
|
||||
{{- else -}}
|
||||
- name: FEATURE_EMAIL_INTEGRATION_ENABLED
|
||||
|
|
|
|||
|
|
@ -21,14 +21,14 @@ data:
|
|||
mariadb-root-password: {{ required "externalMysql.password is required if not mariadb.enabled" .Values.externalMysql.password | b64enc | quote }}
|
||||
{{- end }}
|
||||
---
|
||||
{{ if and (eq .Values.broker.type "rabbitmq") (not .Values.rabbitmq.enabled) -}}
|
||||
{{ if and (eq .Values.broker.type "rabbitmq") (not .Values.rabbitmq.enabled) (not .Values.externalRabbitmq.existingSecret) -}}
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ include "oncall.fullname" . }}-rabbitmq-external
|
||||
type: Opaque
|
||||
data:
|
||||
rabbitmq-password: {{ required "externalRabbitmq.password is required if not rabbitmq.enabled" .Values.externalRabbitmq.password | b64enc | quote }}
|
||||
rabbitmq-password: {{ required "externalRabbitmq.password is required if not rabbitmq.enabled and not externalRabbitmq.existingSecret" .Values.externalRabbitmq.password | b64enc | quote }}
|
||||
{{- end }}
|
||||
---
|
||||
{{ if not .Values.redis.enabled -}}
|
||||
|
|
|
|||
|
|
@ -239,6 +239,12 @@ externalRabbitmq:
|
|||
password:
|
||||
protocol:
|
||||
vhost:
|
||||
# use an existing secret for the rabbitmq password
|
||||
existingSecret: ""
|
||||
# the key in the secret containing the rabbitmq password
|
||||
passwordKey: password
|
||||
# the key in the secret containing the rabbitmq username
|
||||
usernameKey: username
|
||||
|
||||
# Redis is included into this release for the convenience.
|
||||
# It is recommended to host it separately from this release
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue