Re: [ntp:questions] NTPQ -P shows both IP and DNS name (parsing problem)

2017-06-21 Thread roman . mescheryakov
вторник, 20 июня 2017 г., 19:38:53 UTC+3 пользователь David Woolley написал:
> I think you are expected to use the relevant management request 
> directly, rather than parse output intended for humans.  That would 
> avoid process startup, filtering, and DNS costs.

What does it mean to “use the relevant management request directly”? I’m new to 
NTP and Linux and this phrase is not clear to me. If it makes any difference, 
my program is written on Python and running under Raspbian OS.

___
questions mailing list
questions@lists.ntp.org
http://lists.ntp.org/listinfo/questions

[ntp:questions] NTPQ -P shows both IP and DNS name (parsing problem)

2017-06-20 Thread roman . mescheryakov
Hello everyone, 
The software developed by me uses ntpq -p to periodically (every 10 seconds) 
check ntpd time syncing status. ntpq output is parsed and fields “peer”, 
“refid” and “offset” are extracted by index. This works fine until some strange 
peer appears in the list for which both IP and DNS name are returned:
 
 remote   refid  st t when poll reach   delay   offset  
jitter

==
 0.debian.pool.n .POOL.  16 p-800.0000.000  
 0.002
 1.debian.pool.n .POOL.  16 p-800.0000.000  
 0.002
 2.debian.pool.n .POOL.  16 p-800.0000.000  
 0.002
 3.debian.pool.n .POOL.  16 p-800.0000.000  
 0.002
 LOCAL(0).LOCL.  10 l   328   100.0000.000  
 0.002
*193.11.114.43 ( 75.17.28.47  2 u887   29.118   -0.185  
 2.276
 5.20.0.20   193.219.61.110   2 u787   82.7140.315  
 0.717
-Time100.Stupi.S .PPS.1 u887   29.916   -2.316  
 2.894
+ntp2.ivlan.net  194.190.168.12 u8875.426   -0.772  
 2.666
+ntp1.ivlan.net  194.190.168.12 u8878.8400.888  
 1.217
 bagnikita.com   89.109.251.242 u1877.504   -1.115  
 1.227
 78.140.251.2194.190.168.12 u187   14.4410.937  
 1.559
 mx2.volgaship.c 131.188.3.2232 u   1083   13.515   -0.317  
 0.939
 
See the line starting with “*193.11.114.43 (“
 
If I run “ntpq -pw”, then the output is the following:
 
 remote   refid  st t when poll reach   delay   offset  jitter
==
 0.debian.pool.ntp.org
 .POOL.  16 p-800.0000.000   0.002
 1.debian.pool.ntp.org
 .POOL.  16 p-800.0000.000   0.002
 2.debian.pool.ntp.org
 .POOL.  16 p-800.0000.000   0.002
 3.debian.pool.ntp.org
 .POOL.  16 p-800.0000.000   0.002
 LOCAL(0).LOCL.  10 l   588  2000.0000.000   0.002
-193.11.114.43 (tor1.mdfnet.se)
 75.17.28.47  2 u48   77   32.7371.864   0.675
-5.20.0.20   193.219.61.110   2 u38   77   84.743   -0.631   0.543
*Time100.Stupi.SE
 .PPS.1 u48   77   30.9451.135   1.137
+ntp2.ivlan.net  194.190.168.12 u48   779.2371.225   0.860
+ntp1.ivlan.net  194.190.168.12 u48   779.0851.165   1.026
-bagnikita.com   89.109.251.242 u78   377.879   -0.385   0.591
+78.140.251.2194.190.168.12 u78   37   14.3240.418   1.500
-mx2.volgaship.com
 131.188.3.2232 u68   37   13.515   -0.317   1.479
 
See the line starting with “-193.11.114.43 (tor1.mdfnet.se)”
 
This strange peer breaks extracting fields by index. For the above example it 
extracts “(“ as “refid” value instead of “75.17.28.47” and “29.118” as “offset” 
value instead of “-0.185”.
 
ntpq version is 4.2.8p10@1.3728-o Mon May  8 10:30:41 UTC 2017 (1)
 
Is this behaviour a bug or a feature?

Kind regards, Roman Mescheryakov

___
questions mailing list
questions@lists.ntp.org
http://lists.ntp.org/listinfo/questions