You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

集成Stackdriver与Opsgenie后,能否在调用负载中传递标签及值?

Passing Custom Tags from Stackdriver to Opsgenie

Yes, absolutely—you can pass specific custom tags and their corresponding values from Stackdriver to Opsgenie in your alert payloads. Here’s how to implement this based on your current integration setup:

Approach 1: Customizing Webhook Payloads (for custom webhook integrations)

If you’re using a custom webhook to send Stackdriver alerts to Opsgenie, you can directly modify the payload structure to include your desired tags:

  • Navigate to your Stackdriver Alerting Policy and edit the notification channel for Opsgenie.
  • In the webhook configuration, switch to the "Custom payload" option (instead of using the default payload).
  • Build a JSON payload that includes your tags as key-value pairs. You can use Stackdriver’s template variables to populate dynamic values from the alert context. For example:
{
  "message": "$${title}",
  "description": "$${description}",
  "tags": {
    "environment": "production",
    "service_name": "$${resource.labels.service}",
    "alert_severity": "$${severity}",
    "team_owner": "devops-team"
  }
}
  • Save the policy. The next time an alert triggers, these custom tags will be included in the payload sent to Opsgenie.

Approach 2: Using the Official Opsgenie Integration

If you’re using the pre-built Stackdriver-Opsgenie integration (not a custom webhook), you can still add custom tags via integration settings:

  • Open your Opsgenie dashboard and go to the Stackdriver integration configuration page.
  • Look for the "Custom Fields" or "Tags" section (the exact wording may vary slightly depending on Opsgenie’s UI). Here you can map Stackdriver metadata fields (like resource labels, alert labels, or severity) to custom tags in Opsgenie.
  • Alternatively, in Stackdriver’s notification channel setup for Opsgenie, you can add additional parameters that define your custom tags. These parameters will be included in the alert payload sent to Opsgenie.

Quick Tips for Success

  • Verify that your tag structure matches what Opsgenie expects (most commonly a JSON object of key-value pairs under a tags key).
  • Test the setup by triggering a test alert in Stackdriver and checking the corresponding alert in Opsgenie to confirm tags are being passed correctly.
  • Use Stackdriver’s template variables (e.g., $${labels.your_custom_label}) to pull dynamic values directly from your alert’s metadata, making your tags context-aware.

内容的提问来源于stack exchange,提问作者Meir Hazon

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.14 08:49:10