- Related issues: #2521 [FEATURE] Alertmanager supports main stream receivers
Category:
- Alter manager
Verification Steps
- Prepare another VM or machine have the same subnet with the Harvester
- Prepare a webhook server on the VM, reference to https://github.com/w13915984028/harvester-develop-summary/blob/main/test-log-event-audit-with-webhook-server.md
- You may need to install python3 web package, refer to https://webpy.org/install
- Run
export PORT=8094
on the webhook server VM - Launch the webhook server
python3 simple-webhook-server.py
davidtclin@ubuntu-clean:~$ python3 simple-webhook-server.py usage: export PORT=1234 to set http server port number as 1234 start a simple webhook server, PORT 8094 @ 2022-09-21 16:39:58.706792 http://0.0.0.0:8094/
- Access Harvester
Alertmanager Configs
page in Monitoring - Create an Alertmanager config
- Access the created Alertmanager config
- Click Add receiver
- Select webhook page
- Click Add webhook
- Add `http://server_ip:8094 to the URL
- Access Harvester node
- Run
kubectl get alertmanagerconfig -A -o yaml
- Check the webhook server have applied to the
Altertmanagerconfig
pod - Check the webhook receiver can be created
Refer to HEP document for more details https://github.com/w13915984028/harvester/blob/fix2517/enhancements/20220720-alertmanager.md
Expected Results
-
We can add
webhook
type receiver from theAltermanager Config
page for the given namespace -
Can applied the changes to
alertmanagerconfig
pod in Harveserharv0921:~ # kubectl get alertmanagerconfig -A -o yaml apiVersion: v1 items: - apiVersion: monitoring.coreos.com/v1alpha1 kind: AlertmanagerConfig metadata: creationTimestamp: "2022-09-21T08:16:21Z" generation: 1 name: alert-receiver namespace: default resourceVersion: "14566" uid: 8f9c30a2-42c1-4831-92b5-8abf71134333 spec: receivers: [] route: groupBy: [] groupInterval: 5m groupWait: 30s matchers: [] repeatInterval: 4h - apiVersion: monitoring.coreos.com/v1alpha1 kind: AlertmanagerConfig metadata: creationTimestamp: "2022-09-21T08:48:38Z" generation: 2 name: alertmanager namespace: default resourceVersion: "39171" uid: 32f813c3-24fd-4faf-a270-1e7723a5dfdf spec: receivers: - name: webhook webhookConfigs: - httpConfig: tlsConfig: {} sendResolved: false url: http://192.168.122.230:8094 route: groupBy: [] groupInterval: 5m groupWait: 30s matchers: [] repeatInterval: 4h kind: List metadata: resourceVersion: "" selfLink: ""