본문으로 바로가기 본문 바로가기
WIKI 기술 지식 베이스

Opsgenie

원문 보기 위키 갱신

argocd-notifications로 알림을 보내려면 Opsgenie 팀 안에 API Integration을 먼저 만들어야 해요.

출처: 문서

본문

argocd-notifications로 알림을 보내려면 Opsgenie 팀 안에 API Integration을 만들어야 해요.

  • https://app.opsgenie.com 또는 (유럽 연합에 계정이 있다면) https://app.eu.opsgenie.com 에서 Opsgenie에 로그인해요
  • 이미 팀이 있는지 확인해요. 없다면 이 가이드를 따라가세요: https://docs.opsgenie.com/docs/teams
  • 왼쪽 메뉴에서 "Teams"를 클릭해요
  • 알림을 보내고 싶은 팀을 선택해요
  • 팀의 설정 메뉴에서 "Integrations"를 선택해요
  • 오른쪽 위의 "Add Integration"을 클릭해요
  • "API" 통합을 선택해요
  • 통합에 이름을 정하고, "API key"를 복사해 나중에 사용할 수 있게 저장해요
  • 통합 설정에서 "Edit"을 클릭해요
  • "Create and Update Access" 체크박스가 선택되어 있는지 확인하고, 불필요한 권한을 제거하기 위해 다른 체크박스는 비활성화해요
  • 하단의 "Save"를 클릭해요
  • 오른쪽 위의 "Turn on integration"을 클릭해요
  • 브라우저에서 올바른 서버 apiURL을 확인해요. "app.opsgenie.com"이면 US/국제 API URL api.opsgenie.com을 사용하고, 그렇지 않으면 api.eu.opsgenie.com(유럽 API)을 사용해요
  • Opsgenie 구성이 끝났어요. 이제 argocd-notifications를 구성할 차례예요. argo-rollouts-notification-secret 시크릿에서 apiUrl, 팀 이름, apiKey를 사용해 Opsgenie 통합을 구성해요
  • 아래에서 argo-rollouts-notification-configmap 구성 예시를 확인할 수 있어요.

| description | 필수 | string | 일반적으로 알림에 대한 자세한 정보를 제공하는 데 사용되는 alert의 Description 필드예요. | Hello from Argo CD! | | priority | 선택 | string | alert의 우선순위 수준이에요. 가능한 값은 P1, P2, P3, P4, P5예요. 기본값은 P3이에요. | P1 | | alias | 선택 | string | alert의 클라이언트 정의 식별자로, Alert De-Duplication의 핵심 요소이기도 해요. | Life is too short for no alias | | note | 선택 | string | alert를 만들 때 추가되는 추가 메모예요. | Error from Argo CD! | | actions | 선택 | []string | alert에 대해 사용 가능한 커스텀 액션들이에요. | ["Resolve", "Escalate"] | | tags | 선택 | []string | alert의 태그예요. | ["critical", "deployment"] | | visibleTo | 선택 | []alert.Responder | 알림을 보내지 않고도 alert가 표시되는 팀과 사용자예요. 각 항목에 type 필드가 필수이며, 가능한 값은 team과 user예요. type 필드 외에도 팀에는 id 또는 name 중 하나를, 사용자에는 id 또는 username 중 하나를 제공해야 해요. alert는 responders 필드에 지정된 팀에는 기본적으로 표시되므로 visibleTo 필드에 다시 지정할 필요는 없어요. | [{Type: "team", Id: "team_id"}, {Type: "user", Id: "user_id"}] | | details | 선택 | map[string]string | alert의 커스텀 속성으로 사용할 키-값 쌍의 맵이에요. | {"environment": "production", "service": "web"} | | entity | 선택 | string | 일반적으로 알림이 관련된 도메인을 지정하는 데 사용되는 alert의 Entity 필드예요. | web-server | | user | 선택 | string | 요청 소유자의 표시 이름이에요. | admin_user |

apiVersion: v1
kind: ConfigMap
metadata:
  name: argo-rollouts-notification-configmap
data:
  service.opsgenie: |
    apiUrl: <api-url>
    apiKeys:
      <your-team>: <integration-api-key>
  template.opsgenie: |
    message: |
      [Argo CD] Application {{.app.metadata.name}} has a problem.
    opsgenie:
      description: |
        Application: {{.app.metadata.name}}
        Health Status: {{.app.status.health.status}}
        Operation State Phase: {{.app.status.operationState.phase}}
        Sync Status: {{.app.status.sync.status}}
      priority: P1
      alias: {{.app.metadata.name}}
      note: Error from Argo CD!
      actions:
        - Restart
        - AnExampleAction
      tags:
        - OverwriteQuietHours
        - Critical
      visibleTo:
        - Id: "{{.app.metadata.responderId}}"
          Type: "team"
        - Name: "rocket_team"
          Type: "team"
        - Id: "{{.app.metadata.responderUserId}}"
          Type: "user"
        - Username: "trinity@opsgenie.com"
          Type: "user"
      details:
        environment: production
        service: web
      entity: Argo CD Application
      user: John Doe
  trigger.on-a-problem: |
    - description: Application has a problem.
      send:
      - opsgenie
      when: app.status.health.status == 'Degraded' or app.status.operationState.phase in ['Error', 'Failed'] or app.status.sync.status == 'Unknown'
  • 특정 Argo CD 앱에 알림을 활성화하려면 애플리케이션 YAML 파일에 어노테이션을 추가해요.
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  annotations:
    notifications.argoproj.io/subscribe.on-a-problem.opsgenie: <your-team>

더 알아보기 (Learn more)