diff --git a/tools/pagerduty-migrator/README.md b/tools/pagerduty-migrator/README.md index 0b102d9c..6a1b0a19 100644 --- a/tools/pagerduty-migrator/README.md +++ b/tools/pagerduty-migrator/README.md @@ -84,10 +84,31 @@ docker run --rm \ pd-oncall-migrator ``` +### Migrate unsupported user notification rules + It's possible to specify a default contact method type for user notification rules that cannot be migrated as-is by changing the `ONCALL_DEFAULT_CONTACT_METHOD` env variable. Options are: `email`, `sms`, `phone_call`, `slack`, `telegram`, `mobile_app` (default is `email`). +### Migrate unsupported integration types + +It's possible to migrate unsupported integration types to [Grafana OnCall incoming webhooks](https://grafana.com/docs/oncall/latest/integrations/available-integrations/configure-webhook/). +by changing UNSUPPORTED_INTEGRATION_TO_WEBHOOKS env variable: + +```shell +docker run --rm \ +-e PAGERDUTY_API_TOKEN="" \ +-e ONCALL_API_URL="" \ +-e ONCALL_API_TOKEN="" \ +-e ONCALL_DEFAULT_CONTACT_METHOD="sms" \ +-e MODE="migrate" \ +-e UNSUPPORTED_INTEGRATION_TO_WEBHOOKS="true" \ +pd-oncall-migrator +``` + +Consider modifying [alert templates](https://grafana.com/docs/oncall/latest/alert-behavior/alert-templates/) of the created +webhook integrations to adjust them for incoming payloads. + ### After migration - Connect integrations (press the "How to connect" button on the integration page) diff --git a/tools/pagerduty-migrator/migrator/report.py b/tools/pagerduty-migrator/migrator/report.py index f863e71c..69294d0a 100644 --- a/tools/pagerduty-migrator/migrator/report.py +++ b/tools/pagerduty-migrator/migrator/report.py @@ -74,7 +74,7 @@ def format_integration(integration: dict) -> str: ERROR_SIGN, result, policy_name ) else: - # check if integration not supported, but UNSUPPORTED_INTEGRATION_TO_WEBHOOKS set + # check if integration not supported, but UNSUPPORTED_INTEGRATION_TO_WEBHOOKS set if integration.get("converted_to_webhook", False): result = "{} {} – Webhook integration will be created, Grafana OnCall not support this type directly ".format( WARNING_SIGN, result diff --git a/tools/pagerduty-migrator/migrator/resources/integrations.py b/tools/pagerduty-migrator/migrator/resources/integrations.py index ee7c1281..991c979a 100644 --- a/tools/pagerduty-migrator/migrator/resources/integrations.py +++ b/tools/pagerduty-migrator/migrator/resources/integrations.py @@ -31,7 +31,11 @@ def match_integration_type(integration: dict, vendors: list[dict]) -> None: if integration["vendor"] is None: integration["vendor_name"] = None - integration["oncall_type"] = None + if UNSUPPORTED_INTEGRATION_TO_WEBHOOKS: + integration["oncall_type"] = "webhook" + integration["converted_to_webhook"] = True + else: + integration["oncall_type"] = None return vendor_id = integration["vendor"]["id"]