OT: NTP starting to eat CPU time

Hi

 

For a reason i just cant figure NTPd has started to eat cpu time like candy and time outs when i issue

ntpq -p

my ntp conf:

driftfile /var/lib/ntp/ntp.drift
statsdir /var/log/ntpstats/
statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable
server 127.127.20.0 mode 16 prefer
fudge 127.127.20.0 flag1 1 time2 0.400
server 0.debian.pool.ntp.org iburst
server 1.debian.pool.ntp.org iburst
server 2.debian.pool.ntp.org iburst
server 3.debian.pool.ntp.org iburst
restrict -4 default kod notrap nomodify nopeer
restrict -6 default kod notrap nomodify nopeer
restrict 127.0.0.1
restrict ::1

 

any clues?

 

on VERY RARE ocations i get:

[email protected] ~ $ ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
oGPS_NMEA(0)     .GPS.            0 l   12   64  377    0.000   -0.861   2.134
-ntp10.icmp.dk   173.34.166.174   2 u   46   64   77   15.094   10.328   4.525
+ns2.eushells.co 87.48.12.24      2 u   37   64  175   12.586    2.235   5.292
+x1-6-78-24-af-8 192.36.134.25    2 u   39   64  167   17.414    2.362   5.205
*freesbee.wheel. 212.243.86.159   2 u   40   64  177   22.370    6.197   4.429

 

but most of the time i get:

[email protected] ~ $ ntpq -p
localhost: timed out, nothing received
***Request timed out

 

 

Peter Galbavy's picture

Re: OT: NTP starting to eat CPU time

ntpd has always been fragile. It's probably some network error or internal reaction to an ICMP packet from your router or something. Does your OEM have full access to the outside world? Is it behind a NAT router? You may also want to simplify your ntp.conf if you are just a simple client - or is that the default emon/OEM one? I haven't looked...

boelle's picture

Re: OT: NTP starting to eat CPU time

behind nat... and so it the pc i issue the commands from

its a stratum1 server  so others can ask the time from it

yes it does have full access to outside world. 

port 123 is open in router.... port 80 not as i dont connect to the pi from outside

 

EDIT: odd thing is that it has worked until 2-3 days ago or so...

 

 

boelle's picture

Re: OT: NTP starting to eat CPU time

might have figured why

i have added my server to http://www.pool.ntp.org/ that site let others ask my server for time...

as soon i block port 123 from outside everything is fine

[email protected] ~ $ ps aux | grep ntp
ntp       2859  3.8  0.3   5560  1780 ?        Ss   14:08   0:39 /usr/sbin/ntpd -p /var/run/ntpd.pid -g -u 102:104
pi        2931  0.0  0.1   3548   804 pts/0    S+   14:25   0:00 grep --color=auto ntp

[email protected] ~ $ sudo netstat -unlp | grep ntp
udp        0      0 192.168.0.20:123        0.0.0.0:*                           2859/ntpd
udp        0      0 127.0.0.1:123           0.0.0.0:*                           2859/ntpd
udp        0      0 0.0.0.0:123             0.0.0.0:*                           2859/ntpd
 

Peter Galbavy's picture

Re: OT: NTP starting to eat CPU time

I missed the GPS bit, sorry!What are you using, out of curiosity?

I guess the load must be all the requests from the outside loading you heavily and these stop the moment you block the port.

boelle's picture

Re: OT: NTP starting to eat CPU time

Hi

Its based arround a raspberry pi. In the livingroom window i have a GPS antenna and a next to it a gateway node for ukhas.net.

in a bedroller box between the couch and the window i have the pi, 2 small DC-DC supplies since the gps and gateway node draws a tad to much power. also a HDD and the latest add is a OpenTRV board so i can log the data from all the other OpenTRV boards arround the house

but yes you are right its prop all the ntp requests from the outside that does it... closed the port and all issues are gone... i used to have my ntp server on the pool.ntp.org service.... just as a friendly service... it used to work fine for months...

then a few weeks ago i reloaded the whole thing to upgrade to emoncms v9, i forgot to change the default user/pass and the next day i saw last login was from a different place... 

 

so in fact i dare to say someone hacked it... and now that i reformatted again and have changed the pass they try to piss me off with a DDOS attack of some sort... well it only hits those who used to ping me for time

 

a few pics of the setup attached, the stuff at the bottom of the box is 2 ups battery's and an automatic charger...

boelle's picture

Re: OT: NTP starting to eat CPU time

next step now that things are working is to install emoncms again and import data... 

just sad that you have to box yourself in so much... 

EDIT: the way my NTP setup works is that it takes the time from the GPS, it then locks to the PPS signal which tells when a second happen... giving me a clock that is only 0.2 microsec behind.

other than the NTP, the pi also runs a script every 5 mins that sends myself a mail if my pupblic ip changes. and it also updates my ip to a dynamic dns service (duckdns.org). plus runs a script from ukhas.net, should a high altitude baloon pass over me that has the right transmitter it can report back its location as soon its within range of my node in the window.

so i would not say my pi is loaded at all... avg. cpu load is now from 0-3%

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.