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

remove shoutcast2 plugin, replaced by shoutcast2_multi

This commit is contained in:
Kenyon Ralph 2012-02-10 11:34:19 +08:00
parent 12d6e547c6
commit 3432f6c821

View File

@ -1,158 +0,0 @@
#!/usr/bin/php
<?php
// NAME
// shoutcast online - Munin plugin to show online for shoutcast v2.0
// CONFIGURATION
// none
// MAGIC MARKERS
#%# family=auto
#%# capabilities=autoconf
// VERSION
// 1.0 32bit
// there are differences in the XML tags used between 32 and 64
// AUTHOR
// Alejandro Olivan Alvarez
// Based on original 1.9.8 perl plugin by Stanislav Rudenko aka Sandel
// Uses PHP shoutcast code by MADxHAWK & m4xin30n
// LICENSE
// none at the plugin
/**
*
* @package: shoutcast
* @version: $Id: shoutcast.php 4 2011-12-02 17:27:36Z MADxHAWK $
* @copyright: (c) 2010 by Martin H. (madxhawk@radio-blackpearl.de)
* @licence:
[url]http://opensource.org/licenses/gpl-license.php[/url] GNU Public
License
*
*/
//
----------------------------------------------------------------------------
// You need to change data to your specific use
//
----------------------------------------------------------------------------
$useragent = "Mozilla (DNAS 2 Statuscheck)";
$sc_host = 'yourhost.example.com';
$sc_port = '8000';
$sc_user = 'your_admin_user';
$sc_pass = 'your_password';
$sc_sid = '1';
//
----------------------------------------------------------------------------
// DO NOT EDIT
//
----------------------------------------------------------------------------
//init curl connection
$ch = curl_init($sc_host . '/admin.cgi?sid=' . $sc_sid .
'&mode=viewxml');
// set curl connection parameter
curl_setopt($ch, CURLOPT_PORT, $sc_port);
curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, $sc_user . ':' . $sc_pass);
// connect to shoutcastserver
$curl = curl_exec($ch);
// now get the xml data
if ($curl)
{
$xml = @simplexml_load_string($curl);
$dnas_data = array (
'CURRENTLISTENERS' => (string)$xml->CURRENTLISTENERS,
'PEAKLISTENERS' => (string)$xml->PEAKLISTENERS,
'MAXLISTENERS' => (string)$xml->MAXLISTENERS,
'UNIQUELISTENERS' => (string)$xml->UNIQUELISTENERS,
);
// this is the usual case, generating a label and value
echo("max_connections.value {$dnas_data['MAXLISTENERS']}\n");
echo("ax_used_connections.value {$dnas_data['PEAKLISTENERS']}\n");
echo("all_connections.value {$dnas_data['CURRENTLISTENERS']}\n");
echo("unique_connections.value {$dnas_data['UNIQUELISTENERS']}\n");
}
else
{
$dnas_data = array('ERROR' => 'Could not connect to dnas-server!');
echo("\n");
}
// this is for munin's configuration tool
// could do something more complicated here
if(count($argv) == 2 && $argv[1] == 'autoconf') {
exit('yes');
}
// this is for rrdtool to know how to label the graph
// Default Settings
if(count($argv) == 2 && $argv[1] == 'config') {
echo("graph_title SHOUTcast Online on GlobalMobile port 8026\n");
echo("graph_args --base 1000\n");
echo("graph_category shoutcast\n");
echo("graph_vlabel Connections per \${graph_period}\n");
// Max Listeners Allowed to Connect to Server
echo("max_connections.draw AREA\n\n");
echo("max_connections.colour cdcfc4\n");
echo("max_connections.min 0\n");
echo("max_connections.label Max Slots\n");
echo("max_connections.type GAUGE\n");
// Peak Listeners
echo("ax_used_connections.draw AREA\n");
echo("ax_used_connections.colour ffd660\n");
echo("ax_used_connections.min 0\n");
echo("ax_used_connections.label Peak Listeners\n");
echo("ax_used_connections.type GAUGE\n");
// Max Listeners Connected to Server
echo("all_connections.draw LINE1\n");
echo("all_connections.colour a00e95\n");
echo("all_connections.min 0\n");
echo("all_connections.label Listeners\n");
echo("all_connections.type GAUGE\n");
// Max Unique Listeners Connected to Server
echo("unique_connections.draw LINE1\n");
echo("unique_connections.colour 330099\n");
echo("unique_connections.min 0\n");
echo("unique_connections.label Unique Listeners\n");
echo("unique_connections.type GAUGE\n");
exit();
}
//closing the connection
curl_close($ch);
?>