Skip to content

Instantly share code, notes, and snippets.

@lukebigum
Created April 6, 2016 16:10
Show Gist options
  • Save lukebigum/9735c2556a1106008672108737eb1dc2 to your computer and use it in GitHub Desktop.
Save lukebigum/9735c2556a1106008672108737eb1dc2 to your computer and use it in GitHub Desktop.
Awk script for PTPd stats
BEGIN {"hostname" | getline hstnm ; };
{
#one_way_delay
a = $4
v = gensub(/ /, "", "g", a)
print "PUTVAL " hstnm "/one_way_delay/precise_time_offset interval=1 N:" v*1000000000
#offset_from_master
a = $5
v = gensub(/ /, "", "g", a)
print "PUTVAL " hstnm "/offset_from_master/precise_time_offset interval=1 N:" v*1000000000
#slave_to_master
b = $6
v = gensub(/ /, "", "g", b)
print "PUTVAL " hstnm "/slave_to_master/precise_time_offset interval=1 N:" v*1000000000
#master_to_slave
b = $7
v = gensub(/ /, "", "g", b)
print "PUTVAL " hstnm "/master_to_slave/precise_time_offset interval=1 N:" v*1000000000
#observed_drift
b = $8
v = gensub(/ /, "", "g", b)
print "PUTVAL " hstnm "/observed_drift/precise_frequency_offset interval=1 N:" v
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment