From e62ea879a23d19347d6c3bab965f6a521a1200cc Mon Sep 17 00:00:00 2001 From: thiago Date: Sun, 28 Oct 2012 08:30:28 +1100 Subject: [PATCH] Add plugins for Sick-Beard * Number of shows (sample: http://imgur.com/5Uxih) * Number of Episodes (sample: http://imgur.com/3fG8M) --- plugins/sickbeard/sickbeard_episodes | 69 ++++++++++++++++++++++++++++ plugins/sickbeard/sickbeard_shows | 69 ++++++++++++++++++++++++++++ 2 files changed, 138 insertions(+) create mode 100755 plugins/sickbeard/sickbeard_episodes create mode 100755 plugins/sickbeard/sickbeard_shows diff --git a/plugins/sickbeard/sickbeard_episodes b/plugins/sickbeard/sickbeard_episodes new file mode 100755 index 00000000..2a6eb7d5 --- /dev/null +++ b/plugins/sickbeard/sickbeard_episodes @@ -0,0 +1,69 @@ +#!/usr/bin/perl +# +# Munin plugins for Sick-Beard +# +# Copyright (C) 2012 - Blauwbek +# Copyright (C) 2012 - Thiago +# +# Sick-Beard : http://sickbeard.com/ +# +# 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 . +# +# Requires: JSON::Any +# LWP::UserAgent +# +# Configuration example +# [sickbeard*] +# env.host http://host:port/ +# env.api apikey +# + +use strict; +use JSON::Any; +use LWP::UserAgent; + +#defines +my $HOST = exists $ENV{'host'} ? $ENV{'host'} : "http://localhost:8081/"; +my $API = exists $ENV{'api'} ? $ENV{'api'} : ""; +my $URL = $HOST."/api/".$API."/?cmd=shows.stats"; +my $sURL = sprintf $URL; + +#config output +if(defined $ARGV[0] && $ARGV[0] eq 'config') +{ + print <new; +my $req = $get->get($sURL); +my $json = JSON::Any->jsonToObj($req->content()); + +if ($json->{result} eq 'success') { + print "down.value $json->{data}->{ep_downloaded}\n"; + print "total.value $json->{data}->{ep_total}\n"; + exit 0; +} else { + print "$json->{message}\n"; + exit 1; +} + diff --git a/plugins/sickbeard/sickbeard_shows b/plugins/sickbeard/sickbeard_shows new file mode 100755 index 00000000..a81c6bd8 --- /dev/null +++ b/plugins/sickbeard/sickbeard_shows @@ -0,0 +1,69 @@ +#!/usr/bin/perl +# +# Munin plugins for Sick-Beard +# +# Copyright (C) 2012 - Blauwbek +# Copyright (C) 2012 - Thiago +# +# Sick-Beard : http://sickbeard.com/ +# +# 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 . +# +# Requires: JSON::Any +# LWP::UserAgent +# +# Configuration example +# [sickbeard*] +# env.host http://host:port/ +# env.api apikey +# + +use strict; +use JSON::Any; +use LWP::UserAgent; + +#defines +my $HOST = exists $ENV{'host'} ? $ENV{'host'} : "http://localhost:8081/"; +my $API = exists $ENV{'api'} ? $ENV{'api'} : ""; +my $URL = $HOST."/api/".$API."/?cmd=shows.stats"; +my $sURL = sprintf $URL; + +#config output +if(defined $ARGV[0] && $ARGV[0] eq 'config') +{ + print <new; +my $req = $get->get($sURL); +my $json = JSON::Any->jsonToObj($req->content()); + +if ($json->{result} eq 'success') { + print "active.value $json->{data}->{shows_active}\n"; + print "total.value $json->{data}->{shows_total}\n"; + exit 0; +} else { + print "$json->{message}\n"; + exit 1; +} +