The default language in the Zabbix user interface (UI) installation is “en_US”, meaning English (US). Probably because of the European roots of Zabbix, the timestamps have still been shown in 24-hour (world-standard) format, up until Zabbix version 6.4.
Now in Zabbix 7.0 the default time display format has been changed to correspond to the selected localization, meaning that also us non-US Zabbix users are shown 12-hour am/pm timestamps by default.
For me the standard way to configure operating systems and applications is to use English language instead of Finnish that is my native language. This is because the Finnish translations (from some other language) are commonly just so bad that it is hard to use the applications. (The notable exceptions are applications that have been developed in Finland: sometimes they have actually used Finnish-speaking people to develop the translations and they know their language.) But whenever possible, I still select a world-standard display format for timestamps even when using English. Sadly Zabbix is not one of the products that offer this capability out of the box.
To enable Zabbix 7.0 to show world-standard 24-hour timestamps, I see two different possibilities:
- Change the UI language from “en_US” to something else that provides 24-hour timestamps. Probably the most obvious choice is “en_GB” (for Great Britain).
- Change the PHP source code files in the Zabbix UI installation to show the world-standard timestamps regardless of the selected localization.
In this post I will just straight away ignore the second option by saying that you can edit /usr/share/zabbix/include/translateDefines.inc.php
if you want to go that way. I don’t recommend this as it will probably make your Zabbix upgrades more difficult.
But for the first option (changing language to “en_GB”), let’s see how it goes with Debian Linux 12 (Bookworm).
Here I have a newly installed Debian 12 server with only “en_US” language installed, and I then installed Zabbix 7.0.4 according to the instructions in https://www.zabbix.com/download. When browsing to the Zabbix UI to finish the installation, this is what is shown:
No surprise here yet as there aren’t any additional languages installed. After finishing the installation and letting Zabbix server to gather some data from itself, the graphs show 12h timestamps:
Now let’s add “en_GB” localization to the system. In Zabbix 7.0 documentation there is a page about adding frontend languages. In this setup, locale -a
says:
$ locale -a
C
C.utf8
en_US.utf8
POSIX
$
Instead of manually editing the configuration files, I’m reconfiguring the locales using sudo dpkg-reconfigure locales
command and selecting “en_GB.UTF-8 UTF-8” in the list (in addition to the already selected “en_US.UTF-8 UTF-8”):
$ sudo dpkg-reconfigure locales
Generating locales (this might take a while)...
en_GB.UTF-8... done
en_US.UTF-8... done
Generation complete.
$ locale -a
C
C.utf8
en_GB.utf8
en_US.utf8
POSIX
$
Zabbix instructions say to restart web server, so I’ll also do sudo systemctl restart apache2
for that. After that I can change the user profile for the Zabbix Admin user to use “en_GB”:
But, there is no change in the Zabbix UI: all timestamps in the graphs are still 12h. Even a reboot of the system does not help that.
Fortunately, there is a solution available:
- Edit
/etc/default/locale
- Remove (or comment out) the line with
LANGUAGE="en_US:en"
- (There is still the line for
LANG=en_US.UTF-8
)
- (There is still the line for
- Reboot the server
And there you have it: 24h timestamps in the graphs (and elsewhere in the UI):
To be honest, I don’t exactly know why the LANGUAGE
variable was originally set (in addition to LANG
) and how is it supposed to affect the UI language (some kind of “master switch”?), or, why is a full system reboot needed to change the application behavior after removing the variable, but there you have it, the configured “en_GB” localization works now in Zabbix 7.0 on Debian Linux 12.
Edit /etc/default/locale
worked for me, thanks 🙂
Worked like a charm ! Thanks!