Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding different metricies in grafana from prometheus

I have different metrices in prometheus counter_metrics a, couneter_metrices b and I want a singlestat for the count of all the different request metrics.

How am I able to fetch this?

(sum(couneter_metrics{instance="a,job="b"}))+
like image 974
rajshree Avatar asked Jul 27 '17 06:07

rajshree


People also ask

How does Prometheus and Grafana integrate with each other?

Prometheus is a monitoring solution for storing time series data like metrics. Grafana allows to visualize the data stored in Prometheus (and other sources). This sample demonstrates how to capture NServiceBus metrics, storing these in Prometheus and visualizing these metrics using Grafana.

How do you join two metrics Prometheus?

PromQL supports the ability to join two metrics together: You can append a label set from one metric and append it to another at query time. This can be useful in Prometheus rule evaluations, since it lets you generate a new metric for a series by appending labels from another info metric.

How do I use mixed data source in Grafana?

You can enable this by selecting the built in -- Mixed -- data source. When selected this will allow you to specify data source on a per query basis. This will, for example, allow you to plot metrics from different Graphite servers on the same Graph or plot data from Elasticsearch alongside data from Prometheus.


1 Answers

For the singlestat panel, you can just sum the two metrics and then add them together. Here is an example with two different metrics:

sum(prometheus_local_storage_memory_series) + sum(counters_logins)

Recommended reading, just in case you are doing anything with rates as well: https://www.robustperception.io/rate-then-sum-never-sum-then-rate/

like image 192
Daniel Lee Avatar answered Sep 29 '22 15:09

Daniel Lee