1
votes

I've kubernetes cluster and adding a monitoring using Prometheus and Grafana, I want to display total numbers in grafana, namely nodes ready vs total number of nodes available. I'm unable represent it in neither singlestat(as name indicates only one value), gauge(can't dynamically set max), and text(can't dynamically set content)

Below are my two queries. first query:

sum(kube_node_status_condition{condition="Ready"})

second query:

sum(kube_node_info)
1

1 Answers

0
votes

I might be misunderstanding the question, but from what I read, you want 2 results shown up against each other.

Why not just create a dashboard with 2 singlestats, each representing a query. A graph is easily also an option if you want both queries displayed and visualized on the same display (just create a query A and query B).

For inspiration check out the official demo-site for prometheus on Grafana: https://play.grafana.org/d/000000029/prometheus-demo-dashboard?orgId=1&refresh=5m

If that's not what you are looking for, then please specify, and I will gladly help.

Update in response to comment

Alright, if you want to perform arithmetic operations then the MetaQueries plugin is definitely an option. Check out the documentation: https://grafana.com/grafana/plugins/goshposh-metaqueries-datasource

Also you can check out the documentation in regards to arithmetic operations using prometheus: https://prometheus.io/docs/prometheus/latest/querying/operators/

TL;DR you've stated that you have the queries ready - have you tried using the '/' (division) operator?