mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-22 02:51:03 +00:00
Merge pull request #1086 from shtrom/transmission-consistency-fixups
[plugins/transmission] Fixups for consistency
This commit is contained in:
commit
81bdedaf42
1 changed files with 19 additions and 19 deletions
|
@ -76,23 +76,25 @@ find this plugin on github at http://github.com/VolatileMesh/munin-plugins
|
||||||
__version__ = '1.1'
|
__version__ = '1.1'
|
||||||
|
|
||||||
|
|
||||||
import os, sys
|
import os
|
||||||
|
import sys
|
||||||
from string import Template
|
from string import Template
|
||||||
|
|
||||||
plugin_name=list(os.path.split(sys.argv[0]))[1]
|
plugin_name = list(os.path.split(sys.argv[0]))[1]
|
||||||
host = os.getenv('host','localhost')
|
host = os.getenv('host', 'localhost')
|
||||||
port = os.getenv('port',9091)
|
port = os.getenv('port', 9091)
|
||||||
user = os.getenv('user')
|
user = os.getenv('user')
|
||||||
passwd = os.getenv('pass')
|
passwd = os.getenv('pass')
|
||||||
|
title_host = '' if host in ['localhost', '127.0.0.1', '::1'] else ' on ' + host
|
||||||
|
|
||||||
|
|
||||||
def config():
|
def config():
|
||||||
conf = Template("""multigraph ${plugin_name}_throughput
|
conf = Template("""multigraph ${plugin_name}_throughput
|
||||||
graph_title Transmission throughput for ${host}
|
graph_title Transmission throughput${title_host}
|
||||||
graph_vlabel bytes/${graph_period} in (-) / out (+)
|
graph_vlabel bytes/${graph_period} in (-) / out (+)
|
||||||
graph_args --base 1000
|
graph_args --base 1000
|
||||||
graph_category network
|
graph_category network
|
||||||
graph_info This graph shows the throughput for Transmission torrents
|
graph_info This graph shows the throughput for Transmission torrents on ${host}
|
||||||
down.label throughput
|
down.label throughput
|
||||||
down.type COUNTER
|
down.type COUNTER
|
||||||
down.draw AREA
|
down.draw AREA
|
||||||
|
@ -105,21 +107,21 @@ up.draw AREA
|
||||||
up.min 0
|
up.min 0
|
||||||
|
|
||||||
multigraph ${plugin_name}_activity
|
multigraph ${plugin_name}_activity
|
||||||
graph_title Transmission activity for ${host}
|
graph_title Transmission activity${title_host}
|
||||||
graph_vlabel torrents
|
graph_vlabel torrents
|
||||||
graph_args --base 1000
|
graph_args --base 1000
|
||||||
graph_category network
|
graph_category network
|
||||||
graph_info This graph shows the number of Transmission torrents
|
graph_info This graph shows the number of Transmission torrents on ${host}
|
||||||
active.label active
|
active.label active
|
||||||
active.draw AREA
|
active.draw AREA
|
||||||
active.min 0
|
active.min 0
|
||||||
active.colour 77FF6F
|
active.colour COLOUR0
|
||||||
paused.label paused
|
paused.label paused
|
||||||
paused.draw STACK
|
paused.draw STACK
|
||||||
paused.min 0
|
paused.min 0
|
||||||
paused.colour 8F8F8F
|
paused.colour COLOUR8
|
||||||
""")
|
""")
|
||||||
print conf.safe_substitute(plugin_name=plugin_name, host=host)
|
print conf.safe_substitute(plugin_name=plugin_name, host=host, title_host=title_host)
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
|
|
||||||
|
@ -131,7 +133,6 @@ def autoconf():
|
||||||
print 'no python module \'transmissionrpc\' missing'
|
print 'no python module \'transmissionrpc\' missing'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def fetch():
|
def fetch():
|
||||||
import transmissionrpc
|
import transmissionrpc
|
||||||
|
|
||||||
|
@ -172,7 +173,6 @@ def print_values_throughput(stats):
|
||||||
print "up.value U"
|
print "up.value U"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def dumpstats():
|
def dumpstats():
|
||||||
import transmissionrpc
|
import transmissionrpc
|
||||||
try:
|
try:
|
||||||
|
@ -185,14 +185,14 @@ def dumpstats():
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
if len(sys.argv)>1 :
|
if len(sys.argv) > 1 :
|
||||||
if sys.argv[1]=="dumpstats" :
|
if sys.argv[1] == "dumpstats" :
|
||||||
dumpstats()
|
dumpstats()
|
||||||
elif sys.argv[1]=="config" :
|
elif sys.argv[1] == "config" :
|
||||||
config()
|
config()
|
||||||
elif sys.argv[1]=="autoconf" :
|
elif sys.argv[1] == "autoconf" :
|
||||||
autoconf()
|
autoconf()
|
||||||
elif sys.argv[1]!="":
|
elif sys.argv[1] != "":
|
||||||
raise ValueError, "unknown parameter '%s'" % sys.argv[1]
|
raise ValueError, "unknown parameter '%s'" % sys.argv[1]
|
||||||
|
|
||||||
fetch()
|
fetch()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue