alerting-dashboards-plugin
alerting-dashboards-plugin copied to clipboard
[BUG] Custom webhook fails if Slack subject previously configured for trigger action
What is the bug? Configuring a custom webhook after previously configuring a Slack webhook fails to parse JSON. This is due to OpenSearch sending the previously-defined Slack subject along with the custom webhook message contents. This will cause a parse error in, for example, OpsGenie.
How can one reproduce the bug? Steps to reproduce the behavior:
- Go to a Alerting -> Monitors -> any monitor that uses custom webhook
- Click on Edit -> Trigger -> Actions
- Select a Slack notification, a "Message Subject" field appears
- Set a subject for the Slack notification
- Select the custom webhook, which hides the "Message Subject" field
- Click "Send a test message"
- OpsGenie will report a "Invalid JSON" error
- Re-select a Slack notification channel
- Clear "Message Subject"
- Re-select custom webhook
- Click "Send a test message"
- Test message will be sent succesfully
What is the expected behavior? When a custom webhook is selected and "Message Subject" field is hidden, OpenSearch should not send the message subject data with the webhook.
What is your host/environment?
- OS: Fedora Linux
- Version: OpenSearch 2.4.1
Thanks for reporting this! I'll try to reproduce on my end, and debug from there.
Transferring to alerting dashboards plugin repo, as early investigation suggests this is a bug in the frontend code.
@antti-aiven I'm having some trouble reproducing this issue on my end. Would you mind sharing the configurations for your slack and custom webhook channels (scrubbed of any personal info)? The configurations can be obtained using the list all or get channel API.
Hi, thank you for the request, I'll get back to you as soon as possible. Currently this seems like an UI bug to me - Dashboards hides the UI element when switching from Slack to OpsGenie, but sends the contents anyway with the OpsGenie payload if the slack message subject is not empty.
I'll pull the config and post it as soon as possible.
{
"start_index" : 0,
"total_hits" : 6,
"total_hit_relation" : "eq",
"config_list" : [
{
"config_id" : "REDACTED",
"last_updated_time_ms" : 1680176590748,
"created_time_ms" : 1680176590748,
"config" : {
"name" : "OpsGenie aiven-security",
"description" : "Send an alert to aiven-security",
"config_type" : "webhook",
"is_enabled" : true,
"webhook" : {
"url" : "https://api.eu.opsgenie.com/v2/alerts",
"header_params" : {
"Authorization" : "GenieKey REDACTED",
"Content-Type" : "application/json"
},
"method" : "POST"
}
}
},
{
"config_id" : "REDACTED",
"last_updated_time_ms" : 1680176671352,
"created_time_ms" : 1680176671352,
"config" : {
"name" : "OpsGenie heartbeat (aiven-security / is-siem-fnd-up)",
"description" : "Send a heartbeat to aiven-security / is-siem-fnd-up",
"config_type" : "webhook",
"is_enabled" : true,
"webhook" : {
"url" : "https://api.eu.opsgenie.com/v2/heartbeats/is-siem-fnd-up/ping",
"header_params" : {
"Authorization" : "GenieKey REDACTED",
"Content-Type" : "application/json"
},
"method" : "POST"
}
}
},
{
"config_id" : "REDACTED",
"last_updated_time_ms" : 1682078745966,
"created_time_ms" : 1680161026979,
"config" : {
"name" : "Slack security-alerts-debug",
"description" : "Send a notification to #security-alerts-debug",
"config_type" : "slack",
"is_enabled" : true,
"slack" : {
"url" : "https://hooks.slack.com/services/REDACTED/REDACTED/REDACTED"
}
}
},
{
"config_id" : "REDACTED",
"last_updated_time_ms" : 1682078776371,
"created_time_ms" : 1680160837292,
"config" : {
"name" : "Slack security-siem-alerts",
"description" : "Send a notification to #security-siem-alerts",
"config_type" : "slack",
"is_enabled" : true,
"slack" : {
"url" : "https://hooks.slack.com/services/REDACTED/REDACTED/REDACTED"
}
}
},
{
"config_id" : "REDACTED",
"last_updated_time_ms" : 1682078793283,
"created_time_ms" : 1680161155107,
"config" : {
"name" : "Slack security-siem-info",
"description" : "Send a notification to #security-siem-info",
"config_type" : "slack",
"is_enabled" : true,
"slack" : {
"url" : "https://hooks.slack.com/services/REDACTED/REDACTED/REDACTED"
}
}
},
{
"config_id" : "REDACTED",
"last_updated_time_ms" : 1682079079485,
"created_time_ms" : 1680176419779,
"config" : {
"name" : "OpsGenie aiven-security-testing",
"description" : "Send an alert to aiven-security-testing",
"config_type" : "webhook",
"is_enabled" : true,
"webhook" : {
"url" : "https://api.eu.opsgenie.com/v2/alerts",
"header_params" : {
"Authorization" : "GenieKey REDACTED",
"Content-Type" : "application/json"
},
"method" : "POST"
}
}
}
]
}