Environment:
- Oracle Linux 8.9
- Grafana 10.2.0
- Zabbix data-source
Scenario:
I have a variable list $month
that is used to time shift a query. It is used on the timeShift
function.
timeShift($month)
This variable has up to 12 values and each one represents a previous month.
1º Prev Month : 1M,2º Prev Month : 2M,3º Prev Month : 3M,4º Prev Month : 4M,5º Prev Month : 5M,6º Prev Month : 6M,7º Prev Month : 7M,8º Prev Month : 8M,9º Prev Month : 9M,10º Prev Month : 10M,11º Prev Month : 11M,12º Prev Month : 12M
In the dashboard header, the user can select the month to view.
If he selects 1M
, the events of the previous month will be displayed. If he selects 2M
, the second to last month events will be displayed, and so on.
Whenever the user selects a month from the list, the raw value is displayed in the dashboard title (example above: PREVIOUS MONTH EVENTS: 3M
).
I wanted to change the display to show the actual month being represented.
In my mind that would be something like this:
Var $month | Value | If January, Display | If February, Display | If March, Display | |
---|---|---|---|---|---|
1º Prev Month | 1M | >> | dez/23 | jan/24 | fev/24 |
2º Prev Month | 2M | >> | nov/23 | dez/23 | jan/24 |
3º Prev Month | 3M | >> | out/23 | nov/23 | dez/23 |
4º Prev Month | 4M | >> | set/23 | out/23 | nov/23 |
5º Prev Month | 5M | >> | ago/23 | set/23 | out/23 |
6º Prev Month | 6M | >> | jul/23 | ago/23 | set/23 |
7º Prev Month | 7M | >> | jun/23 | jul/23 | ago/23 |
8º Prev Month | 8M | >> | mai/23 | jun/23 | jul/23 |
9º Prev Month | 9M | >> | abr/23 | mai/23 | jun/23 |
10º Prev Month | 10M | >> | mar/23 | abr/23 | mai/23 |
11º Prev Month | 11M | >> | fev/23 | mar/23 | abr/23 |
12º Prev Month | 12M | >> | jan/23 | fev/23 | mar/23 |
Is there a way to do this?