Skip to content

Grafana

https://grafana.com/blog/2020/09/28/new-in-grafana-7.2-__rate_interval-for-prometheus-rate-queries-that-just-work/

tldr: use $__rate_interval with prometheus

Terminal window
# get all metrics names for recent data:
# see https://promlabs.com/blog/2020/12/17/promql-queries-for-exploring-your-metrics
group by(__name__) ({__name__!=""})
# Getting all series in the TSDB from recent data:
{__name__!=""}
# näppärä loitsu, näyttää time seriesin labeleitten cardinaliteetin
sort_desc(label_replace(count by(__name__) ({__name__=~".+"}), "name", "$1", "__name__", "(.+)"))
fields @timestamp, @message
| FILTER @message LIKE /Entering phase|Phase complete/
| sort @timestamp asc
Terminal window
# Port-forward Grafana to localhost 3000
kubectl -n monitoring port-forward pods/grafana-0 3000
export GRAFANA_API_TOKEN=xxxx
export GRAFANA_URL=http://localhost:3000
docker run -p 8080:8080 --net="host" prom/promlens --grafana.url=$GRAFANA_URL --grafana.api-token=$GRAFANA_API_TOKEN