7.3. Alertmanager Webhook 추가
기존 Alertmanager 구성에 새 Webhook를 추가하여 스토리지 클러스터 상태에 대한 실시간 경고를 수신할 수 있습니다. 들어오는 웹 후크를 활성화하여 타사 애플리케이션에 비동기 메시지를 허용해야 합니다.
예를 들어 Red Hat Ceph Storage 클러스터에서 OSD가 다운된 경우 Google 채팅에서 알림을 전송하도록 Alertmanager를 구성할 수 있습니다.
사전 요구 사항
- 모니터링 스택 구성 요소가 활성화된 Red Hat Ceph Storage 클러스터.
- 수신 타사 애플리케이션에 구성된 들어오는 Webhook입니다.
절차
cephadm
쉘에 로그인합니다.예제
cephadm shell
[root@host01 ~]# cephadm shell
Copy to Clipboard Copied! 알림에 Webhook를 사용하도록 Alertmanager를 구성합니다.
구문
service_type: alertmanager spec: user_data: default_webhook_urls: - "_URLS_"
service_type: alertmanager spec: user_data: default_webhook_urls: - "_URLS_"
Copy to Clipboard Copied! default_webhook_urls
는 기본 수신자의webhook_configs
구성에 추가된 추가 URL 목록입니다.예제
service_type: alertmanager spec: user_data: webhook_configs: - url: 'http:127.0.0.10:8080'
service_type: alertmanager spec: user_data: webhook_configs: - url: 'http:127.0.0.10:8080'
Copy to Clipboard Copied! 업데이트 Alertmanager 설정:
예제
[ceph: root@host01 /]# ceph orch reconfig alertmanager
[ceph: root@host01 /]# ceph orch reconfig alertmanager
Copy to Clipboard Copied!
검증
Alertmanager에서 Gchat까지의 알림 예:
예제
using: https://chat.googleapis.com/v1/spaces/(xx- space identifyer -xx)/messages posting: {'status': 'resolved', 'labels': {'alertname': 'PrometheusTargetMissing', 'instance': 'postgres-exporter.host03.chest response: 200 response: { "name": "spaces/(xx- space identifyer -xx)/messages/3PYDBOsIofE.3PYDBOsIofE", "sender": { "name": "users/114022495153014004089", "displayName": "monitoring", "avatarUrl": "", "email": "", "domainId": "", "type": "BOT", "isAnonymous": false, "caaEnabled": false }, "text": "Prometheus target missing (instance postgres-exporter.cluster.local:9187)\n\nA Prometheus target has disappeared. An e "cards": [], "annotations": [], "thread": { "name": "spaces/(xx- space identifyer -xx)/threads/3PYDBOsIofE" }, "space": { "name": "spaces/(xx- space identifyer -xx)", "type": "ROOM", "singleUserBotDm": false, "threaded": false, "displayName": "_privmon", "legacyGroupChat": false }, "fallbackText": "", "argumentText": "Prometheus target missing (instance postgres-exporter.cluster.local:9187)\n\nA Prometheus target has disappea "attachment": [], "createTime": "2022-06-06T06:17:33.805375Z", "lastUpdateTime": "2022-06-06T06:17:33.805375Z"
using: https://chat.googleapis.com/v1/spaces/(xx- space identifyer -xx)/messages posting: {'status': 'resolved', 'labels': {'alertname': 'PrometheusTargetMissing', 'instance': 'postgres-exporter.host03.chest response: 200 response: { "name": "spaces/(xx- space identifyer -xx)/messages/3PYDBOsIofE.3PYDBOsIofE", "sender": { "name": "users/114022495153014004089", "displayName": "monitoring", "avatarUrl": "", "email": "", "domainId": "", "type": "BOT", "isAnonymous": false, "caaEnabled": false }, "text": "Prometheus target missing (instance postgres-exporter.cluster.local:9187)\n\nA Prometheus target has disappeared. An e "cards": [], "annotations": [], "thread": { "name": "spaces/(xx- space identifyer -xx)/threads/3PYDBOsIofE" }, "space": { "name": "spaces/(xx- space identifyer -xx)", "type": "ROOM", "singleUserBotDm": false, "threaded": false, "displayName": "_privmon", "legacyGroupChat": false }, "fallbackText": "", "argumentText": "Prometheus target missing (instance postgres-exporter.cluster.local:9187)\n\nA Prometheus target has disappea "attachment": [], "createTime": "2022-06-06T06:17:33.805375Z", "lastUpdateTime": "2022-06-06T06:17:33.805375Z"
Copy to Clipboard Copied!