Skip to main content

Hello 
Im using the centreon_prometheus_api.pl for multiple scenarios , its great, but I found something annoying. 

/centreon_prometheus_api.pl 
--plugin=cloud::prometheus::restapi::plugin
--mode=expression
--hostname=xxxxxxxxx
--url-path='/api/v1'
--port=''
--proto='https'
--query='namespace,sum by (namespace, pod, cluster) (max by (namespace, pod, cluster) (kube_pod_status_phase{job="kube-state-metrics",namespace=~".*",phase=~"Pending|Unknown"}) * on (namespace, pod, cluster) group_left (owner_kind) topk by (namespace, pod, cluster) (1, max by (namespace, pod, owner_kind, cluster) (kube_pod_owner{owner_kind!="Job"}))) > 0'
--instance=namespace
--instance=pod
--output='Pod %{pod} of %{instance} namespace has been in a non-ready state for longer than 15 minutes.'
--critical-status='%{namespace} > 0' --verbose --debug


UNKNOWN: No expressions found.
======> response done
HTTP/1.1 200 OK
Connection: keep-alive
Date: Tue, 30 Jan 2024 11:28:07 GMT
Content-Length: 63
Content-Type: application/json
Client-Date: Tue, 30 Jan 2024 11:28:07 GMT
Client-Peer: 10.0.10.15:443
Client-Response-Num: 1
--
Client-SSL-Cipher: TLS_AES_256_GCM_SHA384
Client-SSL-Socket-Class: IO::Socket::SSL
Client-SSL-Version: TLSv1_3

{"status":"success","data":{"resultType":"vector","result":t]}}


Its working great , until there is atleast 1 pod that matches the query. 

 

In my case, all good, but I get the No expressions found. 

Is there a way to accept empty response ? Must be , but I cannot find it via --help. 

Thanks ! 

Ah, in the end, I filtered too much with this query : 
(kube_pod_owner{owner_kind!="Job"}))) > 0 
But if I remove that it must be > 0 , then I can have an OK state and > 0 still will be Critical. 


Im still interested , that null / empty response can be somehow passed ? If anyone know :)


Reply