How do I change the time in nagiosxi?

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
mmestnik
Posts: 972
Joined: Mon Feb 15, 2010 2:23 pm

Re: How do I change the time in nagiosxi?

Post by mmestnik »

Under Debian this is done like so:
echo "America/Vancouver" > /etc/localtime
I'm not sue when/why this conversion was done, but I don't think it should effect your results.

From /var/lib/dpkg/info/tzdata.config

Code: Select all

# If /etc/localtime is a link, update /etc/timezone
if [ -L /etc/localtime ] ; then
    TIMEZONE="$(readlink /etc/localtime)"
    TIMEZONE="${TIMEZONE#/usr/share/zoneinfo/}"
    if [ -f "/usr/share/zoneinfo/$TIMEZONE" ] ; then
        echo ${TIMEZONE} > /etc/timezone
    fi
fi
As thread 159 suggest you should also check your hardware clock(be it NVRAM or VMware). You can have this "counter" be set in any time zone, by default RedHat/and every body will expect it to be in GMT. However everybody else, MS Windows, "demands" it to be in localtime. You can change the TZ your hardware clock is in by modifying the RC scripts config file, check the docs for your distribution.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: How do I change the time in nagiosxi?

Post by Box293 »

I've had problems with the date / time reverting to CDT after upgrading to R1.2.

I had originally used the ln -s /usr/share/zoneinfo/Australia/Sydney /etc/localtime method to configure my timezone.

My timezone is Australia/Sydney
date would return the result
Wed Jun 9 06:29:54 CDT 2010

I copied the timezone file over localtime
cp /usr/share/zoneinfo/Australia/Sydney /etc/localtime

date would return the same result
Wed Jun 9 06:30:41 CDT 2010

I copied a different timezone file over localtime
cp /usr/share/zoneinfo/Australia/Perth /etc/localtime

date would return the correct result if I was in Perth
Wed Jun 9 19:30:31 WST 2010

I copied the Sydney file again
cp /usr/share/zoneinfo/Australia/Sydney /etc/localtime

date would return the wrong result again
Wed Jun 9 06:30:41 CDT 2010

I copied a known working Sydney file from another Nagios XI server.
date would return the correct result for Sydney
Wed Jun 9 21:36:05 EST 2010


Unsure why has happened here. I have seen this on two different servers. I tried to reproduce the issue with an upgrade however I was not able to diagnose what caused the issue.

It is my guess that the CDT zonefile is copied over my Australia/Sydney file, somehow by the symbolic link I was using?.

I'm not convinced it is the upgrade to R1.2 that caused the problem.


I've since learnt a lot about date/time with CentOS. If I could make a suggestion, perhaps include the system-config-date utility installed in the VMware image you provide.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
mmestnik
Posts: 972
Joined: Mon Feb 15, 2010 2:23 pm

Re: How do I change the time in nagiosxi?

Post by mmestnik »

That's correct cp or "mv across file-systems" would cause a symlink's target to be replaced. One method to avoid this, and a lot of contention issues, is to place your new file in the same folder(thus on the same file-system) and then mv it into place. It's also simple to check for the existence of a link and read it's value...

Code: Select all

trufil="$(test -h "$fil" && readlink "$fil" || echo "$fil")"
zsiga09
Posts: 1
Joined: Thu Dec 02, 2010 8:35 pm

Re: How do I change the time in nagiosxi?

Post by zsiga09 »

Took me an hour to figure this out, hopefully it helps someone.

If you link your /etc/localtime to the zoneinfo files in /usr/share/ (like you would do in RedHat or Centos) it won't make any difference. You have to use the files in /usr/share/zoneinfo/right/. ie:

ln -sf /usr/share/zoneinfo/right/Canada/Pacific /etc/localtime

Also check /etc/sysconfig/clock and fix it if needed.

BTW I'm using the NagiosXI VM v2009RC1.3G.

Cheers,
PeterZ
botakculun
Posts: 1
Joined: Thu Dec 02, 2010 11:08 pm

Re: How do I change the time in nagiosxi?

Post by botakculun »

Try this:
ln -s /var/www/etc/localtime /usr/share/zoneinfo/Australia/Sydney
and then restart the httpd process.
It worked for me
shawn.snavely
Posts: 3
Joined: Fri Jan 27, 2012 12:32 pm

Re: How do I change the time in nagiosxi?

Post by shawn.snavely »

The issue I'm having is the timezone if off. So I have installed the system-config-date module and it states that it installed correctly. However, when I try to run the system-config-date command to change the timezone, I end up with this error:

Traceback (most recent call last):

File "/usr/share/system-config-date/system-config-date.py", line 73, in <module>
useGUIMode(page)
File "/usr/share/system-config-date/system-config-date.py", line 46 in useGUIMode
import scdMainWindow
File "/usr/share/system-config-date/scdMainWindow.py", line 30, in <module>
import gtk
File "/usr/lib/python2.6/site-packages/gtk-2.0/gtk/__init__.py", line 64, in <module>
_init( )
File "/usr/lib/python2.6/site-packages/gtk-2.0/gtk/__init__.py", line 52, in _init
_gtk.init_check()
RuntimeError: could not open display

Would anyone have any suggestions on how to correct this so that I can make the timezone change? Thank you!
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: How do I change the time in nagiosxi?

Post by lmiltchev »

Do you have the timezone, setup in your php.ini file? Run this command in terminal and post the output:

Code: Select all

#  cat /etc/php.ini | grep date.timezone
Be sure to check out our Knowledgebase for helpful articles and solutions!
shawn.snavely
Posts: 3
Joined: Fri Jan 27, 2012 12:32 pm

Re: How do I change the time in nagiosxi?

Post by shawn.snavely »

I ran the command and the output is:

; http://www.php.net/manual/en/datetime.c ... e.timezone
date.timezone = Europe/London
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: How do I change the time in nagiosxi?

Post by scottwilkerson »

What timezone are you in?
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
shawn.snavely
Posts: 3
Joined: Fri Jan 27, 2012 12:32 pm

Re: How do I change the time in nagiosxi?

Post by shawn.snavely »

Sorry...America - Eastern Std Time (NYC/Philadelphia)
Locked