# DQL to compare requested pods vs running pods ( k8s )

**URL:** <https://community.dynatrace.com/t/dql-to-compare-requested-pods-vs-running-pods-k8s/46857>\
**Category:** DQL\
**Tags:** dql, dynatrace-managed, kubernetes, pods\
**Created:** [July 29, 2024, 7:02am UTC](https://community.dynatrace.com/t/dql-to-compare-requested-pods-vs-running-pods-k8s/46857 "2024-07-29T07:02:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![PeterDrenth1](https://avatars.discourse-cdn.com/v4/letter/p/b38774/32.png) [@PeterDrenth1](https://community.dynatrace.com/u/PeterDrenth1)\
**Post date:** [July 29, 2024, 7:02am UTC](https://community.dynatrace.com/t/dql-to-compare-requested-pods-vs-running-pods-k8s/46857/1 "2024-07-29T07:02:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Islam\_Zedan](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/islam_zedan/32/31999_2.png) [@Islam\_Zedan](https://community.dynatrace.com/u/Islam_Zedan)\
**Post date:** [July 29, 2024, 8:20am UTC](https://community.dynatrace.com/t/dql-to-compare-requested-pods-vs-running-pods-k8s/46857/2 "2024-07-29T08:20:24Z")

</div>

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
