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

Merge pull request #921 from sulaweyo/master

rtorrent version 0.9.7 compatible
This commit is contained in:
Lars Kruse 2018-07-15 17:18:15 +02:00 committed by GitHub
commit 579548697c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 294 additions and 260 deletions

View file

@ -27,6 +27,7 @@
# ip rTorrent's ip address - using scgi_port - needed, when "src" is NOT set to "socket"
# port rTorrent's scgi port (scgi_port) - using scgi_port - needed, when "src" is NOT set to "socket"
# category Change graph category
# api use "pre09" (pre 0.9.0) or "current" (0.9.0+) API calls
#
# Configuration example
#
@ -35,6 +36,7 @@
# env.src socket
# env.socket /home/user/torrent/.socket/rpc.socket,/home/user/torrent/.socket/rpc.socket
# env.category Category
# env.api current
#
# [rtom_allsessions_*]
# user username
@ -66,10 +68,16 @@ my $src = $ENV{"src"} || "";
my @sockets = split /,/, $ENV{"socket"} || "";
my $ip = $ENV{"ip"} || "127.0.0.1";
my @ports = split /,/, $ENV{"port"} || "";
my $api = $ENV{"api"} || "current";
my $mem = 0;
my $pattern = qr/<value><(int|i4|i8|ex\.i8)>(\d+)<\/(int|i4|i8|ex\.i8)><\/value>/;
my $line = "<?xml version=\"1.0\" encoding=\"utf-8\"?><methodCall><methodName>get_memory_usage</methodName></methodCall>";
my $line = "";
if ($api =~ /pre09/) {
$line = "<?xml version=\"1.0\" encoding=\"utf-8\"?><methodCall><methodName>get_memory_usage</methodName></methodCall>";
} else {
$line = "<?xml version=\"1.0\" encoding=\"utf-8\"?><methodCall><methodName>pieces.memory.current</methodName></methodCall>";
}
my $llen = length $line;
my $header = "CONTENT_LENGTH\000${llen}\000SCGI\001\000";
my $hlen = length $header;

View file

@ -25,6 +25,7 @@
# src "socket" when using scgi_socket, or anything else when using scgi_port
# socket rTorrent's rpc socket (scgi_local) - using scgi_local - needed, when "src" is set to "socket"
# category Change graph category
# api use "pre09" (pre 0.9.0) or "current" (0.9.0+) API calls
#
# Configuration example
#
@ -33,6 +34,7 @@
# env.src socket
# env.socket /home/user/torrent/.socket/rpc.socket,/home/user/torrent/.socket/rpc.socket
# env.category Category
# env.api current
#
# [rtom_allsessions_*]
# user username
@ -76,11 +78,17 @@ my $src = $ENV{"src"} || "";
my @sockets = split /,/, $ENV{"socket"} || "";
my $ip = $ENV{"ip"} || "127.0.0.1";
my @ports = split /,/, $ENV{"port"} || "";
my $api = $ENV{"api"} || "current";
my $pattern = qr/<value><(int|i4|i8|ex\.i8)>(\d+)<\/(int|i4|i8|ex\.i8)><\/value>/;
my $tpattern = qr/[0-9A-F]{20}/;
my $line = "<?xml version=\"1.0\" encoding=\"utf-8\"?><methodCall><methodName>d.multicall</methodName><params><param><value><string>main</string></value></param><param><value><string>d.get_hash=</string></value></param><param><value><string>p.multicall=,p.is_encrypted=,p.is_incoming=</string></value></param></params></methodCall>";
my $line = "";
if ($api =~ /pre09/) {
$line = "<?xml version=\"1.0\" encoding=\"utf-8\"?><methodCall><methodName>d.multicall</methodName><params><param><value><string>main</string></value></param><param><value><string>d.get_hash=</string></value></param><param><value><string>p.multicall=,p.is_encrypted=,p.is_incoming=</string></value></param></params></methodCall>";
} else {
$line = "<?xml version=\"1.0\" encoding=\"utf-8\"?><methodCall><methodName>d.multicall2</methodName><params><param><value><string></string></value></param><param><value><string>main</string></value></param><param><value><string>d.hash=</string></value></param><param><value><string>p.multicall=,p.is_encrypted=,p.is_incoming=</string></value></param></params></methodCall>";
}
my $llen = length $line;
my $header = "CONTENT_LENGTH\000${llen}\000SCGI\001\000";
my $hlen = length $header;

View file

@ -36,6 +36,7 @@
# src "socket" when using scgi_socket, or anything else when using scgi_port
# socket rTorrent's rpc socket (scgi_local) - using scgi_local - needed, when "src" is set to "socket"
# diff "yes" for using bps for upload and Bps for download, or anything else for using Bps for both
# api use "pre09" (pre 0.9.0) or "current" (0.9.0+) API calls
#
#
# Configuration example
@ -45,6 +46,7 @@
# env.src socket
# env.socket /home/user/torrent/.socket/rpc.socket,/home/user/torrent/.socket/rpc.socket
# env.category Category
# env.api pre09
#
# [rtom_allsessions_*]
# user username
@ -90,9 +92,16 @@ my $src = $ENV{"src"} || "";
my @sockets = split /,/, $ENV{"socket"} || "";
my $ip = $ENV{"ip"} || "127.0.0.1";
my @ports = split /,/, $ENV{"port"} || "";
my $api = $ENV{"api"} || "current";
my $pattern = qr/<value><(int|i4|i8|ex\.i8)>([-]{0,1}\d+)<\/(int|i4|i8|ex\.i8)><\/value>/;
my $line = "<?xml version=\"1.0\" encoding=\"utf-8\"?><methodCall><methodName>system.multicall</methodName><params><param><value><array><data><value><struct><member><name>methodName</name><value><string>get_up_total</string></value></member><member><name>params</name><value><array><data/></array></value></member></struct></value><value><struct><member><name>methodName</name><value><string>get_down_total</string></value></member><member><name>params</name><value><array><data/></array></value></member></struct></value><value><struct><member><name>methodName</name><value><string>get_upload_rate</string></value></member><member><name>params</name><value><array><data/></array></value></member></struct></value><value><struct><member><name>methodName</name><value><string>get_download_rate</string></value></member><member><name>params</name><value><array><data/></array></value></member></struct></value></data></array></value></param></params></methodCall>";
my $line = "";
if ($api =~ /pre09/) {
$line = "<?xml version=\"1.0\" encoding=\"utf-8\"?><methodCall><methodName>system.multicall</methodName><params><param><value><array><data><value><struct><member><name>methodName</name><value><string>get_up_total</string></value></member><member><name>params</name><value><array><data/></array></value></member></struct></value><value><struct><member><name>methodName</name><value><string>get_down_total</string></value></member><member><name>params</name><value><array><data/></array></value></member></struct></value><value><struct><member><name>methodName</name><value><string>get_upload_rate</string></value></member><member><name>params</name><value><array><data/></array></value></member></struct></value><value><struct><member><name>methodName</name><value><string>get_download_rate</string></value></member><member><name>params</name><value><array><data/></array></value></member></struct></value></data></array></value></param></params></methodCall>";
} else {
$line = "<?xml version=\"1.0\" encoding=\"utf-8\"?><methodCall><methodName>system.multicall</methodName><params><param><value><array><data><value><struct><member><name>methodName</name><value><string>throttle.global_up.total</string></value></member><member><name>params</name><value><array><data/></array></value></member></struct></value><value><struct><member><name>methodName</name><value><string>throttle.global_down.total</string></value></member><member><name>params</name><value><array><data/></array></value></member></struct></value><value><struct><member><name>methodName</name><value><string>throttle.global_up.max_rate</string></value></member><member><name>params</name><value><array><data/></array></value></member></struct></value><value><struct><member><name>methodName</name><value><string>throttle.global_down.max_rate</string></value></member><member><name>params</name><value><array><data/></array></value></member></struct></value></data></array></value></param></params></methodCall>";
}
my $llen = length $line;
my $header = "CONTENT_LENGTH\000${llen}\000SCGI\001\000";
my $hlen = length $header;

View file

@ -25,6 +25,7 @@
# src "socket" when using scgi_socket, or anything else when using scgi_port
# socket rTorrent's rpc socket (scgi_local) - using scgi_local - needed, when "src" is set to "socket"
# category Change graph category
# api use "pre09" (pre 0.9.0) or 'current' (0.9.0+) API calls
#
# Configuration example
#
@ -33,11 +34,13 @@
# env.src socket
# env.socket /home/user/torrent/.socket/rpc.socket,/home/user/torrent/.socket/rpc.socket
# env.category Category
# env.api current
#
# [rtom_allsessions_*]
# user username
# env.port 5000,5001,5002,5003
# env.category Category
# env.api pre09
#
#%# family=auto
@ -80,12 +83,18 @@ my $src = $ENV{"src"} || "";
my @sockets = split /,/, $ENV{"socket"} || "";
my $ip = $ENV{"ip"} || "127.0.0.1";
my @ports = split /,/, $ENV{"port"} || "";
my $api = $ENV{"api"} || "current";
my $pattern = qr/<value><string>([A-Z0-9]+)<\/string><\/value>/;
foreach ( @views ) {
my $num = 0;
my $line = "<?xml version=\"1.0\" encoding=\"utf-8\"?><methodCall><methodName>d.multicall</methodName><params><param><value><string>${_}</string></value></param><param><value><string>d.get_hash=</string></value></param></params></methodCall>";
my $line = "";
if ($api =~ /pre09/) {
$line = "<?xml version=\"1.0\" encoding=\"utf-8\"?><methodCall><methodName>d.multicall</methodName><params><param><value><string>${_}</string></value></param><param><value><string>d.get_hash=</string></value></param></params></methodCall>";
} else {
$line = "<?xml version=\"1.0\" encoding=\"utf-8\"?><methodCall><methodName>d.multicall2</methodName><params><param><value><string></string></value></param><param><value><string>${_}</string></value></param><param><value><string>d.hash=</string></value></param></params></methodCall>";
}
my $llen = length $line;
my $header = "CONTENT_LENGTH\000${llen}\000SCGI\001\000";
my $hlen = length $header;