I have panel with link to detail dashboard.
I can specify time from and to in dashboard link …&from=now-2h&to=now…
How I can specify in URL params, that I want to use current time range of current dashboard from where I navigate to new dashboard?
I also have this question. Was a solution provided?
I also have this question. Was a solution provided?
Same problem.
I did not find a solution. And yet it’s been a while since I’m looking for …
If you use a query, you can pass the values $ __ timeFrom () AND $ __ timeTo () as columns in SELECT, and in the column style, put it as the hidden type and use the column link parameter {__cell_2} as an example.
Look:
SELECT [FILA_URA], count(*) AS QTDE, REPLACE(CONVERT(VARCHAR(10), __timeFrom(), 120),'-','') AS dt_ini, REPLACE(CONVERT(VARCHAR(10), __timeTo(), 120),’-’,’’) AS dt_fim
FROM YOUR_TABLE
WHERE DATA_HORA BETWEEN __timeFrom() AND __timeTo()
Link:
./d/e4Rlg6umz/filas-ura-canal?orgId=1&var-fila_ura=${__cell}&var-canal=canal&from={__cell_2}&to=${__cell_3}
With date and time:
REPLACE(REPLACE(REPLACE(CONVERT(VARCHAR(19), __timeFrom(), 120),'-',''),'T',' '),':','') AS dt_ini, REPLACE(REPLACE(REPLACE(CONVERT(VARCHAR(19), __timeTo(), 120),’-’,’’),‘T’,’ ‘),’:’,’’) AS dt_fim
If you want to add a time interval for your link - use time variables: &from={__from}&to={__to}.
Hi,
Can you explain how to define these variable ?
Thanks & Regards,
Jalpesh
Hi.
These are predefined variables. They do not need to be defined additionally.
Here is an example of a link to another panel from a recent project:
http: //community.grafana.com / d / Nf2eNY_Wk / ProdPanel? orgId = 1 & fullscreen & panelId = 12 & from = {__from} & to = {__to}
from = {__from} & to = {__to} worked for me.
Thanks
&from=${__from}&to=${__to} worked for me
Better to use ${__url_time_range}
which keep relative format (i.e. now
)
So here is what I did. Since we are using elasticsearch we can get the PIT for data which is in epoch. So I converted it to date time and the just used the “to” for the end.
g=(time:(from:’${__value.time:date::YYYY-MM-DD}’,to:’${__to:date}’))
The data link then provides ~X hours from current date. I never could get a ${__value.time:date::YYYY-MM-DD} + 1h or something to work.
Seems like a minor bug in chrome once we choose the time range instead of overriding the existing URL range it appends to it
i guess it might be due to how the = is interpreted as %3D in URL
ref: squad&from%3Dnow-6h%26to%3Dnow&from=now-24h&to=now
or ${__url_time_range} is resulting in %3D instead of =
tried in chrome & safari as well
Hello @sathishsms !
I’m experiencing the same issue (%3D breaking the URL). Did you ever find a solution / workaround?
&from=${__from}&to=${__to}
is an option but relative time range is lost, as @loganmzz mentioned earlier.
Thank you,
Kaspar
Hi @kkevvai
I use the templating variable I mentionned above: ${__url_time_range}
and it works like a charm.
I am trying to get epoch time (Current time to -12hrs time) in my Panel URL .Below is the URL I am using in my alert -
http://grafana.staged-by-discourse.com/d/OlH8LAXnk/new-dashboard?orgId=1&from=${__from}&to=${__to}&viewPanel=6
But the output is not as expected , PFB screenshot -
This is the URL which got generated in alert-
Panel URL = http://grafana.staged-by-discourse.com/d/OlH8LAXnk/new-dashboard?orgId=1&from=({__from}&to=)&viewPanel=6
Please suggest how to fix this.
I use the templating variable I mentionned above: ${__url_time_range}
and it works like a charm.
hi everyone, i am having hard time to set this up. where do you set this?
i want to set it in annotations, but when the alarm is firing i am getting this:
2nd test alert › request method on nginx
1 firing instances
[Firing ]
request method on nginx
[View alert ]
Summary
URL TIME range
Description
${__url_time_range}
Values
B=14 C=1
Labels
alertname request method on nginx
grafana_folder 2nd test alert
request_method GET
You can use time variables in URL parameters to pass the current time range from one panel to another. For example, instead of explicitly specifying a time range, you can use variables such as $__from and $__to, which will be automatically replaced with the current time range when you move to a new panel. So your URL might look something like this: …&from=$$__from&to=$$__to…