sh OpsGenie:将模板化集成复制到团队

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh OpsGenie:将模板化集成复制到团队相关的知识,希望对你有一定的参考价值。

# Get Actions Template (For API)
curl -sXGET -H "Authorization: GenieKey $API_OPSGENIE" https://api.opsgenie.com/v2/integrations/__INTEGRATION_ID_TO_COPY__/actions | jq -c '.data | del(._parent)' >integrationActions.json

# Loop ALL Teams
for team in alpha bravo charlie delta epsilon; do

  # Create API
  jsonCreate=$(curl -sXPOST -H "Authorization: GenieKey $API_OPSGENIE" -H 'Content-Type: application/json' https://api.opsgenie.com/v2/integrations \
       -d "{ 
             \"enabled\": true, 
             \"name\": \"API: $team\", 
             \"type\": \"API\", 
             \"ownerTeam\": { 
               \"name\": \"$team\" 
             } 
           }");

  # If Successful Add Actions
  if [ "$(echo $jsonCreate | jq -r .message)" == "null" ]; then
    integrationId=$(echo $jsonCreate | jq -r '.data.id')
    integrationApiKey=$(echo $jsonCreate | jq -r '.data.apiKey')
    jsonUpdate=$(curl -sXPUT -H "Authorization: GenieKey $API_OPSGENIE" -H 'Content-Type: application/json' "https://api.opsgenie.com/v2/integrations/$integrationId/actions" -d @integrationActions.json)
    if [ "$(echo $jsonUpdate | jq -r .message)" == "null" ]; then
      echo "$team --> Handler apiKey: $integrationApiKey"
    else
      echo "ERROR: $jsonUpdate"
    fi
  else
    echo "ERROR: $jsonCreate"
  fi
done

以上是关于sh OpsGenie:将模板化集成复制到团队的主要内容,如果未能解决你的问题,请参考以下文章

markdown 整合:松弛到OpsGenie

markdown 整合:松弛到OpsGenie和Jira

企业微信零耦合集成腾讯会议和腾讯文档插件化架构实践

企业微信零耦合集成腾讯会议和腾讯文档插件化架构实践

集成magnolia和spring mvc,hibernate

在可在 OpsGenie 中访问的 Splunk OpsGenie 应用程序中设置优先级