Grafana Time zone issue

I am working on Prometheus windows exporter.
windows_os_time metrics will provide the unix epoch time format for a target windows machine.
So in Grafana panel configuration, we can only convert this epoch time to human readable time with browser’s time zone. But is there any option in Grafana where I mention target windows machine’s time zone during the conversion?

Hi @anuprshetty,

Are the timestamps for your data in UTC?

1 Like

Yes. The timestamp is in UTC.

Hi @anuprshetty

Can you include some screenshots of what you’re trying to achieve? I think that might help us answer your question…

@mattabrams
I have a Prometheus server which is scaping metrics from a target windows machine.

In Prometheus portal:
PromQL query to get the current date and time of the target windows machine (In Unix Epoch format):

PromQL query to get the time zone of the target windows machine:

NOTE: Continued my explanation in next reply due to word limits.

Now in Grafana dashboard,
Representing time zone of target windows machine:
image

Problem what I am facing:
I want to represent current date and time of the target windows machine as shown below:
image

NOTE: Continued my explanation in next reply due to word limits.

To represent above date and time panel, I used following PromQL query in the background:

But,
Time zone of the target windows machine → PDT ( Pacific Daylight Time)
Time zone of the browser which I am using to access Grafana dashboard (My workstation) → IST ( Indian Standard time)

NOTE: Continued my explanation in next reply due to word limits.

So by default,
the current date and time in Unix Epoch format of the target windows machine is converted to human readable format (DD/MM/YYYY, HH:MM:SS) by considering browser’s time zone (i.e., IST) instead of target machine’s time zone (i.e., PDT) as shown below:
Target machine time in IST instead of PDT:
image

My workstation (browser) time: (Please ignore 1 min difference due to delay in taking screenshots)
image

NOTE: Continued my explanation in next reply due to word limits.

So my question is how to represent date and time with target windows machine’s time zone (PDT) instead of browser’s time zone (IST)?

I found date and time unit in Grafana panel configuration, but it didn’t help me. Please find the screenshot below:

NOTE: End of explanation.

Thank you in advance.

Is the end goal here to have a dashboard where the local time renders dynamically based on the selected machine?

I don’t want to change my browser’s time and time zone.
When I select a target windows machine in dashboard, the Date and Time panel should show the target machine’s time considering time zone of the target windows machine (PDT). (This is what I am trying to achieve)
But here the problem is, when I select the target windows machine in dashboard, the Date and Time panel showing the target machine’s time considering time zone of my workstation or browser (IST).

@anuprshetty is the target time zone always PDT? And is it ok if all time stamps on the dashboard are shown for PDT? If the answer to both is “yes”, then it’s probably easiest to just set the dashboard time to PDT (from the time picker in the top right) - or even set PDT as a broader default (see https://grafana.com/docs/grafana/latest/administration/preferences/change-grafana-timezone/)

1 Like

This topic was automatically closed after 365 days. New replies are no longer allowed.