Why downtimes occur X hours later in icinga monitoring server installed on Debian/Ubuntu Linux systems


In this mini post I’ll show you how to fix and set the correct timezone on your icinga monitoring server with icinga-web V1 installed on Debian Linux systems. I’m using icinga to monitor all my Linux servers and it works very good, I always receive mails when any error occurs. But suddenly I discovered that there is an error occurs at one of my servers due to a cronjob I configured on that server “it was a temporary error during the cronjob lifetime”, but the mail I receive for this error always one hour later than the cronjob that causes it. Now I can say that I’ve a big issue with timing on my icinga monitor server due to a wrong timezone configured on either the Linux system or on the php.ini or on icinga-web files.

So, How can I fix the timezone on icinga monitoring server?

To fix the timezone on your icinga monitoring server, In three steps, I’ll set the Linux system timezone first, then I’ll set the correct timezone in php.ini and finally I’ll fix the icinga-web timezone on two files, so let’s start:

Step 1: Setting up the correct Linux timezone.

You can use our previously posted article on setting up the timezone on Debian Linux systems, here’s it’s url:

Now, after I fixed my OS “Debian Linux” timezone, here’s my current timezone:

# cat /etc/timezone 

Now, let’s go and fix the php.ini timezone setting.

Step 2: Setting up and fixing the timezone in php.ini

Setting up the Linux OS timezone only will not fix the icinga timezone issue, I need to continue and set the correct timezone in  php.ini .

Here’s a small image for icinga-web interface showing the timezone before editing php.ini:

undwfinedAs you see  my timezone in php.ini was “Africa/Cairo“.

Now, edit the php.ini and set the value for “date.timezone” directive to your timezone as follow:

# vim /etc/php5/apache2/php.ini
date.timezone = Africa/Johannesburg

Now, After we set the correct timezone on php.ini, We must restart Apache web server, as I’m using Debian I’ll run the following command:

# /etc/init.d/apache2 restart

Now, here’s a small image for icinga-web interface showing the timezone after editing php.ini:

undefinedNow, let’s go and fix the timezone setting in icinga-web files.

Step 3: Setting up and fixing the timezone in icinga-web files

Icinga-web has two configuration files that we can set value for “date.timezone“, those files are:

  1. app/modules/AppKit/config/module.xml
  2. app/config/translation.xml

But where exactly those two files exist? use the following find command to find their paths.

# find / -type f -name module.xml

So, the first file found at “/usr/share/icinga-web/app/modules/AppKit/config/module.xml” on Debian Linux systems.

# find / -type f -name translation.xml

And the second file exists at “/usr/share/icinga-web/app/config/translation.xml” on Debian Linux systems.

All needed from you is to set the “date.timezone” found on “/usr/share/icinga-web/app/modules/AppKit/config/module.xml” to the same timezone you set before for the system and in php.ini

Here’s the default date.timezone value found in this file:

# grep "date.timezone" /usr/share/icinga-web/app/modules/AppKit/config/module.xml
Now edit this file and set the value for “date.timezone” directive to your timezone as follow:
# vim /usr/share/icinga-web/app/modules/AppKit/config/module.xml
 <ae:parameter name="date.timezone">Africa/Johannesburg</ae:parameter>
For the second file, we will not do any change to it as long as we can change php.ini.
Here’s it’s default value:
# grep timezone /usr/share/icinga-web/app/config/translation.xml
<available_locales default_locale="en" default_timezone="GMT">
1. Do not modify the second file "/usr/share/icinga-web/app/config/translation.xml" leave it with it's default installation values.
2. If we can not set the timezone in php.ini, only in this case we have to set the default_timezone in this file.

Now, we need to restart icinga service, run the following command:

# service icinga restart

And finally, icinga also has a timezone setting (which is normally unconfigured and defaults to the system timezone):

# grep "use_timezone" /etc/icinga/icinga.cfg

Why do I change the date.timezone only in module.xml and leave translation.xml unchanged?

To avoid having double configuration of timezone in Icinga-web, Which in turn will give a wrong time. Here’s more explanation:

The date.timezone sets the timezone value. Translation default_timezone is only to convert the timezone into other values.

The best way if you’re running all components at the same co-ordinates: Keep translation.xml default_timezone to its default value of “GMT”. In this case “GMT” means that your base timezone is the same and you do not need conversion between them.

If You Appreciate What We Do Here On Mimastech, You Should Consider:

  1. Stay Connected to: Facebook | Twitter | Google+
  2. Support us via PayPal Donation
  3. Subscribe to our email newsletters.
  4. Tell other sysadmins / friends about Us - Share and Like our posts and services

We are thankful for your never ending support.

Leave a Reply

Your email address will not be published. Required fields are marked *