Skip to content

Instantly share code, notes, and snippets.

@growse
Created November 19, 2015 21:45
Show Gist options
  • Save growse/24796c871f2cb32effc1 to your computer and use it in GitHub Desktop.
Save growse/24796c871f2cb32effc1 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
TIME=$((1000000000* `date +%s`))
curl -XPOST http://storebot.growse.com:8086/write?db=main --data-binary $"chrony_systemtimeoffset,host=`hostname` value=`chronyc tracking |grep 'System time'|cut -f 2 -d ':'|sed 's/ *\([0-9\.]*\) seconds \(slow\|fast\) of NTP time/\2\1/g'|sed 's/slow/-/'|sed 's/fast//'` $TIME
chrony_frequency,host=`hostname` value=`chronyc tracking |grep 'Frequency'|cut -f 2 -d ':'|sed 's/ *\([0-9\.]*\) ppm \(slow\|fast\)/\2\1/g'|sed 's/slow/-/'|sed 's/fast//'` $TIME"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment