My ADSB Receiver Box – Monitoring clock performance – Upgrade 4

To generate additional performance graphs the file /home/pi/adsb-receiver/build/portal/graphs/make-collectd-graphs.sh needs to extended. Edit the file and add a new function.

Find:
## RECEIVER GRAPHS

Before add:
clock_stats_graph() {
  rrdtool graph \
  "$1" \
  --start end-$4 \
  --width 480 \
  --height 200 \
  --step "$5" \
  --title "Clock" \
  --vertical-label "microseconds" \
  --lower-limit -5 \
  --upper-limit 5 \
  --units-exponent 1 \
  "TEXTALIGN:center" \
  "DEF:offset=$2/gauge-offset.rrd:value:AVERAGE" \
  "DEF:sysjitter=$2/gauge-sys_jitter.rrd:value:AVERAGE" \
  "DEF:clkjitter=$2/gauge-clk_jitter.rrd:value:AVERAGE" \
  "CDEF:offsetfin=offset,1000,*" \
  "CDEF:sysjitterfin=sysjitter,1000,*" \
  "CDEF:clkjitterfin=clkjitter,1000,*" \
  "LINE1:offsetfin#00ff00:Offset" \
  "LINE1:sysjitterfin#ff0000:System Jitter" \
  "LINE1:clkjitterfin#0000FF:Clock Jitter" \
  "COMMENT: \n" \
  --watermark "Drawn: $nowlit";
}

Still editing the file, scroll down and find the function system_graphs(), just below the line that call wlan0_graph add the following line:

clock_stats_graph ${DOCUMENTROOT}/graphs/system-$2-clock_stats-$4.png /var/lib/collectd/rrd/$1/ntpq "$3" "$4" "$5"

Save the file and exit the editor. Now the cron job will generate the graph images for our clock performance monitoring. Next we need to change the ADSB portal receiver code to show the graph image in browser. Therefore we edit /var/www/html/templates/default/graphs.tpl and /var/www/html/templates/default/assets/js/graphs.js.

In graphs.js:

Find:
$("#system-memory-image").attr("src", "graphs/system-" + $hostName + "-memory-" + $timeFrame + ".png?time=" + $timestamp);
$("#system-memory-link").attr("href", "graphs/system-" + $hostName + "-memory-" + $timeFrame + ".png?time=" + $timestamp);

Below add:
$("#system-clock-image").attr("src", "graphs/system-" + $hostName + "-clock_stats-" + $timeFrame + ".png?time=" + $timestamp);
$("#system-clock-link").attr("href", "graphs/system-" + $hostName + "-clock_stats-" + $timeFrame + ".png?time=" + $timestamp);

In graphs.tpl we add a new row to the system graphs section:

<div class="padding"></div>
<div class="row">
   <div class="col-md-6 text-center">
      <a id ="system-clock-link" href="#">
         <img id="system-clock-image" class="img-responsive" src="#" alt="Clock Statistics">
      </a>
   </div>
</div>

These changes will provide you statistics about clock performance in your ADSB receiver.

This description is applicable for the ADSB receiver image from https://www.adsbreceiver.net/. Above files are available below for download.

Read Ntpq
Read Ntpq
read_ntpq.sh
644.0 B
31 Downloads
Details
Collectd
Collectd
collectd.conf
4.9 KB
31 Downloads
Details
Make-collectd-graphs
Make-collectd-graphs
make-collectd-graphs.sh
23.1 KB
31 Downloads
Details
Graphs
Graphs
graphs.tpl
11.9 KB
35 Downloads
Details
Graphs
Graphs
graphs.js
8.2 KB
35 Downloads
Details

Leave a Reply

Your email address will not be published. Required fields are marked *

Comments will be moderated! Spam deleted immediately!
Before you submit form:
Human test by Not Captcha