# PromQL

**URL:** https://discuss.prometheus.io/c/promql/6.md?page=1

[Latest](https://discuss.prometheus.io/latest.md) · [Categories](https://discuss.prometheus.io/categories.md)

**Page:** 2

---

## [Which metric will be last](https://discuss.prometheus.io/t/which-metric-will-be-last/2287)

<div class="topic-metadata">

**Author:** [@avkva](https://discuss.prometheus.io/u/avkva)\
**Replies:** 0\
**Last updated:** [June 3, 2024, 9:02am UTC](https://discuss.prometheus.io/t/which-metric-will-be-last/2287 "2024-06-03T09:02:17Z")

</div>

Hello. I need to get information for be sure. I have a one topic, but our kafka klaster is generationg a new consumer with same name which writes to topic. For example: uuid-patr always is different \[ { …

---

## [Joining two metrics](https://discuss.prometheus.io/t/joining-two-metrics/2064)

<div class="topic-metadata">

**Author:** [@Abhilash1](https://discuss.prometheus.io/u/Abhilash1)\
**Replies:** 1\
**Last updated:** [May 24, 2024, 5:21pm UTC](https://discuss.prometheus.io/t/joining-two-metrics/2064 "2024-05-24T17:21:13Z")

</div>

Hello Team, I have been trying to join two metrics, But whenever I add an operator, I get no data. Could someone help me figure it out? topk(5, stddev(container\_memory\_usage{k8s\_cluster\_name=“lab”}) by (k8s\_container\_…

---

## [Finding timestamp of min (or max) reading](https://discuss.prometheus.io/t/finding-timestamp-of-min-or-max-reading/1301)

<div class="topic-metadata">

**Author:** [@grifferz](https://discuss.prometheus.io/u/grifferz)\
**Replies:** 1\
**Last updated:** [May 5, 2024, 3:22am UTC](https://discuss.prometheus.io/t/finding-timestamp-of-min-or-max-reading/1301 "2024-05-05T03:22:46Z")

</div>

I’m trying to find the timestamp for the maximum or minimum reading. From what I understand this is difficult but a workaround was posted in issue #8966. So let’s say I have a metric called “temp” which is temperature i…

---

## [Query label\_replace function](https://discuss.prometheus.io/t/query-label-replace-function/2262)

<div class="topic-metadata">

**Author:** [@Gowthamoptit](https://discuss.prometheus.io/u/Gowthamoptit)\
**Replies:** 0\
**Last updated:** [May 2, 2024, 1:52pm UTC](https://discuss.prometheus.io/t/query-label-replace-function/2262 "2024-05-02T13:52:37Z")

</div>

label\_replace( (global\_peers\_details), “peers\_1”, "$1\[$1\] & $2\[$2\] ", “peers\_1”, “(.),(.)” ) I have 3 nodes cluster. so The metric will shows the current node where it connects with other two nodes through label p…

---

## [Query Double Check](https://discuss.prometheus.io/t/query-double-check/2256)

<div class="topic-metadata">

**Author:** [@sjohn24](https://discuss.prometheus.io/u/sjohn24)\
**Replies:** 0\
**Last updated:** [April 29, 2024, 9:30pm UTC](https://discuss.prometheus.io/t/query-double-check/2256 "2024-04-29T21:30:07Z")

</div>

Hey All, I just wanted to double check a query I wrote. I have a switch that returns its port operating status 1 = up, 2 = down. We have some unused ports that are kept off so I don’t really need to report on those, I …

---

## [How to fulfill multiple incomplete series with zeros](https://discuss.prometheus.io/t/how-to-fulfill-multiple-incomplete-series-with-zeros/2197)

<div class="topic-metadata">

**Author:** [@yuri-rs](https://discuss.prometheus.io/u/yuri-rs)\
**Replies:** 0\
**Last updated:** [March 11, 2024, 3:48pm UTC](https://discuss.prometheus.io/t/how-to-fulfill-multiple-incomplete-series-with-zeros/2197 "2024-03-11T15:48:43Z")

</div>

I have multiple series with incomplete data, and I want to fill each series with zeros. I can achieve this for a single series by appending OR on() vector(0) to the end of the PromQL query. However, this method doesn’t …

---

## [Total bytes received over a period of time](https://discuss.prometheus.io/t/total-bytes-received-over-a-period-of-time/2171)

<div class="topic-metadata">

**Author:** [@techGUY](https://discuss.prometheus.io/u/techGUY)\
**Replies:** 0\
**Last updated:** [March 1, 2024, 5:56pm UTC](https://discuss.prometheus.io/t/total-bytes-received-over-a-period-of-time/2171 "2024-03-01T17:56:28Z")

</div>

I’m using Fluentd to forward logs to Prometheus, querying Prometheus every 15 seconds. Within Prometheus, there are multiple workers and nodes. I aim to calculate the total bytes of logs received per each appcode, consol…

---

## [Offsetting by 1 year minus 1 day](https://discuss.prometheus.io/t/offsetting-by-1-year-minus-1-day/2159)

<div class="topic-metadata">

**Author:** [@pierric](https://discuss.prometheus.io/u/pierric)\
**Replies:** 0\
**Last updated:** [February 22, 2024, 1:30pm UTC](https://discuss.prometheus.io/t/offsetting-by-1-year-minus-1-day/2159 "2024-02-22T13:30:21Z")

</div>

Hi, I’m very much a beginner with PromQL. I have the following use case. I gather solar production data from Home Assistant via Prometheus to build charts in Grafana. One of the charts I have built shows the peak produc…

---

## [Service monitoring](https://discuss.prometheus.io/t/service-monitoring/2102)

<div class="topic-metadata">

**Author:** [@phelipelui](https://discuss.prometheus.io/u/phelipelui)\
**Replies:** 0\
**Last updated:** [January 11, 2024, 6:29pm UTC](https://discuss.prometheus.io/t/service-monitoring/2102 "2024-01-11T18:29:45Z")

</div>

Hello, is it possible to list all hosts that does not have some service ? There are some monitored VMs and we need to know how many does not have the “monit.service” regards.

---

## [Differentiate between odd/even values](https://discuss.prometheus.io/t/differentiate-between-odd-even-values/2097)

<div class="topic-metadata">

**Author:** [@dot1q](https://discuss.prometheus.io/u/dot1q)\
**Replies:** 2\
**Last updated:** [January 10, 2024, 2:41pm UTC](https://discuss.prometheus.io/t/differentiate-between-odd-even-values/2097 "2024-01-10T14:41:24Z")

</div>

Hi, I’m monitoring the throughput of a given session, and each session comes with its value for the bandwidth itself, and a pair of IDs (PDRs), which increases per session created, where the odd number is the uplink and…

---

## [Histogram quantile appears to be ignoring the \`le\` label selector](https://discuss.prometheus.io/t/histogram-quantile-appears-to-be-ignoring-the-le-label-selector/2073)

<div class="topic-metadata">

**Author:** [@lexi-k](https://discuss.prometheus.io/u/lexi-k)\
**Replies:** 0\
**Last updated:** [December 21, 2023, 1:26pm UTC](https://discuss.prometheus.io/t/histogram-quantile-appears-to-be-ignoring-the-le-label-selector/2073 "2023-12-21T13:26:52Z")

</div>

Hello, when playing with the histogram\_quantile function I stumbled upon this interesting behavior. When I create plot of histogram\_quantile like so: histogram\_quantile(0.5, rate(test\_seconds\_bucket{job="test-job", sourc…

---

## [Trigger an alarm when no data received or no more data received](https://discuss.prometheus.io/t/trigger-an-alarm-when-no-data-received-or-no-more-data-received/1989)

<div class="topic-metadata">

**Author:** [@benoittgt](https://discuss.prometheus.io/u/benoittgt)\
**Replies:** 4\
**Last updated:** [November 6, 2023, 3:16pm UTC](https://discuss.prometheus.io/t/trigger-an-alarm-when-no-data-received-or-no-more-data-received/1989 "2023-11-06T15:16:51Z")

</div>

Hello I am building a alerting mechanism an also a graph when I need to inform when there is no data coming since 6 hours (missing or no increase). I need to count only office opening hours (from 8am to 7pm, no week-end…

---

## [Query for used heap size after full GC](https://discuss.prometheus.io/t/query-for-used-heap-size-after-full-gc/1985)

<div class="topic-metadata">

**Author:** [@dgamz](https://discuss.prometheus.io/u/dgamz)\
**Replies:** 0\
**Last updated:** [October 25, 2023, 7:52am UTC](https://discuss.prometheus.io/t/query-for-used-heap-size-after-full-gc/1985 "2023-10-25T07:52:56Z")

</div>

I’m currently looking for a query that would return the used heap-size after a full GC run occured. The goal is to suggest a calculated value for the -XmxN parameter, based on the return value I am looking for. I know …

---

## [Delta rollup in Splunk](https://discuss.prometheus.io/t/delta-rollup-in-splunk/1982)

<div class="topic-metadata">

**Author:** [@Abhilash1](https://discuss.prometheus.io/u/Abhilash1)\
**Replies:** 0\
**Last updated:** [October 23, 2023, 5:19pm UTC](https://discuss.prometheus.io/t/delta-rollup-in-splunk/1982 "2023-10-23T17:19:32Z")

</div>

Hello Team, I need your guidance to identify delta rollup in Splunk, Delta: For \[cumulative counter metrics, the rate is the difference between the data point for the current time interval and the data point for the …

---

## [Compare morning data with evening?](https://discuss.prometheus.io/t/compare-morning-data-with-evening/1960)

<div class="topic-metadata">

**Author:** [@rgcosma](https://discuss.prometheus.io/u/rgcosma)\
**Replies:** 2\
**Last updated:** [October 18, 2023, 8:07am UTC](https://discuss.prometheus.io/t/compare-morning-data-with-evening/1960 "2023-10-18T08:07:16Z")

</div>

Hi - we’re trying some cost saving by shutting down K8s clusters at night, and want to use Prometheus for a sanity check: how many pods were running before shutdown vs how many came back up. Assuming shutdown would be …

---

## [How to merge this query](https://discuss.prometheus.io/t/how-to-merge-this-query/1934)

<div class="topic-metadata">

**Author:** [@Abhilash1](https://discuss.prometheus.io/u/Abhilash1)\
**Replies:** 6\
**Last updated:** [October 6, 2023, 6:03am UTC](https://discuss.prometheus.io/t/how-to-merge-this-query/1934 "2023-10-06T06:03:05Z")

</div>

Can someone help with promql? Query A: k8s\_pod\_phase{k8s\_cluster\_name=“$cluster\_name”, k8s\_node\_name=~“.vm.”} ==2 Query B: sum(k8s\_container\_cpu\_request{k8s\_cluster\_name=“$cluster\_name”, k8s\_node\_name=~“.vm.”}) Query…

---

## [Maping query label value between query](https://discuss.prometheus.io/t/maping-query-label-value-between-query/1926)

<div class="topic-metadata">

**Author:** [@lmq1999](https://discuss.prometheus.io/u/lmq1999)\
**Replies:** 1\
**Last updated:** [October 3, 2023, 2:42pm UTC](https://discuss.prometheus.io/t/maping-query-label-value-between-query/1926 "2023-10-03T14:42:10Z")

</div>

I have 2 query like this: query A: autoscaling\_group\_desired\_capacity{monitor=“autoscaling\_group”, is\_cloud\_provider=“True”, cluster\_name=~“.\*.”} query B: sum(kubelet\_node\_name{pool\_name=~“.\*.”, monitor=~“kubernetes-en…

---

## [Calculation ignores value of 0 in PromQL](https://discuss.prometheus.io/t/calculation-ignores-value-of-0-in-promql/1924)

<div class="topic-metadata">

**Author:** [@ilbeygi](https://discuss.prometheus.io/u/ilbeygi)\
**Replies:** 0\
**Last updated:** [October 1, 2023, 12:19pm UTC](https://discuss.prometheus.io/t/calculation-ignores-value-of-0-in-promql/1924 "2023-10-01T12:19:56Z")

</div>

Hello In prometheus for showing disk write usage on a chart, we use the following query: sum\_over\_time(increase(diskWriteBytes{vid=“112345”}\[1d\] offset -1d )\[1d:1d\]) On diskWriteBytes, we sometimes see a value of 0. …

---

## [AlertManagerConfig and PrometheusRule does not work for targets that are not in the monitoring namespace](https://discuss.prometheus.io/t/alertmanagerconfig-and-prometheusrule-does-not-work-for-targets-that-are-not-in-the-monitoring-namespace/1862)

<div class="topic-metadata">

**Author:** [@Golide](https://discuss.prometheus.io/u/Golide)\
**Replies:** 0\
**Last updated:** [September 6, 2023, 11:11am UTC](https://discuss.prometheus.io/t/alertmanagerconfig-and-prometheusrule-does-not-work-for-targets-that-are-not-in-the-monitoring-namespace/1862 "2023-09-06T11:11:29Z")

</div>

0 I have an existing CronJob for which I have setup alerts. The alerts are working when the CronJob is scheduled in the ‘monitoring’ namespace. I am using Kube-Prometheus stack and it is also deployed in the ‘monitoring…

---

## [PromQL shows different results in two k8s clusters](https://discuss.prometheus.io/t/promql-shows-different-results-in-two-k8s-clusters/1823)

<div class="topic-metadata">

**Author:** [@Paul](https://discuss.prometheus.io/u/Paul)\
**Replies:** 11\
**Last updated:** [September 5, 2023, 2:38pm UTC](https://discuss.prometheus.io/t/promql-shows-different-results-in-two-k8s-clusters/1823 "2023-09-05T14:38:06Z")

</div>

I’ve been using Grafana Dashboards for some time to monitor K8’s cluster. For this I use parts of the Grafana Dashboard page (Kubernetes cluster monitoring (via Prometheus)). But I currently have different behavior on …

---

## [Fix KubeVersionMismatch](https://discuss.prometheus.io/t/fix-kubeversionmismatch/1802)

<div class="topic-metadata">

**Author:** [@alterEgo123](https://discuss.prometheus.io/u/alterEgo123)\
**Replies:** 0\
**Last updated:** [August 7, 2023, 1:41pm UTC](https://discuss.prometheus.io/t/fix-kubeversionmismatch/1802 "2023-08-07T13:41:02Z")

</div>

Kube-proxy must not be newer than kube-apiserver, and may be up to two minor versions older. Kube-proxy may be up to two minor versions older or newer than the kubelet. Kubelet must not be newer than kube-apiserver, an…

---

## [Alert on increase in slow increasing prometheus counter not working due to resetarts](https://discuss.prometheus.io/t/alert-on-increase-in-slow-increasing-prometheus-counter-not-working-due-to-resetarts/1793)

<div class="topic-metadata">

**Author:** [@pramodka-revefi](https://discuss.prometheus.io/u/pramodka-revefi)\
**Replies:** 1\
**Last updated:** [August 4, 2023, 5:27am UTC](https://discuss.prometheus.io/t/alert-on-increase-in-slow-increasing-prometheus-counter-not-working-due-to-resetarts/1793 "2023-08-04T05:27:12Z")

</div>

We have a counter for some operation, say some\_counter. This counter is increased each time the operation is performed for each customer (customer\_id is the label). And the operation is usually performed once per day. F…

---

## [Drop filler values from time series (Scraper or PromQL)](https://discuss.prometheus.io/t/drop-filler-values-from-time-series-scraper-or-promql/1789)

<div class="topic-metadata">

**Author:** [@magonreal](https://discuss.prometheus.io/u/magonreal)\
**Replies:** 1\
**Last updated:** [August 3, 2023, 9:52pm UTC](https://discuss.prometheus.io/t/drop-filler-values-from-time-series-scraper-or-promql/1789 "2023-08-03T21:52:05Z")

</div>

Hi everyone, I have a question about a temperature time-series data. I have a temperature sensor which is connected to Home-Assistant. Prometheus scrapes the data from Home-Assistant, which I then want to plot using G…

---

## [How to generate alert only when metric is absent 5min ago](https://discuss.prometheus.io/t/how-to-generate-alert-only-when-metric-is-absent-5min-ago/1777)

<div class="topic-metadata">

**Author:** [@Abi](https://discuss.prometheus.io/u/Abi)\
**Replies:** 0\
**Last updated:** [July 27, 2023, 3:11pm UTC](https://discuss.prometheus.io/t/how-to-generate-alert-only-when-metric-is-absent-5min-ago/1777 "2023-07-27T15:11:38Z")

</div>

A metric was present 5 mins ago Currently metric is not present I need to create an alert expression only when metric was present 5 mins ago and currently not present. After this alert is generated, When metric is abse…

---

## [Passing output from subqueries](https://discuss.prometheus.io/t/passing-output-from-subqueries/1772)

<div class="topic-metadata">

**Author:** [@sunilsunderrajdev](https://discuss.prometheus.io/u/sunilsunderrajdev)\
**Replies:** 0\
**Last updated:** [July 26, 2023, 1:31pm UTC](https://discuss.prometheus.io/t/passing-output-from-subqueries/1772 "2023-07-26T13:31:30Z")

</div>

I have a subquery use case Get a list of servers from a metric and loop through that list in another query This query works if I hard code the hostname say “H1” (2 - ((avg(host\_availability{host=“H1”}) \< bool 99.9) + …

---

## [Vector contains metrics with the same labelset after applying rule labels](https://discuss.prometheus.io/t/vector-contains-metrics-with-the-same-labelset-after-applying-rule-labels/1769)

<div class="topic-metadata">

**Author:** [@Golide](https://discuss.prometheus.io/u/Golide)\
**Replies:** 0\
**Last updated:** [July 25, 2023, 9:14am UTC](https://discuss.prometheus.io/t/vector-contains-metrics-with-the-same-labelset-after-applying-rule-labels/1769 "2023-07-25T09:14:03Z")

</div>

I have setup a Cronjob for a container that exits with a non-zero code. I have a PrometheusRule and AlertManagerConfig setup against this CronJob but the alert is not firing as expected. The alerting is based on this exa…

---

## [Use regex in metric name](https://discuss.prometheus.io/t/use-regex-in-metric-name/1753)

<div class="topic-metadata">

**Author:** [@abhi60444](https://discuss.prometheus.io/u/abhi60444)\
**Replies:** 0\
**Last updated:** [July 12, 2023, 6:39pm UTC](https://discuss.prometheus.io/t/use-regex-in-metric-name/1753 "2023-07-12T18:39:10Z")

</div>

Hi Team, I am generating a dynamic metrics by using avalanche load testing tools & want to create a regex like this avalanche\_metric\_mmmmm\_\_ so that I can cover all metrics with different numbers in one grafana dashboar…

---

## [Filtering and selecting by label](https://discuss.prometheus.io/t/filtering-and-selecting-by-label/1730)

<div class="topic-metadata">

**Author:** [@Remy](https://discuss.prometheus.io/u/Remy)\
**Replies:** 0\
**Last updated:** [June 30, 2023, 9:14am UTC](https://discuss.prometheus.io/t/filtering-and-selecting-by-label/1730 "2023-06-30T09:14:14Z")

</div>

Hello, How to obtain the most recent metric, by selecting and ignoring labels. For example, the following query: last\_over\_time(application\_version{site="NYC", instance="Test", id!=""}\[1h\]) Returns the following item…

---

## [CPU usage query with different time range](https://discuss.prometheus.io/t/cpu-usage-query-with-different-time-range/1723)

<div class="topic-metadata">

**Author:** [@inmar](https://discuss.prometheus.io/u/inmar)\
**Replies:** 0\
**Last updated:** [June 28, 2023, 12:55pm UTC](https://discuss.prometheus.io/t/cpu-usage-query-with-different-time-range/1723 "2023-06-28T12:55:26Z")

</div>

Hi guys Regarding PromQL I am struggling with some queries to determine the CPU usage of Windows. When I am using irate twice with different ranges of time I am getting the exact result. How can it be that the usage w…

---

## [How to query metrics for a specific time](https://discuss.prometheus.io/t/how-to-query-metrics-for-a-specific-time/1687)

<div class="topic-metadata">

**Author:** [@mb8](https://discuss.prometheus.io/u/mb8)\
**Replies:** 0\
**Last updated:** [June 2, 2023, 1:27am UTC](https://discuss.prometheus.io/t/how-to-query-metrics-for-a-specific-time/1687 "2023-06-02T01:27:51Z")

</div>

When I run this curl command containing the PromQL query: curl -s -G "http://10.192.248.10:30000/api/v1/query" --data-urlencode "query=http\_requests\_total @ 1685668320" | jq I get a response with this value: "value": …

[Previous page](https://discuss.prometheus.io/c/promql/6.md)

[Next page](https://discuss.prometheus.io/c/promql/6.md?page=2)
