How to get kubernetes namespace in webhook alert payload?

10/21/2021

Does anyone know how to get Kubernetes namespace in webhook alert payload from metricbeat k8s module? Or more generically, how to access the event data to include in the payload?

I installed metricbeat on Kubernetes using this guide: Run Metricbeat on Kubernetes | Metricbeat Reference 7.15 | Elastic

and I got this data:

enter image description here

However, when I created a webhook alert, with this payload to see the all available properties:

alert: {{alert}}
context: {{context}}

This is the only data included:

alert: {\"id\":\"ubuntu\",\"actionGroup\":\"metrics.inventory_threshold.fired\",\"actionGroupName\":\"Alert\"}

context:
{\"group\":\"ubuntu\",\"alertState\":\"ALERT\",\"reason\":\"CPU usage is greater than a threshold of 80 (current value is 99.9%)\",\"timestamp\":\"2021-10-14T22:56:11.799Z\",\"value\":{\"condition0\":\"99.9%\"},\"threshold\":{\"condition0\":[80]},\"metric\":{\"condition0\":\"cpu\"}}

Anyone know how to include the kubernetes.namespace from the source to the alert payload? I need it to be able to identify the pod in the alert uniquely.

-- Mahesh
elastic-apm
elastic-stack
kibana
kubernetes

0 Answers