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

Use source hostname as first 'hop' value (removing it from graph title)

This commit is contained in:
Lee Clemens 2016-11-12 13:48:09 -05:00
parent dc129c541b
commit b3a486fa62

View File

@ -50,7 +50,7 @@ fi
dotrace() {
LC_ALL=C mtr -nrs 1024 -c 5 $totrace | grep -vi -E "^HOST:|^Start:" | LC_ALL=C awk -v C=$1 ' {
LC_ALL=C mtr -nrs 1024 -c 5 $totrace | grep -vi -E "^HOST:|^Start:" | LC_ALL=C awk -v C=$1 -v SRC_HOSTNAME=$(hostname) ' {
label=$2
x=gsub("\\.","_",label)
@ -63,17 +63,20 @@ total+=$6
}
END {
if ( C != "config" ) { print "hop_0.value U" }
if ( C == "config" ) { print "hop_0.label " SRC_HOSTNAME }
if ( C == "config" ) { print "hop_0.draw AREA" }
for (x=1; x<=count; x++) {
value=(val[x]/total)*100
if ( C != "config" ) { printf "%s.value %2.2f\n","hop_" lab[x],value }
if ( C == "config" ) { print "hop_" lab[x] ".label " name[x] }
if ( C == "config" ) { if ( x == 1 ) { print "hop_" lab[x]".draw AREA" } else { print "hop_" lab[x]".draw STACK" } }
if ( C == "config" ) { print "hop_" lab[x]".draw STACK" }
}
}'
}
if [ "$1" = "config" ]; then
echo "graph_title Traceroute `mtr -nrc 1 localhost | grep -E '^HOST' | awk '{print $2}'` to "$totrace
echo 'graph_title Traceroute (%) to '$totrace
echo 'graph_args --base 1000 -l 0 -u 100 -r'
echo 'graph_vlabel ms (percentage)'
echo 'graph_category network'