2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00

[chrony] determine path of "chronyc" via "which"

This commit is contained in:
Lars Kruse 2016-11-10 23:50:31 +01:00
parent 6fd9d9072b
commit cfd1612aa5

View File

@ -44,8 +44,7 @@ Revision 0.3 2014/02/16 zjttoefs
=cut =cut
# Modify this to fit other chronyc path CHRONYC="$(which chronyc | head -1)"
CHRONYC=/usr/bin/chronyc
# Frequency has extremely higher values than other. Therefore they are fitted by scaling. Adjust the factors here # Frequency has extremely higher values than other. Therefore they are fitted by scaling. Adjust the factors here
fieldfactors="1 1000 1 100 100 1000 1000" fieldfactors="1 1000 1 100 100 1000 1000"
@ -53,7 +52,7 @@ fields="stratum systime frequency residualfreq skew rootdelay rootdispersion"
fieldnames="Stratum (=System Time (seconds,x=Frequency (ppm,x=Residual Freq (ppm,x=Skew (ppm,x=Root delay(seconds,x=Root dispersion (seconds,x" fieldnames="Stratum (=System Time (seconds,x=Frequency (ppm,x=Residual Freq (ppm,x=Skew (ppm,x=Root delay(seconds,x=Root dispersion (seconds,x"
if [ "$1" = "autoconf" ]; then if [ "$1" = "autoconf" ]; then
if [ -f "$CHRONYC" ]; then if [ -n "$CHRONYC" ] && [ -x "$CHRONYC" ]; then
echo yes echo yes
exit 0 exit 0
else else
@ -79,7 +78,7 @@ if [ "$1" = "config" ]; then
fi fi
# remove non-needed output lines, remove labels, rescale and label values while detecting slow/fast keywords # remove non-needed output lines, remove labels, rescale and label values while detecting slow/fast keywords
chronyc tracking | sed -e 1d -e 3d -e "s/.*://" | \ "$CHRONYC" tracking | sed -e 1d -e 3d -e "s/.*://" | \
awk -v FAC="$fieldfactors" -v NAM="$fields" \ awk -v FAC="$fieldfactors" -v NAM="$fields" \
'BEGIN { split(FAC,factors," "); split(NAM,names," "); } 'BEGIN { split(FAC,factors," "); split(NAM,names," "); }
{ /slow/ ? SIGN=-1 : SIGN=1 ; print names[NR]".value ",SIGN*$1*factors[NR]}' { /slow/ ? SIGN=-1 : SIGN=1 ; print names[NR]".value ",SIGN*$1*factors[NR]}'