Page 1 of 1

Have to update time on server every day to login

Posted: Mon May 16, 2011 10:54 am
by bretlevi
I get the NSP: Sorry Dave, I can't let you do that" error every time i reboot and try to login.

Each time before i reboot i need to force a time update, and then it works.

Is there a way to fix this perm?

Also it is setup to use dhcp, how do i cange it to static? can this be done within the interface or only CLI?

I would also need to add IP, subnet, GW, and dns.

I used ifconfig, but it reverted back to dhcp on reboot.

Re: Have to update time on server every day to login

Posted: Mon May 16, 2011 1:39 pm
by nscott
bretlevi wrote:Each time before i reboot i need to force a time update, and then it works.

Is there a way to fix this perm?
I'm not sure what you're asking here. What do you do when you force a time update? Have you installed NTP on your VM CentOS?
bretlevi wrote:Also it is setup to use dhcp, how do i cange it to static? can this be done within the interface or only CLI?
There sure is, I can give you the CLI procedure. Also, make sure your network is ready to take a static IP.

You're going to edit your ifcfg-eth0, which in CentOS is located in /etc/sysconfig/network-scripts/, to edit put in the following command

Code: Select all

nano /etc/sysconfig/network-scripts/ifcfg-eth0
Now just to be safe, make a backup. hit Ctrl-O (the letter) and add .bak to the end of the file, then hit enter. Always a good idea to make a backup in case things go sour. Now change the the file

Code: Select all

DEVICE=eth0
BOOTPROTO=none              [<---notice this changed to none]
HWADDR=XX:XX:XX:XX:XX:XX [don't change this hex address]
ONBOOT=yes
USERCTL=no
PEERDNS=yes
NETMASK=[insert the netmask you want here]
IPADDR=[insert the IP address you want here]
GATEWAY=[insert your gateway here]
Once you've got that hit Ctrl-O again and make sure it doesn't have the .bak on it, then hit enter.

Then go to /etc/ directory and

Code: Select all

nano resolv.conf
Here you specify the DNS servers, if these numbers are good, you should be fine, otherwise enter the DNS domain you want to search or specify a DNS directly.

Re: Have to update time on server every day to login

Posted: Mon May 16, 2011 2:02 pm
by mguthrie
For the time issue are you running the VM with VMWare player, VM on ESX, or using a manual install of XI? I know that when a virtual server gets powered off or rebooted the time needs to be resynced, which can be done by the following:

Code: Select all

yum install ntp
ntpdate pool.ntp.org  
You may also need to hold shift and reload the login page on the browser to refresh the javascript cache and clear the stored session data.

Re: Have to update time on server every day to login

Posted: Wed Jun 01, 2011 5:52 am
by ditlevw
mguthrie wrote:For the time issue are you running the VM with VMWare player, VM on ESX, or using a manual install of XI? I know that when a virtual server gets powered off or rebooted the time needs to be resynced, which can be done by the following:

Code: Select all

yum install ntp
ntpdate pool.ntp.org  
You may also need to hold shift and reload the login page on the browser to refresh the javascript cache and clear the stored session data.
Hi

I just installed ntp, but I still get the wrong timezone. What am I doing wrong? Can I choose my timezone somewhere? I've set:

Code: Select all

date.timezone = Etc/GMT+1
service httpd restart
in /etc/php.ini but the server is still 3 hours behind.

/Ditlev

Re: Have to update time on server every day to login

Posted: Wed Jun 01, 2011 9:34 am
by tonyyarusso
For the timezone, there are two separate settings - the system timezone and the PHP timezone. The PHP timezone is set in the php.ini as you indicated. The system timezone is set in /etc/sysconfig/clock combined with copying the relevant file from /usr/share/zoneinfo/ to /etc/localtime. So in your case, you would want to do this:

Code: Select all

cp /usr/share/zoneinfo/Etc/GMT+1 /etc/localtime
sed -i 's%.*ZONE.*%ZONE="Etc/GMT+1"%' /etc/sysconfig/clock
sed -i 's%.*date\.timezone.*%date\.timezone = Etc/GMT+1%' /etc/php.ini
service httpd restart
As far as NTP goes, note that there are two modes of operation. The 'ntpdate' utility does a one-time correction when called, and is useful for quick corrections on an as-needed basis. The 'ntpd' daemon will run continuously, keeping your clock in sync all the time. You will likely want to set up the latter, or check your virtualization platform's documentation for what approach is recommended for you.

Re: Have to update time on server every day to login

Posted: Mon Jun 06, 2011 4:12 am
by ditlevw
tonyyarusso wrote:For the timezone, there are two separate settings - the system timezone and the PHP timezone. The PHP timezone is set in the php.ini as you indicated. The system timezone is set in /etc/sysconfig/clock combined with copying the relevant file from /usr/share/zoneinfo/ to /etc/localtime. So in your case, you would want to do this:

Code: Select all

cp /usr/share/zoneinfo/Etc/GMT+1 /etc/localtime
sed -i 's%.*ZONE.*%ZONE="Etc/GMT+1"%' /etc/sysconfig/clock
sed -i 's%.*date\.timezone.*%date\.timezone = Etc/GMT+1%' /etc/php.ini
service httpd restart
As far as NTP goes, note that there are two modes of operation. The 'ntpdate' utility does a one-time correction when called, and is useful for quick corrections on an as-needed basis. The 'ntpd' daemon will run continuously, keeping your clock in sync all the time. You will likely want to set up the latter, or check your virtualization platform's documentation for what approach is recommended for you.
Hi, and thanks for your reply

I tried your suggestion and everything seems right, ...but the time.

Well, I realized that we're at summertime here so I changed to the following:

Code: Select all

cp /usr/share/zoneinfo/Etc/GMT+2 /etc/localtime
sed -i 's%.*ZONE.*%ZONE="Etc/GMT+2"%' /etc/sysconfig/clock
sed -i 's%.*date\.timezone.*%date\.timezone = Etc/GMT+2%' /etc/php.ini
service httpd restart
To check up the time I used:

Code: Select all

[root@localhost ~]# clock
Mon 06 Jun 2011 07:59:31 AM GMT+1  -0.736826 seconds
[root@localhost ~]# ntpdate pool.ntp.org
 6 Jun 07:59:56 ntpdate[10322]: adjust time server 178.237.34.94 offset 0.001051 sec
Unfortunantely it's still 3 hours behind? I don't know why, neither I understand why it stays on GMT+1.

Just for the record, I run Nagios XI, I do have Internet connection and can ping (ex. pool.ntp.org).

Any ideas?

Sincerely yours

/Ditlev

EDIT: it seems there are difference between the time in the webinterface and the Nagios server.

Ex:
Nagios webinterface: 12.00
Nagios server: 13.00
Local time: 16.00

Re: Have to update time on server every day to login

Posted: Mon Jun 06, 2011 1:09 pm
by tonyyarusso
ditlevw wrote: Well, I realized that we're at summertime here so I changed to the following:
For starters, if your locale uses summer time then you do not want to use the direct GMT offset definitions. Instead, use the proper locale, which will know when you switch and by how much:

Code: Select all

cp /usr/share/zoneinfo/Europe/Copenhagen /etc/localtime
sed -i 's%.*ZONE.*%ZONE="Europe/Copenhagen"%' /etc/sysconfig/clock
sed -i 's%.*date\.timezone.*%date\.timezone = Europe/Copenhagen%' /etc/php.ini
service httpd restart

Re: Have to update time on server every day to login

Posted: Mon Jun 06, 2011 1:26 pm
by tonyyarusso
Once you've done that, please follow the instructions in the attached PDF, using the attached PHP script, and show me your screenshot.

Re: Have to update time on server every day to login

Posted: Tue Jun 07, 2011 8:04 am
by ditlevw
tonyyarusso wrote:Once you've done that, please follow the instructions in the attached PDF, using the attached PHP script, and show me your screenshot.
Thanks. It helped a bit.
time.jpg
As you can see, the server time, is still wrong. I forgot to tell, that I'm running Nagios on a VM server ESX 4.1. I have installed VM tools. I don't know if that has something to do with it.

I have read the Nagios Wiki, without finding anything usefull to my time-problem.

Any ideas?

/Ditlev