Questions tagged [promql]

Use the promql tag when your question is related to how to formulate promql query strings related to data for which you are querying in Prometheus. Other relevant reasons might exist but this is the main purpose.

901 questions
180
votes
10 answers

Get Total requests in a period of time

I need to show, in Grafana, a panel with the number of requests in the period of time selected in the upper right corner. For this I need to solve 2 issues here, I will ask the prometheus question here and the Grafana question in another link. If I…
Facundo Chambo
  • 3,088
  • 6
  • 20
  • 25
55
votes
3 answers

How can I group labels in a Prometheus query?

If I have a metric with the following labels: my_metric{group="group a"} 100 my_metric{group="group b"} 100 my_metric{group="group c"} 100 my_metric{group="misc group a"} 1 my_metric{group="misc group b"} 2 my_metric{group="misc group c"} …
checketts
  • 14,167
  • 10
  • 53
  • 82
36
votes
2 answers

Prometheus endpoint of all available metrics

I was curious concerning the workings of Prometheus. Using the Prometheus interface I am able to see a drop-down list which I assume contains all available metrics. However, I am not able to access the metrics endpoint which lists all of the scraped…
Tony.H
  • 631
  • 1
  • 6
  • 14
34
votes
3 answers

How to use the selected period of time in a query?

I'm using Grafana with Prometheus and I'd like to build a query that depends on the selected period of time selected in the upper right corner of the screen. Is there any variable (or something like that) to use in the query field? In other words,…
Facundo Chambo
  • 3,088
  • 6
  • 20
  • 25
24
votes
2 answers

Prometheus - Aggregate and relabel by regex

I currently have the following Promql query which allow me to query the memory used by each of my K8S pods: sum(container_memory_working_set_bytes{image!="",name=~"^k8s_.*"}) by (pod_name) The pod's name is followed by a hash defined by…
Mornor
  • 3,471
  • 8
  • 31
  • 69
24
votes
1 answer

Prometheus return no data when calculating a ratio of two metrics

I want to calculate a ratio of two metrics, but I get no data... I have some metrics like: fs_bytes{filesystem="/var",instance="localhost:9108",job="graphite",metric="Used"} …
Franklin Piat
  • 3,952
  • 3
  • 32
  • 45
23
votes
2 answers

multiple values from grafana variable in prometheus query

We have a situation where we need to select the multiple values (instances/servers) from grafana variable field, and multiple values needs to passed to the Prometheus query using some regex, so that i can see selected hosts metrics in single graph.…
Anil Kumar
  • 381
  • 1
  • 2
  • 9
22
votes
2 answers

Simple cumulative increase in Prometheus

I have an application that increments a Prometheus counter when it receives a particular HTTP request. The application runs in Kubernetes, has multiple instances and redeploys multiple times a day. Using the query…
GavinE-OVO
  • 221
  • 2
  • 5
21
votes
1 answer

Prometheus Query Overall average under a time interval

How can I find the overall average of metrics over time interval ? avg(metric) = overall average value but avg_over_time(metrics[interval]) = averages value per label avg( avg_over_time(metric[scrape interval]) ) won't be same as(when the data is…
Vaisakh Rajagopal
  • 1,189
  • 1
  • 14
  • 23
17
votes
3 answers

Query label_values not found in Prometheus

In the Grafana documentation, I found that I should be able to query my Prometheus server for all instances delivering monitoring data using the label_values query. The query I'm using in Grafana is: label_values(up, instance) Unfortunately,…
Tim Hartnack
  • 321
  • 1
  • 3
  • 10
15
votes
2 answers

Omit labels from series results PromQL

Suppose I write a basic PromQL query like this Query: kube_deployment_spec_replicas{}…
Edward
  • 153
  • 1
  • 1
  • 6
15
votes
2 answers

Monitoring CPU Utilization using Prometheus

I am trying to monitor the cpu utilization of the machine in which Prometheus is installed and running. I have a metric process_cpu_seconds_total. I can find irate or rate of this metric. But I am not too sure how to come up with the percentage…
Arnav Bose
  • 791
  • 4
  • 13
  • 27
14
votes
4 answers

How to merge zero values (vector(0) with metric values in PromQL

I'm using flexlm_exporter to export my license usage to Prometheus and from Prometheus to custom service (Not Graphana). As you know Prometheus hides missing values. However, I need those missing values in my metric values, therefore I added to my…
Vibex
  • 171
  • 1
  • 2
  • 8
13
votes
4 answers

Prometheus queries to get CPU and Memory usage in kubernetes pods

I need to get CPU and Memory usage in kubernetes pods with prometheus queries. Can someone plz help?
GihanS
  • 445
  • 2
  • 5
  • 15
12
votes
3 answers

PromQL if/else like expression

I'm trying to calculate easter sunday in PromQL using Gauss's Easter algorithm (I need to ignore some alert rules on public holidays). I can calculate the day, but I'm having a problem with the month as I need something like an if/else expression.…
Mirco
  • 2,940
  • 5
  • 34
  • 57
1
2 3
59 60