2011-04-12

Nagios - Time within nagios is incorrect

Platform :
FreeBSD

Server :
Nagios

Problem :
Nagios's time stamp are incorrect, e.g. the comments section, the log file's time stamp. But the server's date, time & time zone are correct.

Cause :
Nagios configuration needs to specify the time zone offset, as well as the Apache's CGI module. These both settings make sure that nagios's time is in sync with the server's time.

Solution :
  1. Make sure the FreeBSD time zone is correct. Refer to the post "FreeBSD - How to change time zone"
  2. Change the configuration for Nagios on time zone :
    1. vi /usr/local/etc/nagios/nagios.cfg
    2. Find the section "# TIMEZONE OFFSET"
    3. Insert the below line :
      use_timezone=Asia/Kuala_Lumpur
      *** timezone value can be obtain from /usr/share/zoneinfo, e.g.
      cd /usr/share/zoneinfo;ls




  3. Insert time zone values & parameter into Apache's virtual host for CGI module, at the nagios section :
    SetEnv TZ "Australia/Brisbane"

    E.g.
    
    Options ExecCGI
    AllowOverride None
    Order allow,deny
    Allow from all
    Order deny,allow
    Deny from all
    Allow from all
    
    SetEnv TZ "Asia/Kuala_Lumpur"
    




  4. Finally, restart Nagios & Apache for the above changes to take effect :
    /usr/local/etc/rc.d/nagios restart;/usr/local/etc/rc.d/apache22 reload



Aloha !!!

No comments: