Révision 17f78427
Whitespace cleanup
- remove trailing whitespace
- remove empty lines at the end of files
| plugins/network/transmission | ||
|---|---|---|
| 13 | 13 |
transmission_throughput - monitor traffic volumes of Transmission torrents |
| 14 | 14 |
transmission_activity - plugin to monitor traffic speed of Transmission torrents |
| 15 | 15 |
|
| 16 |
This plugin requires python and the transmissionrpc python module.
|
|
| 16 |
This plugin requires python and the transmissionrpc python module. |
|
| 17 | 17 |
See http://pypi.python.org/pypi/transmissionrpc/ |
| 18 | 18 |
|
| 19 | 19 |
=head1 CONFIGURATION |
| ... | ... | |
| 64 | 64 |
=head1 CHANGELOG |
| 65 | 65 |
|
| 66 | 66 |
=head2 1.0 - 2010/11/12 |
| 67 |
|
|
| 67 |
|
|
| 68 | 68 |
first release |
| 69 | 69 |
|
| 70 | 70 |
=head2 1.1 - 2011/05/29 |
| 71 |
|
|
| 71 |
|
|
| 72 | 72 |
fix transmission error handling |
| 73 |
|
|
| 73 |
|
|
| 74 | 74 |
=cut |
| 75 | 75 |
""" |
| 76 | 76 |
__version__ = '1.1' |
| ... | ... | |
| 138 | 138 |
|
| 139 | 139 |
def fetch(): |
| 140 | 140 |
import transmissionrpc |
| 141 |
|
|
| 141 |
|
|
| 142 | 142 |
try: |
| 143 | 143 |
client = transmissionrpc.Client(host, port=port, user=user, password=passwd) |
| 144 | 144 |
except transmissionrpc.TransmissionError, err: |
| ... | ... | |
| 148 | 148 |
stats = client.session_stats(10) |
| 149 | 149 |
print_values_throughput(stats) |
| 150 | 150 |
print_values_activity(stats) |
| 151 |
|
|
| 152 |
|
|
| 151 |
|
|
| 152 |
|
|
| 153 | 153 |
def print_values_activity(stats): |
| 154 | 154 |
print "multigraph {plugin_name}_activity".format(plugin_name=plugin_name)
|
| 155 | 155 |
try: |
| 156 | 156 |
print "total.value %s" % stats.torrentCount |
| 157 | 157 |
except: |
| 158 | 158 |
print "total.value U" |
| 159 |
|
|
| 159 |
|
|
| 160 | 160 |
try: |
| 161 | 161 |
print "active.value %s" % stats.activeTorrentCount |
| 162 | 162 |
except: |
| 163 | 163 |
print "active.value U" |
| 164 |
|
|
| 164 |
|
|
| 165 | 165 |
try: |
| 166 | 166 |
print "paused.value %s" % stats.pausedTorrentCount |
| 167 | 167 |
except: |
| ... | ... | |
| 174 | 174 |
print "down.value %s" % stats.cumulative_stats['downloadedBytes'] |
| 175 | 175 |
except: |
| 176 | 176 |
print "down.value U" |
| 177 |
|
|
| 177 |
|
|
| 178 | 178 |
try: |
| 179 | 179 |
print "up.value %s" % stats.cumulative_stats['uploadedBytes'] |
| 180 | 180 |
except: |
| 181 | 181 |
print "up.value U" |
| 182 |
|
|
| 182 |
|
|
| 183 | 183 |
|
| 184 | 184 |
|
| 185 | 185 |
def dumpstats(): |
| ... | ... | |
| 192 | 192 |
stats = client.session_stats(10) |
| 193 | 193 |
print stats |
| 194 | 194 |
|
| 195 |
|
|
| 195 |
|
|
| 196 | 196 |
if __name__ == '__main__': |
| 197 | 197 |
if len(sys.argv)>1 : |
| 198 | 198 |
if sys.argv[1]=="dumpstats" : |
Formats disponibles : Unified diff