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

68 lines
1.3 KiB
Plaintext
Raw Normal View History

#!/bin/sh
2016-10-26 02:04:11 +02:00
# -*- sh -*-
user=''
pass=''
2016-10-26 02:04:11 +02:00
: <<=cut
=head1 NAME
tr_ratios - monitor transfer ratios of the "transmission" bittorent program
=head1 APPLICABLE SYSTEMS
Any system with "transmission" installed and a transmission daemon running.
=head1 CONFIGURATION
Maybe you need to configure access credentials and connection settings:
[tr_ratios]
env.host localhost
env.port 9091
env.username alice
env.password secret
=head1 MAGIC MARKERS
#%# family=auto
#%# capabilities=autoconf
=head1 AUTHOR
unspecified
=head1 LICENSE
unspecified
=cut
if [ "$1" = "config" ]; then
echo "graph_title Transmission seed ratios"
echo "graph_vlabel Seed ratio %"
2014-09-07 14:20:12 +02:00
echo "graph_category torrent"
echo "graph_info This plugin shows your transmission ratios per torrent"
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 | 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]
}
}'