Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node_time_zone_offset_seconds - time_zone label does not update until node-exporter is restarted #3197

Open
charliekang opened this issue Dec 3, 2024 · 1 comment

Comments

@charliekang
Copy link

Host operating system: output of uname -a

Linux xxxxxxx 5.15.0-91-generic #101-Ubuntu SMP Tue Nov 14 13:30:08 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

node_exporter version: output of node_exporter --version

node_exporter, version 1.8.2 (branch: HEAD, revision: f1e0e8360aa60b6cb5e5cc1560bed348fc2c1895)
  build user:       root@03d440803209
  build date:       20240714-11:53:45
  go version:       go1.22.5
  platform:         linux/amd64
  tags:             unknown

node_exporter command line flags

default install

node_exporter log output

collector=time
collector=timex
collector=udp_queues
collector=uname
collector=vmstat
collector=watchdog
collector=xfs
collector=zfs

Are you running node_exporter in Docker?

k8s & baremetal

What did you do that produced an error?

Changed the timezone after node-exporter was started. Appears node-exporter needs to be restarted to re-read the timezone.

What did you expect to see?

After changing the timezone, node-exporter should show updated timezone.

Also waited 15+mins to see if there was delay to update

Have to restart node-exporter for it re-read the timezone change

note: yes, timezone should not change but debugging another issue we noticed node-exporter timezone does not update

What did you see instead?

## Initial check - UTC

# timedatectl
               Local time: Tue 2024-12-03 17:57:17 UTC
           Universal time: Tue 2024-12-03 17:57:17 UTC
                 RTC time: Tue 2024-12-03 17:57:38
                Time zone: UTC (UTC, +0000)
System clock synchronized: no
              NTP service: active
          RTC in local TZ: no

# curl localhost:9100/metrics | grep time_zone
# HELP node_time_zone_offset_seconds System time zone offset in seconds.
# TYPE node_time_zone_offset_seconds gauge
node_time_zone_offset_seconds{time_zone="UTC"} 0

## Change timezone - PST

# timedatectl set-timezone America/Los_Angeles

# timedatectl
               Local time: Tue 2024-12-03 09:58:42 PST
           Universal time: Tue 2024-12-03 17:58:42 UTC
                 RTC time: Tue 2024-12-03 17:59:03
                Time zone: America/Los_Angeles (PST, -0800)
System clock synchronized: no
              NTP service: active
          RTC in local TZ: no

# curl -s localhost:9100/metrics | grep time_zone
# HELP node_time_zone_offset_seconds System time zone offset in seconds.
# TYPE node_time_zone_offset_seconds gauge
node_time_zone_offset_seconds{time_zone="UTC"} 0


# systemctl restart node_exporter

# curl -s localhost:9100/metrics | grep time_zone
# HELP node_time_zone_offset_seconds System time zone offset in seconds.
# TYPE node_time_zone_offset_seconds gauge
node_time_zone_offset_seconds{time_zone="PST"} -28800
@discordianfish
Copy link
Member

We take this from time.Now():

now := time.Now()
- surprised that this caches(?) this somehow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants