Skip to content

Zabbix Template: timedatectl

class: software target: timedatectl vendor: RaBe version: 6.4

Keeps track of the time and date subsystem by running timedatectl status.

Needs the following configuration:

AllowKey=system.run[/usr/bin/timedatectl show]

See here for more information about timedatectl.

This template is part of RaBe's Zabbix template and helpers collection.

Items

Item: timedatectl: NTP service status

component: timedatectl

NTP service status

rabe.timedatectl.status.ntp_service

Settings:

Item Setting Value
Type DEPENDENT
History 7d
Source item system.run[/usr/bin/timedatectl show]

Preprocessing steps:

Type Parameters
REGEX ["NTP=(.*)", "\\1"]
JAVASCRIPT ["return {\"yes\": 1, \"no\": 0}[value]"]
DISCARD_UNCHANGED_HEARTBEAT ["5m"]

Item: timedatectl: RTC in local TZ

component: timedatectl

Is the RTC in local TZ?

rabe.timedatectl.status.rtc_in_local_tz

Settings:

Item Setting Value
Type DEPENDENT
History 7d
Source item system.run[/usr/bin/timedatectl show]

Preprocessing steps:

Type Parameters
REGEX ["LocalRTC=(.*)", "\\1"]
JAVASCRIPT ["return {\"yes\": 1, \"no\": 0}[value]"]
DISCARD_UNCHANGED_HEARTBEAT ["5m"]

Item: timedatectl: System clock synchronized

component: timedatectl

Is the system clock synchronized?

rabe.timedatectl.status.system_clock_synchronized

Settings:

Item Setting Value
Type DEPENDENT
History 7d
Source item system.run[/usr/bin/timedatectl show]

Preprocessing steps:

Type Parameters
REGEX ["NTPSynchronized=(.*)", "\\1"]
JAVASCRIPT ["return {\"yes\": 1, \"no\": 0}[value]"]
DISCARD_UNCHANGED_HEARTBEAT ["5m"]

Item: timedatectl: Time zone

component: timedatectl

Time zone

rabe.timedatectl.status.time_zone

Settings:

Item Setting Value
Type DEPENDENT
Value type TEXT
History 7d
Source item system.run[/usr/bin/timedatectl show]

Preprocessing steps:

Type Parameters
REGEX ["Timezone=(.*)", "\\1"]
DISCARD_UNCHANGED_HEARTBEAT ["1d"]

Item: timedatectl: Get status

component: raw

Get output from timedatectl status.

system.run[/usr/bin/timedatectl show]

Settings:

Item Setting Value
Type ZABBIX_ACTIVE
Value type TEXT

Triggers

Trigger: timedatectl: NTP not active

scope: notice

The NTP service is not active, check timedatectl status for more info. Settings:

Trigger Setting Values
Priority WARNING
last(/timedatectl/rabe.timedatectl.status.ntp_service)<>1

Trigger: timedatectl: RTC not in local TZ

scope: notice

The RTC not in local TZ, check timedatectl status for more info. Settings:

Trigger Setting Values
Priority INFO
last(/timedatectl/rabe.timedatectl.status.rtc_in_local_tz)<>0

Trigger: timedatectl: NTP not synchronized

scope: availability scope: notice

NTP is not in sync, check timedatectl status for more info. Settings:

Trigger Setting Values
Priority INFO
last(/timedatectl/rabe.timedatectl.status.system_clock_synchronized)<>1

Trigger: timedatectl: NTP not synchronized for more than {$TIMEDATECTL_MAX_NO_SYNC_TIME}

scope: availability

NTP is not in sync, check timedatectl status for more info. Settings:

Trigger Setting Values
Priority WARNING
last(/timedatectl/rabe.timedatectl.status.system_clock_synchronized,{$TIMEDATECTL_MAX_NO_SYNC_TIME})<1

Macros

The following Zabbix macros are configured via this template.

Macro: {$TIMEDATECTL_MAX_NO_SYNC_TIME}

How long can time be out if sync before we care?

Default:

60m

License

This template is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, version 3 of the License.

Copyright (c) 2017 - 2024 Radio Bern RaBe