agapoff / check_kubernetes

Nagios/Icinga/Zabbix style plugin for checking Kubernetes
64 stars 36 forks source link

Have jq skip over pods without containerStatuses #21

Closed robertpenberthy closed 3 years ago

robertpenberthy commented 3 years ago

A pending pod will not have any containerStatuses as the container has yet to be deployed and this line of code errors with jq: error (at <stdin>:5): Cannot iterate over null (null) on any pod with a pending status (in my case because I purposefully made the pod schedulable) on my nodes. Adding the ? will have jq skip over instances that do not have results.

agapoff commented 3 years ago

Thank you