To install, run the following as normal user (not root):
curl -Ls https://gist.github.com/mattrude/b184abb90a1a9cbe6b260a9520c69ff4/raw/installer.sh |bash
To confirm that report is scheduled to run:
systemctl list-timers --all
#!/bin/bash | |
URL=https://gist.github.com/mattrude/b184abb90a1a9cbe6b260a9520c69ff4 | |
sudo curl -Ls ${URL}/raw/ntpsec-reporter.sh -o /usr/local/bin/ntpsec-reporter.sh && \ | |
sudo curl -Ls ${URL}/raw/ntpsec-reporter.service -o /lib/systemd/system/ntpsec-reporter.service && \ | |
sudo curl -Ls ${URL}/raw/ntpsec-reporter.timer -o /lib/systemd/system/ntpsec-reporter.timer && \ | |
sudo chmod +x /usr/local/bin/ntpsec-reporter.sh && \ | |
sudo systemctl enable ntpsec-reporter.timer && \ | |
sudo systemctl start ntpsec-reporter.timer && \ | |
echo "NTPsec Reporter Install Complete!" |
[Unit] | |
Description=Report information for NTPsec | |
Requisite=ntpd.service | |
[Service] | |
Type=simple | |
IOSchedulingClass=idle | |
ExecStart=/usr/local/bin/ntpsec-reporter.sh |
#!/bin/bash | |
OUT=/var/www/html/time.txt | |
echo "The Odin Network Time Service on `cat /etc/hostname`.local (`hostname -I |awk '{print $1}'`)" > $OUT | |
echo -n "Current Time : " >> $OUT | |
echo `date` >> $OUT | |
echo -n "Load Average : " >> $OUT | |
cat /proc/loadavg |awk '{ print $1", "$2", " $3 }' >> $OUT | |
echo -n "System Uptime : " >> $OUT | |
uptime -p |sed 's/up //g' >> $OUT | |
echo -n "Process Uptime : " >> $OUT | |
ps -p `sudo cat /var/run/ntpd.pid` -o etime= |sed 's/ //g' >> $OUT | |
echo -n "CPU Temperature : " >> $OUT | |
/usr/bin/vcgencmd measure_temp |awk -F "[=']" '{print($2 * 1.8)+32}' |awk '{print $0"°f"}' >> $OUT | |
/usr/local/bin/ntpq -c rv > out | |
sed 1d out |sed 's/,/\r\n/g' |sed 's/reftime=/reftime=\"/g' |sed 's/clock=/clock=\"/g' |sed 's/^ //' |sed '/^$/d' |sed 's/.Z/Z"/' |sed 's/""/"/g' > out2 | |
. out2 | |
echo "" >> $OUT | |
echo "Server Status" >> $OUT | |
echo "Reference ID : $refid" >> $OUT | |
echo "Stratum : $stratum" >> $OUT | |
echo "Precision : $precision" >> $OUT | |
echo -n "Service Status : " >> $OUT | |
cat out |head -1 |sed 's/status=//g' |sed 's/,$//' >> $OUT | |
echo "Ref time (UTC) : $reftime" >> $OUT | |
echo "Sys time (UTC) : $clock" >> $OUT | |
echo "Last offset : $offset" >> $OUT | |
echo "Frequency : $frequency" >> $OUT | |
echo "System Jitter : $sys_jitter" >> $OUT | |
echo "Clock Jitter : $clk_jitter" >> $OUT | |
echo "Clock Wonder : $clk_wander" >> $OUT | |
echo "System Processor : $processor" >> $OUT | |
echo "System Type : $system" >> $OUT | |
echo "Software : $version" >> $OUT | |
rm out out2 | |
echo "" >> $OUT | |
echo "Connected Clients" >> $OUT | |
/usr/local/bin/ntpq -sc mrulist |grep -v "^#" |grep -v "^Ctrl-C" |grep -v "localhost" |grep -v 'nist.gov' |grep -v 'nts.umn.edu' |grep -v "state.mn.us" |grep -v time.*local >> $OUT | |
echo "" >> $OUT | |
echo "Server Sources" >> $OUT | |
/usr/local/bin/ntpq -W 90 -p >> $OUT | |
echo "" >> $OUT | |
echo "Server Peer Associations" >> $OUT | |
/usr/local/bin/ntpq -n -W 90 -c apeers >> $OUT | |
echo "" >> $OUT | |
echo -n "Server Associations" >> $OUT | |
/usr/local/bin/ntpq -c as >> $OUT | |
echo "" >> $OUT | |
echo "Source: https://gist.github.com/mattrude/b184abb90a1a9cbe6b260a9520c69ff4" >> $OUT |
[Unit] | |
Description=Run ntpviz for daily data graphing once an hour | |
[Timer] | |
OnCalendar=*:0/15:0 | |
Persistent=true | |
AccuracySec=1s | |
[Install] | |
WantedBy=timers.target |