mirror of
https://github.com/munin-monitoring/contrib.git
synced 2018-11-08 00:59:34 +01:00
Merge pull request #91 from Blauwbek/master
Created graph plugins for SABNZBd Speed and Data left.
This commit is contained in:
commit
c23e2a4831
68
plugins/sabnzbd/sabnzbd_dataleft
Normal file
68
plugins/sabnzbd/sabnzbd_dataleft
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
#!/usr/bin/perl
|
||||||
|
#
|
||||||
|
# Munin plugins for sabnzbd
|
||||||
|
#
|
||||||
|
# Copyright (C) 2012 - Blauwbek
|
||||||
|
#
|
||||||
|
# SABnzbd : http://sabnzbd.org/
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
# Requires: XML::Simple
|
||||||
|
# LWP::UserAgent
|
||||||
|
#
|
||||||
|
# Configuration example
|
||||||
|
# [sabnzbd*]
|
||||||
|
# env.host http://host:port/
|
||||||
|
# env.api apikey
|
||||||
|
#
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use XML::Simple;
|
||||||
|
use LWP::UserAgent;
|
||||||
|
|
||||||
|
#defines
|
||||||
|
my $HOST = exists $ENV{'host'} ? $ENV{'host'} : "http://localhost:8080/";
|
||||||
|
my $API = exists $ENV{'api'} ? $ENV{'api'} : "";
|
||||||
|
my $URL = $HOST."/sabnzbd/api?mode=qstatus&output=xml&apikey=".$API;
|
||||||
|
my $sURL = sprintf $URL;
|
||||||
|
|
||||||
|
#config output
|
||||||
|
if(defined $ARGV[0] && $ARGV[0] eq 'config')
|
||||||
|
{
|
||||||
|
print <<EOC
|
||||||
|
graph_title Data Remaining
|
||||||
|
graph_vlabel Data Remaining (MB)
|
||||||
|
graph_category sabnzbd
|
||||||
|
rem.label Remaining
|
||||||
|
EOC
|
||||||
|
;
|
||||||
|
|
||||||
|
exit 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#data handlers
|
||||||
|
my $xml = new XML::Simple;
|
||||||
|
my $get = LWP::UserAgent->new;
|
||||||
|
$get->agent('Munin_GetXML_sabnzbd_left ');
|
||||||
|
|
||||||
|
#get xml and xml->perl
|
||||||
|
my $req = $get->get($sURL);
|
||||||
|
my $vals = $req->content();
|
||||||
|
my $xmlvals = $xml->XMLin($vals);
|
||||||
|
|
||||||
|
#get/output vals
|
||||||
|
my $left = $xmlvals->{mbleft};
|
||||||
|
$left =~ /(\d+)\./;
|
||||||
|
print "rem.value ".$1."\n";
|
68
plugins/sabnzbd/sabnzbd_speed
Normal file
68
plugins/sabnzbd/sabnzbd_speed
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
#!/usr/bin/perl
|
||||||
|
#
|
||||||
|
# Munin plugins for sabnzbd
|
||||||
|
#
|
||||||
|
# Copyright (C) 2012 - Blauwbek
|
||||||
|
#
|
||||||
|
# SABnzbd : http://sabnzbd.org/
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
# Requires: XML::Simple
|
||||||
|
# LWP::UserAgent
|
||||||
|
#
|
||||||
|
# Configuration example
|
||||||
|
# [sabnzbd*]
|
||||||
|
# env.host http://host:port/
|
||||||
|
# env.api apikey
|
||||||
|
#
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use XML::Simple;
|
||||||
|
use LWP::UserAgent;
|
||||||
|
|
||||||
|
#defines
|
||||||
|
my $HOST = exists $ENV{'host'} ? $ENV{'host'} : "http://localhost:8080/";
|
||||||
|
my $API = exists $ENV{'api'} ? $ENV{'api'} : "";
|
||||||
|
my $URL = $HOST."/sabnzbd/api?mode=qstatus&output=xml&apikey=".$API;
|
||||||
|
my $sURL = sprintf $URL;
|
||||||
|
|
||||||
|
#config output
|
||||||
|
if(defined $ARGV[0] && $ARGV[0] eq 'config')
|
||||||
|
{
|
||||||
|
print <<EOC
|
||||||
|
graph_title SABnzbd Speed
|
||||||
|
graph_vlabel Download Speed (KB/s)
|
||||||
|
graph_category sabnzbd
|
||||||
|
speed.label Download Speed
|
||||||
|
EOC
|
||||||
|
;
|
||||||
|
|
||||||
|
exit 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#data handlers
|
||||||
|
my $xml = new XML::Simple;
|
||||||
|
my $get = LWP::UserAgent->new;
|
||||||
|
$get->agent('Munin_GetXML_sabnzbd_speed ');
|
||||||
|
|
||||||
|
#get xml and xml->perl
|
||||||
|
my $req = $get->get($sURL);
|
||||||
|
my $vals = $req->content();
|
||||||
|
my $xmlvals = $xml->XMLin($vals);
|
||||||
|
|
||||||
|
#get/output vals
|
||||||
|
my $speed = $xmlvals->{kbpersec};
|
||||||
|
$speed =~ /(\d+)\./;
|
||||||
|
print "speed.value ".$1."\n";
|
Loading…
Reference in New Issue
Block a user