What's new

NTP Daemon for ASUSWRT/Merlin

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Copy the code into a newly created file stats.xml and place it in "/opt/var/spool/ntp"

Code:
<rrd>
    <version>0003</version>
    <step>300</step> <!-- Seconds -->
    <lastupdate>1494526200</lastupdate> <!-- 2017-05-11 20:10:00 CEST -->

    <ds>
        <name> offset </name>
        <type> GAUGE </type>
        <minimal_heartbeat>1200</minimal_heartbeat>
        <min>NaN</min>
        <max>NaN</max>

        <!-- PDP Status -->
        <last_ds>-8.161560</last_ds>
        <value>NaN</value>
        <unknown_sec> 0 </unknown_sec>
    </ds>

    <ds>
        <name> sjit </name>
        <type> GAUGE </type>
        <minimal_heartbeat>1200</minimal_heartbeat>
        <min>NaN</min>
        <max>NaN</max>

        <!-- PDP Status -->
        <last_ds>1.248717</last_ds>
        <value>NaN</value>
        <unknown_sec> 0 </unknown_sec>
    </ds>

    <ds>
        <name> cjit </name>
        <type> GAUGE </type>
        <minimal_heartbeat>1200</minimal_heartbeat>
        <min>NaN</min>
        <max>NaN</max>

        <!-- PDP Status -->
        <last_ds>5.769</last_ds>
        <value>NaN</value>
        <unknown_sec> 0 </unknown_sec>
    </ds>

    <ds>
        <name> wander </name>
        <type> GAUGE </type>
        <minimal_heartbeat>1200</minimal_heartbeat>
        <min>NaN</min>
        <max>NaN</max>

        <!-- PDP Status -->
        <last_ds>0.071</last_ds>
        <value>NaN</value>
        <unknown_sec> 0 </unknown_sec>
    </ds>

    <ds>
        <name> freq </name>
        <type> GAUGE </type>
        <minimal_heartbeat>1200</minimal_heartbeat>
        <min>NaN</min>
        <max>NaN</max>

        <!-- PDP Status -->
        <last_ds>6.099</last_ds>
        <value>NaN</value>
        <unknown_sec> 0 </unknown_sec>
    </ds>

    <ds>
        <name> disp </name>
        <type> GAUGE </type>
        <minimal_heartbeat>1200</minimal_heartbeat>
        <min>NaN</min>
        <max>NaN</max>

        <!-- PDP Status -->
        <last_ds>43.956</last_ds>
        <value>NaN</value>
        <unknown_sec> 0 </unknown_sec>
    </ds>

    <!-- Round Robin Archives -->
    <rra>
        <cf>LAST</cf>
        <pdp_per_row>1</pdp_per_row> <!-- 300 seconds -->

        <params>
        <xff>5.0000000000e-01</xff>
        </params>
        <cdp_prep>
            <ds>
            <primary_value>NaN</primary_value>
            <secondary_value>NaN</secondary_value>
            <value>NaN</value>
            <unknown_datapoints>0</unknown_datapoints>
            </ds>
            <ds>
            <primary_value>NaN</primary_value>
            <secondary_value>NaN</secondary_value>
            <value>NaN</value>
            <unknown_datapoints>0</unknown_datapoints>
            </ds>
            <ds>
            <primary_value>NaN</primary_value>
            <secondary_value>NaN</secondary_value>
            <value>NaN</value>
            <unknown_datapoints>0</unknown_datapoints>
            </ds>
            <ds>
            <primary_value>NaN</primary_value>
            <secondary_value>NaN</secondary_value>
            <value>NaN</value>
            <unknown_datapoints>0</unknown_datapoints>
            </ds>
            <ds>
            <primary_value>NaN</primary_value>
            <secondary_value>NaN</secondary_value>
            <value>NaN</value>
            <unknown_datapoints>0</unknown_datapoints>
            </ds>
            <ds>
            <primary_value>NaN</primary_value>
            <secondary_value>NaN</secondary_value>
            <value>NaN</value>
            <unknown_datapoints>0</unknown_datapoints>
            </ds>
        </cdp_prep>
        <database>
            <!-- 2017-05-10 18:15:00 CEST / 1494432900 --> <row><v>NaN</v><v>NaN</v><v>NaN</v><v>NaN</v><v>NaN</v><v>NaN</v></row>
        </database>
    </rra>
    <rra>
        <cf>LAST</cf>
        <pdp_per_row>12</pdp_per_row> <!-- 3600 seconds -->

        <params>
<xff>5.0000000000e-01</xff>
        </params>
        <cdp_prep>
            <ds>
            <primary_value>NaN</primary_value>
            <secondary_value>NaN</secondary_value>
            <value>NaN</value>
            <unknown_datapoints>2</unknown_datapoints>
            </ds>
            <ds>
            <primary_value>NaN</primary_value>
            <secondary_value>NaN</secondary_value>
            <value>NaN</value>
            <unknown_datapoints>2</unknown_datapoints>
            </ds>
            <ds>
            <primary_value>NaN</primary_value>
            <secondary_value>NaN</secondary_value>
            <value>NaN</value>
            <unknown_datapoints>2</unknown_datapoints>
            </ds>
            <ds>
            <primary_value>NaN</primary_value>
            <secondary_value>NaN</secondary_value>
            <value>NaN</value>
            <unknown_datapoints>2</unknown_datapoints>
            </ds>
            <ds>
            <primary_value>NaN</primary_value>
            <secondary_value>NaN</secondary_value>
            <value>NaN</value>
            <unknown_datapoints>2</unknown_datapoints>
            </ds>
            <ds>
            <primary_value>NaN</primary_value>
            <secondary_value>NaN</secondary_value>
            <value>NaN</value>
            <unknown_datapoints>2</unknown_datapoints>
            </ds>
        </cdp_prep>
        <database>
            <!-- 2017-02-04 20:00:00 CET / 1486234800 --> <row><v>NaN</v><v>NaN</v><v>NaN</v><v>NaN</v><v>NaN</v><v>NaN</v></row>
        </database>
    </rra>
</rrd>

You can now convert it on your 64-bit RT-AC86U with "rrdtool restore -f stats.xml stats.rrd"
The stats.rrd file is now 64-bit and should work.
Test it with "/jffs/bin/ntpstats.sh" and there should be no errors. With the 32-bit file I've got errors. (ds_def malloc)
 
Last edited:
  • Like
Reactions: JDB
I forgot to mention another issue I had.
When starting "/jffs/bin/ntpstats.sh" it failed because it was missing "DejaVuSansMono-Roman.ttf"
I downloaded it from the internet and put it in "/opt/share/rrdtool/fonts" after creating the correct directory.
 
If you want to reload the graphs in the NTP Deamon tab do it with pressing "Shift+F5" then it's sure the pictures are reloaded from it's original location otherwise the webbrowser takes them probably from the browser cache and the graphs won't change.
 
I just want to confirm that the instructions for installing this on firmware 384+ work. Did a complete wipe and reinstalled everything after updating 380.70 --> 384.5 on my AC87 without any issues.
 
i think this works but it takes time to update the stats?
so far so good on the 88u 385.5
 
Copy the code into a newly created file stats.xml and place it in "/opt/var/spool/ntp"

Code:
<rrd>
    <version>0003</version>
    <step>300</step> <!-- Seconds -->
    <lastupdate>1494526200</lastupdate> <!-- 2017-05-11 20:10:00 CEST -->

    <ds>
        <name> offset </name>
        <type> GAUGE </type>
        <minimal_heartbeat>1200</minimal_heartbeat>
        <min>NaN</min>
        <max>NaN</max>

        <!-- PDP Status -->
        <last_ds>-8.161560</last_ds>
        <value>NaN</value>
        <unknown_sec> 0 </unknown_sec>
    </ds>

    <ds>
        <name> sjit </name>
        <type> GAUGE </type>
        <minimal_heartbeat>1200</minimal_heartbeat>
        <min>NaN</min>
        <max>NaN</max>

        <!-- PDP Status -->
        <last_ds>1.248717</last_ds>
        <value>NaN</value>
        <unknown_sec> 0 </unknown_sec>
    </ds>

    <ds>
        <name> cjit </name>
        <type> GAUGE </type>
        <minimal_heartbeat>1200</minimal_heartbeat>
        <min>NaN</min>
        <max>NaN</max>

        <!-- PDP Status -->
        <last_ds>5.769</last_ds>
        <value>NaN</value>
        <unknown_sec> 0 </unknown_sec>
    </ds>

    <ds>
        <name> wander </name>
        <type> GAUGE </type>
        <minimal_heartbeat>1200</minimal_heartbeat>
        <min>NaN</min>
        <max>NaN</max>

        <!-- PDP Status -->
        <last_ds>0.071</last_ds>
        <value>NaN</value>
        <unknown_sec> 0 </unknown_sec>
    </ds>

    <ds>
        <name> freq </name>
        <type> GAUGE </type>
        <minimal_heartbeat>1200</minimal_heartbeat>
        <min>NaN</min>
        <max>NaN</max>

        <!-- PDP Status -->
        <last_ds>6.099</last_ds>
        <value>NaN</value>
        <unknown_sec> 0 </unknown_sec>
    </ds>

    <ds>
        <name> disp </name>
        <type> GAUGE </type>
        <minimal_heartbeat>1200</minimal_heartbeat>
        <min>NaN</min>
        <max>NaN</max>

        <!-- PDP Status -->
        <last_ds>43.956</last_ds>
        <value>NaN</value>
        <unknown_sec> 0 </unknown_sec>
    </ds>

    <!-- Round Robin Archives -->
    <rra>
        <cf>LAST</cf>
        <pdp_per_row>1</pdp_per_row> <!-- 300 seconds -->

        <params>
        <xff>5.0000000000e-01</xff>
        </params>
        <cdp_prep>
            <ds>
            <primary_value>NaN</primary_value>
            <secondary_value>NaN</secondary_value>
            <value>NaN</value>
            <unknown_datapoints>0</unknown_datapoints>
            </ds>
            <ds>
            <primary_value>NaN</primary_value>
            <secondary_value>NaN</secondary_value>
            <value>NaN</value>
            <unknown_datapoints>0</unknown_datapoints>
            </ds>
            <ds>
            <primary_value>NaN</primary_value>
            <secondary_value>NaN</secondary_value>
            <value>NaN</value>
            <unknown_datapoints>0</unknown_datapoints>
            </ds>
            <ds>
            <primary_value>NaN</primary_value>
            <secondary_value>NaN</secondary_value>
            <value>NaN</value>
            <unknown_datapoints>0</unknown_datapoints>
            </ds>
            <ds>
            <primary_value>NaN</primary_value>
            <secondary_value>NaN</secondary_value>
            <value>NaN</value>
            <unknown_datapoints>0</unknown_datapoints>
            </ds>
            <ds>
            <primary_value>NaN</primary_value>
            <secondary_value>NaN</secondary_value>
            <value>NaN</value>
            <unknown_datapoints>0</unknown_datapoints>
            </ds>
        </cdp_prep>
        <database>
            <!-- 2017-05-10 18:15:00 CEST / 1494432900 --> <row><v>NaN</v><v>NaN</v><v>NaN</v><v>NaN</v><v>NaN</v><v>NaN</v></row>
        </database>
    </rra>
    <rra>
        <cf>LAST</cf>
        <pdp_per_row>12</pdp_per_row> <!-- 3600 seconds -->

        <params>
<xff>5.0000000000e-01</xff>
        </params>
        <cdp_prep>
            <ds>
            <primary_value>NaN</primary_value>
            <secondary_value>NaN</secondary_value>
            <value>NaN</value>
            <unknown_datapoints>2</unknown_datapoints>
            </ds>
            <ds>
            <primary_value>NaN</primary_value>
            <secondary_value>NaN</secondary_value>
            <value>NaN</value>
            <unknown_datapoints>2</unknown_datapoints>
            </ds>
            <ds>
            <primary_value>NaN</primary_value>
            <secondary_value>NaN</secondary_value>
            <value>NaN</value>
            <unknown_datapoints>2</unknown_datapoints>
            </ds>
            <ds>
            <primary_value>NaN</primary_value>
            <secondary_value>NaN</secondary_value>
            <value>NaN</value>
            <unknown_datapoints>2</unknown_datapoints>
            </ds>
            <ds>
            <primary_value>NaN</primary_value>
            <secondary_value>NaN</secondary_value>
            <value>NaN</value>
            <unknown_datapoints>2</unknown_datapoints>
            </ds>
            <ds>
            <primary_value>NaN</primary_value>
            <secondary_value>NaN</secondary_value>
            <value>NaN</value>
            <unknown_datapoints>2</unknown_datapoints>
            </ds>
        </cdp_prep>
        <database>
            <!-- 2017-02-04 20:00:00 CET / 1486234800 --> <row><v>NaN</v><v>NaN</v><v>NaN</v><v>NaN</v><v>NaN</v><v>NaN</v></row>
        </database>
    </rra>
</rrd>

You can now convert it on your 64-bit RT-AC86U with "rrdtool restore -f stats.xml stats.rrd"
The stats.rrd file is now 64-bit and should work.
Test it with "/jffs/bin/ntpstats.sh" and there should be no errors. With the 32-bit file I've got errors. (ds_def malloc)
Is this working for you still? Script runs, time on graphs updates, but no data is plotted.
 
Yes, for me it's still working. Maybe save again the stats.rrd to the correct folder.
Maybe ntp is wrongly configured.
This is mine S77ntpd init.d file configuration:
Code:
#!/bin/sh


ENABLED=yes
PROCS=ntpd
ARGS="-c /opt/etc/ntp.conf -f /opt/var/spool/ntp/ntp.drift -s /opt/var/spool/ntp -l /opt/var/spool/ntp/ntp.log"
PREARGS=""
DESC=$PROCS
PATH=/opt/sbin:/opt/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

. /opt/etc/init.d/rc.func

I also removed the ntpd-custom startupscript from /opt/etc/init.d folder. I'm only use the installed entware version.
Be shure you have the following line added to the init-start script:
*/5 * * * * /jffs/bin/ntpstats.sh #NTP_Stats#

Even after several firmware updates it's still working correctly.
Hopes this helps........

upload_2018-8-30_21-19-10.png
 
Last edited:
I also removed the ntpd-custom startupscript from /opt/etc/init.d folder. I'm only use the installed entware version.

People haven't raised the request for a new build for the NTP binaries for quite some time. I guess everyone take a move similar to you :)

It's both good and bad. On the good side, Entware keeps you stay on a relatively newer version of ntp. On the bad side, its binary uses >10MB of RAM for a task that can be done with 2MB (if I recall correctly) !

For people not opening your NTPd to WAN, it's actually more efficient to run the binary from this thread's package. I trimmed the RAM usage as well as turn a few knobs to optimise timing performance. Right now might be a few patch releases behind the latest but it's no harm.
 
People haven't raised the request for a new build for the NTP binaries for quite some time. I guess everyone take a move similar to you :)

To be honest, I stopped using it a while ago, I think when the massive changes in the WebUI came (I think that whas when the 382 branch was released?) and several workarounds had to be applied to keep it working. I guess I lost track of things there. If you could ever find the time to update it to work with the 384 branch 'out of the box', I'd personally really appreciate it. I'd love to have it running again and join the ntp pool.
 
To be honest, I stopped using it a while ago, I think when the massive changes in the WebUI came (I think that whas when the 382 branch was released?) and several workarounds had to be applied to keep it working. I guess I lost track of things there. If you could ever find the time to update it to work with the 384 branch 'out of the box', I'd personally really appreciate it. I'd love to have it running again and join the ntp pool.

Mine works with 384 out of the box...

The only issue I’ve seen is with 64bit platforms, ie the 86U


Sent from my iPhone using Tapatalk
 
Mine works with 384 out of the box...
Maybe there has been an update in the meantime. I'll give it another shot. While reading @kvic's post I assumed he referred to the workarounds needed to get it working on the more recent branches.
 
Mine works with 384 out of the box...

The only issue I’ve seen is with 64bit platforms, ie the 86U

Damn that's the one I have... Any thoughts on this? I really want a local NTP service, sync'd to a GPS clock if possible (can be done).
 
I've got it running on my 64-bit RT-AC86U.
The "mount -a" isn't an issue anymore with the 384.5 alpha versions.

View attachment 12793
View attachment 12794

There are the following issues after installing which have to be fixed:
- The files ntpd, ntpdc and ntpq in /jffs/bin are 32-bit.
Install ntp-utils with 'opkg install ntp-utils'. Copy ntpdc and ntpq from /opt/var/spool/ntp to /jffs/bin.
Install ntpd with 'opkg install ntpd'. Copy ntpd from /opt/sbin to /jffs/bin.​
- The stats.rrd file in "/opt/var/spool/ntp" is 32-bit and needs to be converted to 64-bit.
See next post for stats.xml code.​

My layout got a different view because I changed it......

Did you try these changes bitmonster?


Sent from my iPhone using Tapatalk
 
Thank you, I had not seen this. Is it difficult to get working?

Sent from my SM-G965F using Tapatalk

Spanjap has fine a good job of showing the exact commands, so no, it’s not hard.


Sent from my iPhone using Tapatalk
 
I'd love to see this updated to work with newer firmware and units.
 
If someone with an 86U can help me test it I’ll happily do so.
I believe it works fine on all other models/latest firmware


Sent from my iPhone using Tapatalk
 
If someone with an 86U can help me test it I’ll happily do so.
I believe it works fine on all other models/latest firmware


Sent from my iPhone using Tapatalk
I had graph issues on my 88u last time I used it they wouldn't update.
 
It's a pity that this project seems somewhat abandoned. Given the fact that the last update (R3) dates back to March 2017 and there have been so many changes since then, I don't have the guts (or the knowledge for that matter) to start tinkering with it. I know @JDB mentioned it should work out of the box, but reading back I realized that it hasn't been updated after the massive overhaul of the UI and there was some tinkering to be done to get the NTP tab back. If someone has time and knowledge to make this available to the less tech-savvy users (like your truly :rolleyes:), it would be much appreciated :).
 
It's a pity that this project seems somewhat abandoned. Given the fact that the last update (R3) dates back to March 2017 and there have been so many changes since then, I don't have the guts (or the knowledge for that matter) to start tinkering with it. I know @JDB mentioned it should work out of the box, but reading back I realized that it hasn't been updated after the massive overhaul of the UI and there was some tinkering to be done to get the NTP tab back. If someone has time and knowledge to make this available to the less tech-savvy users (like your truly :rolleyes:), it would be much appreciated :).

I am maintaining it, but the problem I have is it does seem to just work for me following the old instructions. Only the 64bit 86U seems to need some love (which as stated I will have a go at but need someone with the router to help me test any changes).

I have an 88U and 2x AC5300's so I'm not sure why Vexira is having an issue as I have the same router.

If someone with an issue (and is vaguely tech savvy) can provide more info than "the graphs don't work" I'll glad look into reproducing and fixing any problems.
 

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top