Page 1 of 1

Time syncronization problem (Two separate servers)

PostPosted: Tue Aug 25, 2009 4:30 pm
by alerios
Hello.

I have checked all recomendations found on the forums regarding this problem with vicidial 2.0.5, and I still get the message several times a day:

1) Both servers (asterisk and astguiclient) have the same time(date), which is synced every minute with ntpdate in Cron.

2) I've checked that in the database all "server_ip" fields have the asterisk IP address, and ran the /usr/share/astguiclient/ADMIN_update_server_ip.pl to double check.

3) I've checked that all perl scripts are running on the asterisk machine, specially those related to the manager api, I've also double checked with screen -ls.

The only special thing I have in my installation is separate servers for the asterisk and the vicidial box, so I don't know which IP Address should I put on each astguiclient.conf file.

I have:

- Database Box: 'server_ip' address: 192.168.1.6
- Vicidial Box: /etc/astguiclient.conf -> VARserver_ip => 192.168.1.7
- Asterisk Box: /etc/astguiclient.conf -> VARserver_ip => 192.168.1.6

Any help will be appreciated.

PostPosted: Tue Aug 25, 2009 11:54 pm
by mflorell
Can you explain how you separate Asterisk and ViciDial?

Also, how do you have ntp configured?

Details of setup

PostPosted: Wed Aug 26, 2009 12:08 pm
by alerios
Asterisk box (192.168.1.6) has:
- Asterisk
- /usr/share/astguiclient perl scripts running
- NTP server

Vicidialbox (192.168.1.7) has:
- Apache
- Mysql
- /var/www/vicidial,agc
- Crontab with ntpdate


Here are ntp details:

pbx:~# cat /etc/ntp.conf
driftfile /var/lib/ntp/ntp.drift

server chico.rediris.es
server 127.127.1.1
fudge 127.127.1.1 stratum 8 refid NIST


vicidial:~# cat /etc/crontab | grep ntpdate
* * * * * root ntpdate 192.168.1.6 || echo "no se sincroniza"

PostPosted: Wed Aug 26, 2009 6:53 pm
by mflorell
we have seen issues with ntp on local networks in the past that have similar problems like this.

When the error shows up do this query on the database:
Select * from server_updater;

and post the results.

server_updater

PostPosted: Thu Aug 27, 2009 10:09 am
by alerios
Hi.

Here are the results:

server_ip last_update db_time
192.168.1.6 2009-08-27 10:00:05 2009-08-27 10:00:05


Also, I've decided to comment the error windown on agc/vicidial.php, on the line that contains ' showDiv('SysteMDisablEBoX'); '

Instead, and to keep on catching the problem, I've applied this patch to agc/conf_exten_check.php:

Code: Select all
--- conf_exten_check.php.orig   2009-08-27 09:41:43.000000000 -0500
+++ conf_exten_check.php   2009-08-27 09:37:26.000000000 -0500
@@ -400,7 +400,12 @@
 
 
          if ( ( ($time_diff > 8) or ($time_diff < -8) or ($web_diff > 8) or ($web_diff < -8) ) and (eregi("0$",$StarTtime)) )
-            {$Alogin='TIME_SYNC';}
+            {
+            $Alogin='TIME_SYNC';
+            $fp = fopen ("./sync_debug.txt", "a");
+            fwrite ($fp, "$NOW_TIME|TIME_SYNC|$user|$channel|$call_server_ip|$exten||$time_diff|$web_diff|$StarTtime\n");
+            fclose($fp);
+            }
          if ($Acount < 1)
             {$Alogin='DEAD_VLA';}
          if ($AexternalDEAD > 0)



So, whe the time sync problem occurs, the agents keep working, and I have this log in sync_debug.txt that seems to tell that $webdiff is less than -8 when the problem occurs:

2009-08-27 09:52:50|TIME_SYNC|7006|||||0|-10|1251384770
2009-08-27 09:52:50|TIME_SYNC|7022|||||0|-10|1251384770
2009-08-27 09:52:50|TIME_SYNC|7017|||||0|-10|1251384770
2009-08-27 09:52:50|TIME_SYNC|7026|||||0|-10|1251384770
2009-08-27 09:52:50|TIME_SYNC|7025|||||0|-10|1251384770
2009-08-27 09:52:50|TIME_SYNC|7021|||||0|-10|1251384770
2009-08-27 09:52:50|TIME_SYNC|7007|||||0|-10|1251384770
2009-08-27 09:52:50|TIME_SYNC|7003|||||0|-10|1251384770
2009-08-27 09:52:50|TIME_SYNC|7020|||||0|-10|1251384770
2009-08-27 09:52:50|TIME_SYNC|7001|||||0|-10|1251384770
2009-08-27 09:52:50|TIME_SYNC|7009|||||0|-10|1251384770
2009-08-27 09:52:50|TIME_SYNC|7019|||||0|-10|1251384770
2009-08-27 09:52:50|TIME_SYNC|7005|||||0|-10|1251384770
2009-08-27 09:52:50|TIME_SYNC|7024|||||0|-10|1251384770
2009-08-27 09:52:50|TIME_SYNC|7015|||||0|-10|1251384770
2009-08-27 09:52:50|TIME_SYNC|7010|||||0|-10|1251384770
2009-08-27 09:52:50|TIME_SYNC|7018|||||0|-10|1251384770
2009-08-27 09:53:00|TIME_SYNC|7006|||||0|-20|1251384780
2009-08-27 09:53:00|TIME_SYNC|7018|||||0|-20|1251384780
2009-08-27 09:53:00|TIME_SYNC|7022|||||0|-20|1251384780
2009-08-27 09:53:00|TIME_SYNC|7026|||||0|-20|1251384780
2009-08-27 09:53:00|TIME_SYNC|7025|||||0|-20|1251384780
2009-08-27 09:53:00|TIME_SYNC|7010|||||0|-20|1251384780
2009-08-27 09:53:00|TIME_SYNC|7007|||||0|-20|1251384780
2009-08-27 09:53:00|TIME_SYNC|7003|||||0|-20|1251384780
2009-08-27 09:53:00|TIME_SYNC|7020|||||0|-20|1251384780
2009-08-27 09:53:00|TIME_SYNC|7001|||||0|-20|1251384780
2009-08-27 09:53:00|TIME_SYNC|7009|||||0|-20|1251384780
2009-08-27 09:53:00|TIME_SYNC|7019|||||0|-20|1251384780
2009-08-27 09:53:00|TIME_SYNC|7005|||||0|-20|1251384780
2009-08-27 09:53:00|TIME_SYNC|7024|||||0|-20|1251384780
2009-08-27 09:53:00|TIME_SYNC|7015|||||0|-20|1251384780
2009-08-27 09:53:00|TIME_SYNC|7021|||||0|-20|1251384780
2009-08-27 09:53:00|TIME_SYNC|7017|||||0|-20|1251384780

PostPosted: Fri Aug 28, 2009 1:27 am
by mflorell
Looks like the webdiff is actually -10 then -20...

webdiff

PostPosted: Fri Aug 28, 2009 10:52 am
by alerios
But what does that mean? why do I have those values at certain times, and how can I keep them between -8 and 8 so I don't get the time sincronization error?

PostPosted: Fri Aug 28, 2009 8:57 pm
by mflorell
We have seen some motherboard chipsets that have horrible timers and go off by many seconds every minute.

I would recommend checking ntp and seeing what kind of drift you are experiencing on this machine.

Drift

PostPosted: Thu Sep 03, 2009 11:11 am
by alerios
While the problem is on ( with webdiff = -28 ):

pbx1:~# cat /var/lib/ntp/ntp.drift
-56.177

PostPosted: Thu Dec 03, 2009 6:36 am
by spaquet
I agree with mflorell

I have the same configuration and I noticed that my hardware is drifting very fast... So I sync with NTP Server every 2 minutes (might be more, might be less for you).

I also noticed that some time servers are not that good and do not "answer" every time they are questioned. This seems to be the case for basic 2003 windows server used as NTP Server. So check this out too.