From 1a25481e2c52769215669fb874eb0e57f17a3f90 Mon Sep 17 00:00:00 2001 From: Lars Kruse Date: Wed, 26 Oct 2016 00:38:07 +0200 Subject: [PATCH] [tr_ratios] include awk scripts; awk instead of gawk since we cannot rely on the location of the two included awk scripts, we just include them literally --- plugins/network/transmission_ratios/tr_ratios | 20 +++++++++++++++++-- .../transmission_ratios/tr_ratios_data | 10 ---------- .../transmission_ratios/tr_ratios_labels | 8 -------- 3 files changed, 18 insertions(+), 20 deletions(-) delete mode 100644 plugins/network/transmission_ratios/tr_ratios_data delete mode 100644 plugins/network/transmission_ratios/tr_ratios_labels diff --git a/plugins/network/transmission_ratios/tr_ratios b/plugins/network/transmission_ratios/tr_ratios index 316b6088..ce058a68 100755 --- a/plugins/network/transmission_ratios/tr_ratios +++ b/plugins/network/transmission_ratios/tr_ratios @@ -8,8 +8,24 @@ if [ "$1" = "config" ]; then echo "graph_vlabel Seed ratio %" echo "graph_category torrent" echo "graph_info This plugin shows your transmission ratios per torrent" - transmission-remote -n "$user:$pass" -l | gawk -f /usr/share/munin/plugins/tr_ratios_labels | iconv -f utf-8 -t ascii//translit + transmission-remote -n "$user:$pass" -l | awk ' + BEGIN { FIELDWIDTHS = "7 4 13 10 7 9 7 13 40" } + NR > 1 { + split($1,torrentid," ") + if (torrentid[1] != "Sum:") { + print "ID" torrentid[1] ".label " $9 + } + }' | iconv -f utf-8 -t ascii//translit exit 0 fi -transmission-remote -n "$user:$pass" -l | gawk -f /usr/share/munin/plugins/tr_ratios_data +transmission-remote -n "$user:$pass" -l | awk ' + BEGIN { FIELDWIDTHS = "7 4 13 10 7 9 7 13 40" } + NR > 1 { + split($1,torrentid," ") + if (torrentid[1] != "Sum:") { + split($7,ratio," ") + ratio[1] = ratio[1] * 100 + print "ID" torrentid[1] ".value " ratio[1] + } + }' diff --git a/plugins/network/transmission_ratios/tr_ratios_data b/plugins/network/transmission_ratios/tr_ratios_data deleted file mode 100644 index fd9dd551..00000000 --- a/plugins/network/transmission_ratios/tr_ratios_data +++ /dev/null @@ -1,10 +0,0 @@ -BEGIN { FIELDWIDTHS = "7 4 13 10 7 9 7 13 40" } -NR > 1 { - split($1,torrentid," ") - if(torrentid[1] != "Sum:") { - split($7,ratio," ") - ratio[1] = ratio[1] * 100 - print "ID" torrentid[1] ".value " ratio[1] - } -} - diff --git a/plugins/network/transmission_ratios/tr_ratios_labels b/plugins/network/transmission_ratios/tr_ratios_labels deleted file mode 100644 index 273ab3d3..00000000 --- a/plugins/network/transmission_ratios/tr_ratios_labels +++ /dev/null @@ -1,8 +0,0 @@ -BEGIN { FIELDWIDTHS = "7 4 13 10 7 9 7 13 40" } -NR > 1 { - split($1,torrentid," ") - if(torrentid[1] != "Sum:") { - print "ID" torrentid[1] ".label " $9 - } -} -