Comparing time differences between 2 Solaris servers


 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers Comparing time differences between 2 Solaris servers
# 1  
Old 09-18-2018
Comparing time differences between 2 Solaris servers

Good day to all.


I'm relatively new in using the Sun Solaris OS. I would like to request your expertise in helping to solve a problem that I have at work. Not sure if this has been asked before but I have tried searching through the internet to no avail.


Basically I have 2 sun solaris servers in my network. Each server is synchronised to 2 seperate GPS NTP servers. Latency between the 2 servers are very important (not more than 500ms). My question is, is there a command/script that I can use in the Sun Solaris to check out the latency between these 2 servers? Understand that the command ntpq would be able to perform latency check. But my servers are synchronised to 2 different NTP servers, hence it does not work in my case.


Thanks in advance for the help.
# 2  
Old 09-18-2018
Why not sync with the same server?

That's what we sys admins normally do.

Note:

Quote:
If more than one NTP server is required, four NTP servers is the recommended minimum. Four servers protects against one incorrect timesource, or "falseticker".
# 3  
Old 09-18-2018
Hi Neo. I'm not able to do that due to the system architecture. The systems are setup in such a way that they would have to work stand alone in some scenarios.
# 4  
Old 09-18-2018
Quote:
Originally Posted by Fossil_84
The systems are setup in such a way that they would have to work stand alone in some scenarios.
OK, but still the question stands: why not use the same NTP server?

Another question: are these two NTP servers you use are both owned by you (collective "you" - your company, organisation, ...)? If this is the case (like with two datacenters) then chances are they are both get their time source from the same stratum-2-server anyway, so the latency is most likely near zero.

I hope this helps.

bakunin
# 5  
Old 09-18-2018
Quote:
Originally Posted by bakunin
OK, but still the question stands: why not use the same NTP server?

Another question: are these two NTP servers you use are both owned by you (collective "you" - your company, organisation, ...)? If this is the case (like with two datacenters) then chances are they are both get their time source from the same stratum-2-server anyway, so the latency is most likely near zero.

I hope this helps.

bakunin
Bakunin, I agree with you more that both servers should be sync to a single time server or setup in a way that it's sync to 2 or more servers. But assuming that there is a good reason that it's done this way (and also I would need lots of approval to reconfigure the servers). Would there be any commands/script that I can use to check the time difference between them?
# 6  
Old 09-18-2018
Quote:
Originally Posted by Fossil_84
Bakunin, I agree with you more that both servers should be sync to a single time server or setup in a way that it's sync to 2 or more servers. But assuming that there is a good reason that it's done this way (and also I would need lots of approval to reconfigure the servers).
Usually there is no good reason for doing something without a good reason. But that only as an aside. You should indeed investigate, because you likely end up implementing a solution for a non-existing problem. You might also want to tell us the surroundings of your problem:

I suppose you have the two servers in two different data centres and each of these data centres have its own stratum-3-server (is it that way?). This setup makes some sense because when a site disaster happens the other DC will stilll be able to operate on its own including NTP. In this case the question is if these stratum-3-servers aren't getting their time from a single stratum-2 server. If this is the case you need not check it because their time difference will be near zero or zero always. Timekeeping in systems is unreliable indeed but by far good enough so that any network latency which would update one stratum-3 server faster than the other is negligible.

Quote:
Originally Posted by Fossil_84
Would there be any commands/script that I can use to check the time difference between them?
There is the "UNIX time", which is a 32-bit integer value counting the seconds from Jan 1st 1970. You could get that via remote command execution (nowadays usually ssh, but for this the exact method doesn't matter) from the remote machine and the local machine and the it is simply a matter of integer arithmetic.

You will have to check if Solaris date can do the same as GNU date (or maybe GNU utilities are installed on your system - it wouldn't be uncommon) which is output times in RFC-3339 format. An example output would be (GNU date used):

Code:
# date --rfc-3339=ns

2018-09-18 12:12:59.142223794+02:00

Notice that there is a problem getting the time on both servers simultanously if you want to address differences lower than a second. You can never be sure how much of the difference is caused by network trasmission time and how much is because of differing clock times.

I hope this helps.

bakunin
# 7  
Old 09-18-2018
As I recall, have not confirmed, you can use ntpdate on any server to check it's offset relative to another server.

Just run ntpd on all your servers and you can use ntpdate to check all offsets.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Comparing 2 xml files and print the differences only in output

Hi....I'm having 2 xml files, one is having some special characters and another is a clean xml file does not have any special characters. Now I need one audit kind of file which will show me only from which line the special characters have been removed and the special characters. Can you please... (1 Reply)
Discussion started by: Krishanu Saha
1 Replies

2. Shell Programming and Scripting

Help comparing 2 files and sending differences

I have 2 files that need to be compared. Email the differences if something is different and don't email if nothing is different. One or both of the files could be empty. One or both could have data in them. example files backup.doc.$(date +%y%m%d) file size is 0 backup.doc.$(TZ=CST+24... (4 Replies)
Discussion started by: jabbott3
4 Replies

3. Shell Programming and Scripting

Comparing two files and list the differences

Hi * I have two text files which has the file size, timestamp and the file name. I need to compare these two files and get the differences in the output format. Can anyone help me out with this. * cat file1.txt *474742 Apr 18* 2010 sample.log *135098 Apr 18* 2010 Testfile 134282 Apr 18* 2010... (7 Replies)
Discussion started by: Sendhil.Kumaran
7 Replies

4. Shell Programming and Scripting

Perl: Comparing to two files and displaying the differences

Hi, I'm new to perl and i have to write a perl script that will compare to log/txt files and display the differences. Unfortunately I'm not allowed to use any complied binaries or applications like diff or comm. So far i've across a code like this: use strict; use warnings; my $list1;... (2 Replies)
Discussion started by: dont_be_hasty
2 Replies

5. Shell Programming and Scripting

Comparing files columnwise and print the differences in third file

Hello Everybody!!!!!!!!! Request you to help me with the below mentioned issue: I have 2 files say, File 1: a|4|7 b|3|2 c|8|8 d|8|9 File 2: a|4|6 b|2|2 c|8|8 d|9|8 The third file(output file) should have: Data mismatch in row 1 column 3 Data mismatch in row 2 coumn 2 Data... (3 Replies)
Discussion started by: abhijeet1409
3 Replies

6. UNIX for Dummies Questions & Answers

Differences between time command and usr/bin/time

I wondered if someone could point out the differences between the time commmand and usr/bin/time and the accuracy one might have over another. Also, is there a website or two a person could maybe link for me to describe the differences? Thank you for your time. (2 Replies)
Discussion started by: icedrake
2 Replies

7. Solaris

comparing 2 Solaris servers

hello has anyone built a script that compares 2 Solaris servers? CPU, memory, swap, memory variables in /etc/system, Solaris version Could you please advise on how to make such a comparaison? thanks (9 Replies)
Discussion started by: melanie_pfefer
9 Replies

8. Shell Programming and Scripting

comparing file content differences

I need to write a script to find out if there are any .c files created/removed from the last time i monitored the files available. i first created a file to contain all the .c files available on the system. (ls *.c > file1) I created another file using the same command. I used the comm file1... (4 Replies)
Discussion started by: RianTan
4 Replies

9. Shell Programming and Scripting

Date/time differences

A thanks to all ahead of time. I've checked previous posts about this subject and can't find any that quite fit what I need. If I've missed the post could you point me there. When I do an ls -al I get the following output: -rw-r--r-- 1 staff staff 855 July 24 20:05 ... (4 Replies)
Discussion started by: gillr
4 Replies

10. Shell Programming and Scripting

Working out time differences

Hi everyone, I need to be able to write into a ksh script, a function that can look at 2 24 hour time variables and work out the difference between them. e.g job1 runs at 21:00 job2 runs at 01:00 diff = 04:00 hours I would also need negative numbers i.e where job1 runs after job2 ... (1 Reply)
Discussion started by: rik1551
1 Replies
Login or Register to Ask a Question