cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

DQL to compare requested pods vs running pods ( k8s )

PeterDrenth1
Newcomer

I'm looking for a way to determine if requested pods is equal to the running pods for specific apps in a specific namespace on a specific Kubernetes cluster.

 

Ideally if running pods = 0 we throw an alert with status CRITICAL,

and if we run bear minimum 1 pod ( or more ) of mentioned app we alert with status WARN, when the Running pods is less than the requested pods.

 

Kind rgds,

 

Peter

1 REPLY 1

islam_zidan
Champion

Hello,

Please check the below query, this will list the desired pod and the running pods. you can modify it to make basic calculations on it, like (desired - running) and is the result is 0 so you are fine.

 

fetch dt.entity.cloud_application_instance, from: -30m
| fields id, pod.id = id, pod.name = entity.name, pod.desired_containers = record(desiredContainersCount),pod.running_containers = record(runningContainersCount)

 

Thanks,

Islam

Dynatrace Certified Professional - Dynatrace Partner - Yourcompass.ca

Featured Posts