[xiph-commits] r18641 - in branches/dir.xiph.org: . munin munin/plugins
dm8tbr at svn.xiph.org
dm8tbr at svn.xiph.org
Mon Oct 8 04:09:53 PDT 2012
Author: dm8tbr
Date: 2012-10-08 04:09:53 -0700 (Mon, 08 Oct 2012)
New Revision: 18641
Added:
branches/dir.xiph.org/munin/
branches/dir.xiph.org/munin/munin_listeners.php
branches/dir.xiph.org/munin/munin_streams.php
branches/dir.xiph.org/munin/plugins/
branches/dir.xiph.org/munin/plugins/icecast_yp_listeners
branches/dir.xiph.org/munin/plugins/icecast_yp_streams
Log:
Munin plugins for monitoring dir.xiph.org YP.
Added: branches/dir.xiph.org/munin/munin_listeners.php
===================================================================
--- branches/dir.xiph.org/munin/munin_listeners.php (rev 0)
+++ branches/dir.xiph.org/munin/munin_listeners.php 2012-10-08 11:09:53 UTC (rev 18641)
@@ -0,0 +1,82 @@
+<?php
+
+// Inclusions
+include_once(dirname(__FILE__).'/../inc/prepend.php');
+
+// Database connection
+$db = DirXiphOrgDBC::getInstance();
+
+// Memcache connection
+//$memcache = DirXiphOrgMCC::getInstance();
+
+
+// Base query
+$query_pattern = 'SELECT SUM(s.listeners) AS `count` FROM `server` AS s INNER JOIN `mountpoint` AS m ON m.`id` = s.`mountpoint_id` WHERE %s;';
+$where_pattern = 'm.`media_type_id` = "%s"';
+
+// Total
+$query = sprintf($query_pattern, '1');
+$total = $db->singleQuery($query)->current('count');
+printf("total.value %s\n", $total);
+
+// Vorbis
+$where = array();
+$where = sprintf($where_pattern, CONTENT_TYPE_OGG_VORBIS);
+$query = sprintf($query_pattern, $where);
+$vorbis = $db->singleQuery($query)->current('count');
+printf("vorbis.value %s\n", $vorbis);
+
+// Opus
+$where = array();
+$where = sprintf($where_pattern, CONTENT_TYPE_OPUS);
+$query = sprintf($query_pattern, $where);
+$opus = $db->singleQuery($query)->current('count');
+printf("opus.value %s\n", $opus);
+
+// Theora
+$where = array();
+$where = sprintf($where_pattern, CONTENT_TYPE_OGG_THEORA);
+$query = sprintf($query_pattern, $where);
+$theora = $db->singleQuery($query)->current('count');
+printf("theora.value %s\n", $theora);
+
+// WebM
+$where = array();
+$where = sprintf($where_pattern, CONTENT_TYPE_WEBM);
+$query = sprintf($query_pattern, $where);
+$vorbis = $db->singleQuery($query)->current('count');
+printf("webm.value %s\n", $vorbis);
+
+// MP3
+$where = sprintf($where_pattern, CONTENT_TYPE_MP3);
+$query = sprintf($query_pattern, $where);
+$mp3 = $db->singleQuery($query)->current('count');
+printf("mp3.value %s\n", $mp3);
+
+// AAC
+$where = sprintf($where_pattern, CONTENT_TYPE_AAC);
+$query = sprintf($query_pattern, $where);
+$aac = $db->singleQuery($query)->current('count');
+printf("aac.value %s\n", $aac);
+
+// AAC+
+$where = sprintf($where_pattern, CONTENT_TYPE_AACPLUS);
+$query = sprintf($query_pattern, $where);
+$aacp = $db->singleQuery($query)->current('count');
+printf("aacp.value %s\n", $aacp);
+
+// NSV
+$where = sprintf($where_pattern, CONTENT_TYPE_NSV);
+$query = sprintf($query_pattern, $where);
+$nsv = $db->singleQuery($query)->current('count');
+printf("nsv.value %s\n", $nsv);
+
+// OTHER
+$where = sprintf($where_pattern, CONTENT_TYPE_OTHER);
+$query = sprintf($query_pattern, $where);
+$other = $db->singleQuery($query)->current('count');
+printf("other.value %s\n", $other);
+
+//echo("OK.\n");
+
+?>
Added: branches/dir.xiph.org/munin/munin_streams.php
===================================================================
--- branches/dir.xiph.org/munin/munin_streams.php (rev 0)
+++ branches/dir.xiph.org/munin/munin_streams.php 2012-10-08 11:09:53 UTC (rev 18641)
@@ -0,0 +1,87 @@
+<?php
+
+// Inclusions
+include_once(dirname(__FILE__).'/../inc/prepend.php');
+
+// Database connection
+$db = DirXiphOrgDBC::getInstance();
+
+// Memcache connection
+//$memcache = DirXiphOrgMCC::getInstance();
+
+
+// Base query
+$query_pattern = 'SELECT COUNT(*) AS `count` FROM `server` AS s INNER JOIN `mountpoint` AS m ON m.`id` = s.`mountpoint_id` WHERE %s;';
+$where_pattern = 'm.`media_type_id` = "%s"';
+
+// Total
+$query = sprintf($query_pattern, '1');
+$total = $db->singleQuery($query)->current('count');
+printf("total.value %s\n", $total);
+
+// Vorbis
+$where = array();
+$where = sprintf($where_pattern, CONTENT_TYPE_OGG_VORBIS);
+$query = sprintf($query_pattern, $where);
+$vorbis = $db->singleQuery($query)->current('count');
+printf("vorbis.value %s\n", $vorbis);
+
+// Opus
+$where = array();
+$where = sprintf($where_pattern, CONTENT_TYPE_OPUS);
+$query = sprintf($query_pattern, $where);
+$opus = $db->singleQuery($query)->current('count');
+printf("opus.value %s\n", $opus);
+
+// Theora
+$where = array();
+$where = sprintf($where_pattern, CONTENT_TYPE_OGG_THEORA);
+$query = sprintf($query_pattern, $where);
+$theora = $db->singleQuery($query)->current('count');
+printf("theora.value %s\n", $theora);
+
+// WebM
+$where = array();
+$where = sprintf($where_pattern, CONTENT_TYPE_WEBM);
+$query = sprintf($query_pattern, $where);
+$vorbis = $db->singleQuery($query)->current('count');
+printf("webm.value %s\n", $vorbis);
+
+// MP3
+$where = sprintf($where_pattern, CONTENT_TYPE_MP3);
+$query = sprintf($query_pattern, $where);
+$mp3 = $db->singleQuery($query)->current('count');
+printf("mp3.value %s\n", $mp3);
+
+// AAC
+$where = sprintf($where_pattern, CONTENT_TYPE_AAC);
+$query = sprintf($query_pattern, $where);
+$aac = $db->singleQuery($query)->current('count');
+printf("aac.value %s\n", $aac);
+
+// AAC+
+$where = sprintf($where_pattern, CONTENT_TYPE_AACPLUS);
+$query = sprintf($query_pattern, $where);
+$aacp = $db->singleQuery($query)->current('count');
+printf("aacp.value %s\n", $aacp);
+
+// NSV
+$where = sprintf($where_pattern, CONTENT_TYPE_NSV);
+$query = sprintf($query_pattern, $where);
+$nsv = $db->singleQuery($query)->current('count');
+printf("nsv.value %s\n", $nsv);
+
+// OTHER
+$where = sprintf($where_pattern, CONTENT_TYPE_OTHER);
+$query = sprintf($query_pattern, $where);
+$other = $db->singleQuery($query)->current('count');
+printf("other.value %s\n", $other);
+
+// radionomy
+$query = "SELECT COUNT(*) AS count FROM `server` WHERE `last_touched_from` LIKE '52089%'";
+$radionomy = $db->singleQuery($query)->current('count');
+printf("radionomy.value %s\n", $radionomy);
+
+//echo("OK.\n");
+
+?>
Added: branches/dir.xiph.org/munin/plugins/icecast_yp_listeners
===================================================================
--- branches/dir.xiph.org/munin/plugins/icecast_yp_listeners (rev 0)
+++ branches/dir.xiph.org/munin/plugins/icecast_yp_listeners 2012-10-08 11:09:53 UTC (rev 18641)
@@ -0,0 +1,115 @@
+#!/bin/sh
+# -*- sh -*-
+
+: << =cut
+
+=head1 NAME
+
+icecast yp stats - Plugin to monitor Icecast YP stats
+
+=head1 CONFIGURATION
+
+No configuration
+
+=head1 AUTHOR
+
+Unknown author
+
+=head1 LICENSE
+
+Unknown license
+
+=head1 BUGS
+
+=over 4
+
+=item SuSE: passive connections rejected
+
+At least one SuSE netstat appears to report "passive connections
+rejected because of time stamp"
+
+We have never seen that, patch requested.
+
+=back
+
+=head1 MAGIC MARKERS
+
+ #%# family=auto
+ #%# capabilities=autoconf
+
+=cut
+
+. $MUNIN_LIBDIR/plugins/plugin.sh
+
+if [ "$1" = "autoconf" ]; then
+# if ( netstat -s 2>/dev/null >/dev/null ); then
+# echo yes
+# exit 0
+# else
+# if [ $? -eq 127 ]
+# then
+# echo "no (netstat program not found)"
+# exit 0
+# else
+# echo no
+# exit 0
+# fi
+# fi
+
+ echo yes
+ exit 0
+fi
+
+if [ "$1" = "config" ]; then
+
+ echo 'graph_title Icecast YP listener stats'
+ echo 'graph_args --base 1000 -l 0'
+ echo 'graph_vlabel active listeners'
+ echo 'graph_category yp'
+# echo 'graph_period second'
+ echo 'graph_info This graph shows the activity of listeners for all stations in YP.'
+ echo 'total.label total'
+ echo 'total.type GAUGE'
+ echo 'total.min 0'
+ echo 'total.info The total number of listeners on all listed streams.'
+ echo 'vorbis.label vorbis'
+ echo 'vorbis.type GAUGE'
+ echo 'vorbis.min 0'
+ echo 'vorbis.info The number of vorbis stream listeners.'
+ echo 'opus.label opus'
+ echo 'opus.type GAUGE'
+ echo 'opus.min 0'
+ echo 'opus.info The number of opus stream listeners.'
+ echo 'theora.label theora'
+ echo 'theora.type GAUGE'
+ echo 'theora.min 0'
+ echo 'theora.info The number of theora stream listeners.'
+ echo 'webm.label WebM'
+ echo 'webm.type GAUGE'
+ echo 'webm.min 0'
+ echo 'webm.info The number of WebM stream listeners.'
+ echo 'mp3.label mp3'
+ echo 'mp3.type GAUGE'
+ echo 'mp3.min 0'
+ echo 'mp3.info The number of MP3 stream listeners.'
+ echo 'aac.label AAC'
+ echo 'aac.type GAUGE'
+ echo 'aac.min 0'
+ echo 'aac.info The number of AAC stream listeners.'
+ echo 'aacp.label AAC+'
+ echo 'aacp.type GAUGE'
+ echo 'aacp.min 0'
+ echo 'aacp.info The number of AAC+ stream listeners.'
+ echo 'nsv.label NSV'
+ echo 'nsv.type GAUGE'
+ echo 'nsv.min 0'
+ echo 'nsv.info The number of NSV stream listeners.'
+ echo 'other.label other'
+ echo 'other.type GAUGE'
+ echo 'other.min 0'
+ echo 'other.info The number of other stream listeners.'
+ exit 0
+fi
+
+ENVIRONMENT=prod php5 /var/www/dir.xiph.org/cronjobs/munin_listeners.php
+
Property changes on: branches/dir.xiph.org/munin/plugins/icecast_yp_listeners
___________________________________________________________________
Added: svn:executable
+ *
Added: branches/dir.xiph.org/munin/plugins/icecast_yp_streams
===================================================================
--- branches/dir.xiph.org/munin/plugins/icecast_yp_streams (rev 0)
+++ branches/dir.xiph.org/munin/plugins/icecast_yp_streams 2012-10-08 11:09:53 UTC (rev 18641)
@@ -0,0 +1,126 @@
+#!/bin/sh
+# -*- sh -*-
+
+: << =cut
+
+=head1 NAME
+
+icecast yp stats - Plugin to monitor Icecast YP stats
+
+=head1 CONFIGURATION
+
+No configuration
+
+=head1 AUTHOR
+
+Unknown author
+
+=head1 LICENSE
+
+Unknown license
+
+=head1 BUGS
+
+=over 4
+
+=item SuSE: passive connections rejected
+
+At least one SuSE netstat appears to report "passive connections
+rejected because of time stamp"
+
+We have never seen that, patch requested.
+
+=back
+
+=head1 MAGIC MARKERS
+
+ #%# family=auto
+ #%# capabilities=autoconf
+
+=cut
+
+. $MUNIN_LIBDIR/plugins/plugin.sh
+
+if [ "$1" = "autoconf" ]; then
+# if ( netstat -s 2>/dev/null >/dev/null ); then
+# echo yes
+# exit 0
+# else
+# if [ $? -eq 127 ]
+# then
+# echo "no (netstat program not found)"
+# exit 0
+# else
+# echo no
+# exit 0
+# fi
+# fi
+
+ echo yes
+ exit 0
+fi
+
+if [ "$1" = "config" ]; then
+
+ echo 'graph_title Icecast YP stream stats'
+ echo 'graph_args --base 1000 -l 0'
+ echo 'graph_vlabel active stations'
+ echo 'graph_category yp'
+# echo 'graph_period second'
+ echo 'graph_info This graph shows the activity of stations in YP.'
+ echo 'total.label total'
+ echo 'total.type GAUGE'
+ echo 'total.min 0'
+ echo 'total.info The total number of streams listed.'
+ echo 'vorbis.label vorbis'
+ echo 'vorbis.type GAUGE'
+ echo 'vorbis.min 0'
+ echo 'vorbis.info The number of vorbis streams listed.'
+ echo 'opus.label opus'
+ echo 'opus.type GAUGE'
+ echo 'opus.min 0'
+ echo 'opus.info The number of opus streams listed.'
+ echo 'theora.label theora'
+ echo 'theora.type GAUGE'
+ echo 'theora.min 0'
+ echo 'theora.info The number of theora streams listed.'
+ echo 'webm.label WebM'
+ echo 'webm.type GAUGE'
+ echo 'webm.min 0'
+ echo 'webm.info The number of WebM streams listed.'
+ echo 'mp3.label mp3'
+ echo 'mp3.type GAUGE'
+ echo 'mp3.min 0'
+ echo 'mp3.info The number of MP3 streams listed.'
+ echo 'aac.label AAC'
+ echo 'aac.type GAUGE'
+ echo 'aac.min 0'
+ echo 'aac.info The number of AAC streams listed.'
+ echo 'aacp.label AAC+'
+ echo 'aacp.type GAUGE'
+ echo 'aacp.min 0'
+ echo 'aacp.info The number of AAC+ streams listed.'
+ echo 'nsv.label NSV'
+ echo 'nsv.type GAUGE'
+ echo 'nsv.min 0'
+ echo 'nsv.info The number of NSV streams listed.'
+ echo 'other.label other'
+ echo 'other.type GAUGE'
+ echo 'other.min 0'
+ echo 'other.info The number of other streams listed.'
+ echo 'radionomy.label radionomy'
+ echo 'radionomy.type GAUGE'
+ echo 'radionomy.min 0'
+ echo 'radionomy.info The number of Radionomy streams listed.'
+ exit 0
+fi
+
+ENVIRONMENT=prod php5 /var/www/dir.xiph.org/cronjobs/munin_streams.php
+
+#netstat -s | awk '
+#/active connections ope/ { print "active.value " $1 }
+#/passive connection ope/ { print "passive.value " $1 }
+#/failed connection/ { print "failed.value " $1 }
+#/connection resets/ { print "resets.value " $1 }
+#/connections established/ { print "established.value " $1 }'
+
Property changes on: branches/dir.xiph.org/munin/plugins/icecast_yp_streams
___________________________________________________________________
Added: svn:executable
+ *
More information about the commits
mailing list