Opsgenie
Opsgenie
argocd-notifications 로 Opsgenie 알림을 보내는 방법입니다. Opsgenie 팀 안에 API Integration 을 만들고 argocd-notifications 에 연동하면 애플리케이션 문제를 온콜 담당자에게 알릴 수 있어요.
출처: 문서
본문
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 를 구성해야 해요.
argocd-notifications-secretsecret 에 Opsgenie 통합을 설정할 때 apiUrl, 팀 이름, apiKey 를 사용합니다. -
예시
argocd-notifications-cm설정은 아래에 있습니다.
| 옵션 | 필수 | 타입 | 설명 | 예시 |
| description | True | string | 알림에 대한 상세 정보를 제공하는 데 일반적으로 쓰는 알림의 설명 필드. | Hello from Argo CD! |
| priority | False | string | 알림의 우선순위 수준. 가능한 값은 P1, P2, P3, P4, P5 이며 기본값은 P3 이다. | P1 |
| alias | False | string | 클라이언트가 정의한 알림 식별자이며, Alert De-Duplication 의 핵심 요소이기도 하다. | Life is too short for no alias |
| note | False | string | 알림 생성 시 추가될 추가 메모. | Error from Argo CD! |
| actions | False | []string | 알림에 사용할 수 있는 커스텀 작업. | ["Resolve", "Escalate"] |
| tags | False | []string | 알림의 태그. | ["critical", "deployment"] |
| visibleTo | False | []alert.Responder | 어떤 알림도 보내지 않으면서 알림이 보이게 될 팀과 사용자. 각 항목에 type 필드가 필수이며, 가능한 값은 team 과 user 이다. type 필드 외에도 팀에는 id 또는 name, 사용자에는 id 또는 username 을 제공해야 한다. responders 필드에 지정된 팀에는 기본적으로 알림이 보이므로 visibleTo 에 다시 지정할 필요는 없다. | [{Type: "team", Id: "team_id"}, {Type: "user", Id: "user_id"}] |
| details | False | map[string]string | 알림의 커스텀 속성으로 쓰는 키-값 쌍의 맵. | {"environment": "production", "service": "web"} |
| entity | False | string | 알림이 어떤 도메인과 관련 있는지 지정하는 데 일반적으로 쓰는 알림의 엔티티 필드. | web-server |
| user | False | string | 요청 소유자의 표시 이름. | admin_user |
apiVersion: v1
kind: ConfigMap
metadata:
name: argocd-notifications-cm
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: "[email protected]"
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 파일에 annotation 을 추가합니다.
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
annotations:
notifications.argoproj.io/subscribe.on-a-problem.opsgenie: <your-team>
더 알아보기 (Learn more)
- 다른 알림 서비스 설정: slack, alertmanager
- 트리거 구성은 triggers 문서를 함께 보세요.