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
0
votes
1 answer

How to write a PromQL unit test to check that an alarm doesn't fire?

I'm starting to write unit tests for Prometheus PromQL alerts using promtool test rules. Basic tests work, but I'd also like to write tests that check whether an alarm didn't fire for a certain series of values. Is this possible and how would I…
0
votes
1 answer

PromQL metric query returning other metrics than what I want

I must just not understand PromQL yet, but everything I read says this query should work fine: node_cpu Really simple right? Name of my metric, and I do get them in my result…
Max DiOrio
  • 23
  • 5
0
votes
1 answer

Aggregating labels between timeseries

I have metrics that look like this: myMetric{client="A",server="1",otherlabel="W"} 10 myMetric{client="A",server="2",otherlabel="X"} 21 myMetric{client="B",server="1",otherlabel="Y"} 32 myMetric{client="B",server="4",otherlabel="Z"} 43 I'm trying…
aayore
  • 663
  • 5
  • 12
0
votes
1 answer

Why does `count_over_time` increase without matching raw data?

... or "How does count_over_time work?" Given the following vector and value: kube_job_created{ app="prometheus", chart="prometheus-7.1.0", component="kube-state-metrics", heritage="Tiller", instance="100.96.2.23:8080", …
Enrico Stahn
  • 2,967
  • 1
  • 23
  • 23
-1
votes
1 answer

PromQL and node-exporter: Peak CPU usage during last minute averaged over many servers

Based on this answer I was trying to obtain peak CPU usage during last minute averaged over many servers. Here is my query: max_over_time(sum(1-rate(node_cpu_seconds_total{mode="idle",instance!="epgp003:9401"}[1m]))by(instance)) However I get this…
user1876484
  • 610
  • 6
  • 16
-1
votes
2 answers

How to get counter metric raw values corrected for resets in promql?

I have a counter in prometheus I want to plot it's raw value, but accounted for resets, i.e. if it goes raw: 0 1 4 6 1 3 4 res: 0 1 4 6 7 10 14 ^ reset And then I want also subtract the value at left point, so I'll get the…
Masafi
  • 151
  • 2
  • 15
-1
votes
1 answer

PromQL to find the mean response time of a downstream service

What would be the correct PromQL to find the mean latency of the downstream calls. We are using the given promQL to find the p99 of the downstream service: histogram_quantile(0.99,…
tusharRawat
  • 719
  • 10
  • 24
-1
votes
1 answer

How can we read variables from file and use them in promql query?

I have configured docker container and host dashboard in grafana. By default it shows data for all docker containers: Note that their are two docker stacks / swarms: xyz_stack_1 and xyz_stack_1_monitoring. xyz_stack is docker swarm of my react web…
MsA
  • 2,599
  • 3
  • 22
  • 47
-1
votes
1 answer

Resize/Reshape Grafana Graph for a time frame and non zero values

My current query: locust_user_count Graph: Problem: If you see the graph, you see for the most part there is little to no data (mostly 0 values), but there's a big bump in between. What I want to achieve is 2 things The graph only displays non…
Viv
  • 1,706
  • 1
  • 18
  • 27
-1
votes
1 answer

Using Prometheus, How to use the selected period of time in a query for getting Grafana's data?

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,…
-1
votes
1 answer

Project two or more columns with Prometheus metrics into one field and add characters between the values

I have 3 metrics generated by sql_exporter that are showing corresponding SQL instance uptime part: mssql_server_uptime_days - >=0 mssql_server_uptime_hours - >=0 <24 mssql_server_uptime_minutes - >=0 <60 I'd like to show total uptime of instance…
Blax
  • 35
  • 6
-1
votes
1 answer

Parsing a multi valued custom variable in Grafana

Following is the code snippet max_over_time(PrometheusMetric_$Region{job="JOBNAME"}[1m]) which is taking a custom variable made in Grafana named Region which can take values from {North_Europe, East_US, Southeast_Asia}. I want that while viewing…
Adriraj
  • 9
  • 2
-1
votes
1 answer

How to get avg cpu, disk, memory usage in prometheus (promql) of my linux and windows servers #prometheus #grafana

How to get avg cpu, disk, memory usage in prometheus (promql) of my linux and windows nodes ? #prometheus #grafana Please guide me a little bit, I have tried lot of techniques but unable to measure.
-1
votes
2 answers

How to calculate the percentage of values greater than 0 in PromQL (Prometheus)

Please, can somebody explain to me how to get percentage of values greater than 0 in PromQL. I know that i can get vector values greater than 0 with this: TS_VEC>0. I think i need something like…
max
  • 11
  • 3
-1
votes
1 answer

How to define multiple graphs with 1 sql-query

When i use prometheus (promql) in grafana as datasource i can define a single query that shows multiple graphs on the same panel (e.g. http_requests_total shows all http request). Now i would like to do the same with a sql datasource. I have a table…
sge
  • 391
  • 2
  • 16
1 2 3
59
60