Munin (contrib)
Last change
Graph Categories


Sadly there is no documentation for this plugin.

error_reporting( E_ALL & ~E_NOTICE ); //to avoid of the crap generation

/* // do not remove this line


Murmur users online grapher PHP using ICE
ver 0.4 2011.06.10, 15:44
author _KaszpiR_ kaszpir at gmail dot com
code is under GPL

- PHP installed in CLI (so you can run it in command line)
  Make sure the first line of this file points to the pworking php cli inrepreter
- ICE framework on server
- Murmur server with ICE enabled


1. link creation
create a symlink to the file in the following format:
where ip/port correspond to the ip and port on which the mumble ice interface listens to
sid is the server id we want to query (mumble can run multiple servers )
description - any kind of short text where _ will be replaced with spaces

By default script tries to connect and query server id 1

2. ice profile configuration
 This is not needed with ice 3.4.1
 Scroll down in this file and change
 $ice_profile = 'Murmur';
 to the profile that is installed on the server, this is required if you have multiple Ice profiles for various applicaitions.


Script returns:
channels number = number of existing channels on server (with temoprary ones)
players number = number of all connected users on server
registered number = number of connected and registered users on server
unregistered number = number of connected and not registered users on server
chanlinks number = linked channels
error number = this is set to 1 when there is error with communicatind with server via ice

On any error script exits with status 1, otherwise it is 0.


- ver 0.4 2011.06.10, 15:44 stable
  fix for ICE 3.4.1 that does not use Ice_loadprofile() function
  extended description
  fixed typos
  fixed warning messages in logs

- ver 0.3 2011.04.2, 12:32 stable

- ver 0.2 2010.02.16 beta
  some minor fixes

- ver  0.1 2009.03.13 alpha
  first private release

- load iceprofile from env var


*/ //do not remove this line

$ice_profile = 'Murmur';

// Define STDIN in case if it is not already defined by PHP for some reason
    define("STDIN", fopen('php://stdin','r'));

    define("STDERR", fopen('php://stderr','w'));

list($dummy,$ip,$port,$serverid,$desc) = explode("_",$argv[0],5);

if(!$ip) $ip="";
if(!$port) $port=6502;
if(!$serverid) $serverid=1;

//autoconf test
if(isset($argv[1]) && $argv[1] == "autoconf")
		fwrite(STDOUT, "No\n");
		fwrite(STDERR, "symlink ".$argv[0]." to somethilg like ".$argv[0]."_127.0.0.1_6502_1_description_here \n");
	return 0;

//config, set rrd files
if(isset($argv[1]) && $argv[1] == "config")
	// yea dirty hack
		echo "graph_title Mumble Users".($desc?" on ".str_replace("_"," ",$desc):"")."\n";
		echo "graph_vlabel Connected Users\n";
		echo "graph_category VoIP\n";
		echo "graph_info This graph shows the number of connected users on a murmur server\n";
		echo "channels.label Chans\n";
		echo "players.label Total Users\n";
		echo "registered.label Registered\n";
		echo "unregistered.label Unregistered\n";
		echo "chanlinks.label Linked chans\n";
		echo "error.label Server status error\n";

		foreach($arr as $field){
		    echo "".$field.".draw LINE1\n";
		    echo "".$field.".type GAUGE\n";

		return 0;

	}else {
		echo "RTFM\n";
		return 1;
	return 0;

//echo "Serverid:".$serverid."\n";

if (Ice_intversion() >= 30400) {
    require 'Ice.php';
    require 'Murmur.php';
    } else {

try {
  if (Ice_intversion() >= 30400) {
    $initData = new Ice_InitializationData;
    $initData->properties = Ice_createProperties();
    $initData->properties->setProperty("Ice.MessageSizeMax", "65536");
    $ICE = Ice_initialize($initData);

  $base = $ICE->stringToProxy("Meta:tcp -h ".$ip." -p ".$port);
  $meta = $base->ice_checkedCast("::Murmur::Meta");

  $servers = $meta->getBootedServers();
  $default = $meta->getDefaultConf();
  foreach($servers as $s) {
    $name = $s->getConf("registername");
    if (! $name) {
      $name =  $default["registername"];

    if($s->id() !=$serverid) continue;

    $chanlist = $s->getChannels();
    $channels = count($chanlist);
    foreach($chanlist as $chan=>$c){
    $players = $s->getUsers();
    foreach($players as $id => $p) {
        if($p->userid ==-1)
} catch (Ice_LocalException $ex) {
    fwrite(STDERR,"ERROR: IP=".$ip.", Port=".$port.", Id=".$serverid."\n");
	echo "channels.value 0\n";
	echo "players.value 0\n";
	echo "registered.value 0\n";
	echo "unregistered.value 0\n";
	echo "chanlinks.value ".$links."\n";
	echo "error.value 1\n";

return 1;
echo "channels.value ".$channels."\n";
echo "players.value ".($online_noreg+$online_reg)."\n";
echo "registered.value ".$online_reg."\n";
echo "unregistered.value ".$online_noreg."\n";
echo "chanlinks.value ".$links."\n";
echo "error.value 0\n";
return 0;