Custom Time Range Specific Panel on Same Dashboard

Hi All,

If I am having custom from and to unix timestamp, then how can I show the data between the custom time range for the specific graph in the dashboard?


in the variable

$interval_pre_from = 1696154400 (Sunday, October 1, 2023 10:00:00 AM)

$interval_pre_to = 1696327140 (Tuesday, October 3, 2023 9:59:00 AM)

I want to show the cpu utilization between the time range for only that specific panel in the dashboard. How can we archive this? Any idea?

What datasource

Hi @yosiasz ,

Data source : prometheus (promql query)

Promql Query : To find the CPU utilization

clamp_max(sum by () ((avg by (mode) ( (clamp_max(rate(node_cpu_seconds_total{node_name=~"$node_name",mode=~"user|system|steal|irq|nice|softirq"}[$interval]),1)) or (clamp_max(irate(node_cpu_seconds_total{node_name=~"$node_name",mode=~"user|system|steal|irq|nice|softirq"}[5m]),1)) )) *100 or (avg_over_time(node_cpu_average{node_name=~"$node_name", mode=~"user|system|steal|irq|nice|softirq"}[$interval]) or avg_over_time(node_cpu_average{node_name=~"$node_name", mode=~"user|system|steal|irq|nice|softirq"}[5m]))),100)

Could you please update on this ?

Any idea or solution for this ?

Hi @asuwini

You can follow this post which explains very well as how to define a custom time range for a specific panel.

I hope this helps.

Hi @usman.ahmad ,

Thanks for replying.

I have refered the solution which you have shared.

Utilizing relative time settings enables us to conveniently examine data from the past hour, day, week, month, and so on. However, the challenge arises when I intend to display panel graphs for a particular time range defined by a specific date and time (YYYY-MM-DD HH:mm:ss).

My goal is to compare the two graphs visually with different time range in a single dashboard.

example :

Panel A : Time range - 2023-10-04 09:00:00 - 2023-10-04 15:59:59

Panel B : Time range - 2023-10-07 09:00:00 - 2023-10-07 15:59:59

Current Time: 2023-10-11 22:00:00 (grafana Timepicker)

1 Like

Just to rephrase it to be sure. You want to have two panels looking at periods relative to the time range selected in Grafana ?

Example: I select 2023-10-11 from 00:00 to 23:59 => I expect:

  • One panel looking at 2023-10-10 from 00:00 to 23:59 (shift 24h, or any other preselected value)
  • One panel looking at 2023-10-09 from 00:00 to 23:59 (shift 48h, or any other preselected value)