From b58e31e8799f3a503030aae4c8b9220225802678 Mon Sep 17 00:00:00 2001 From: _KaszpiR_ Date: Fri, 10 Jun 2011 17:10:20 +0200 Subject: [PATCH] Initial version --- .../other/murmurice_host_port_id_description | 225 ++++++++++++++++++ 1 file changed, 225 insertions(+) create mode 100755 plugins/other/murmurice_host_port_id_description diff --git a/plugins/other/murmurice_host_port_id_description b/plugins/other/murmurice_host_port_id_description new file mode 100755 index 00000000..2deeb8f1 --- /dev/null +++ b/plugins/other/murmurice_host_port_id_description @@ -0,0 +1,225 @@ +#!/usr/bin/php += 30400) { + require 'Ice.php'; + require 'Murmur.php'; + } else { + Ice_loadProfile($ice_profile); + } + +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){ + $links+=count($c->links); + } + $players = $s->getUsers(); + foreach($players as $id => $p) { + if($p->userid ==-1) + $online_noreg++; + else + $online_reg++; + } + } +} catch (Ice_LocalException $ex) { + fwrite(STDERR,"ERROR: IP=".$ip.", Port=".$port.", Id=".$serverid."\n"); + fwrite(STDERR,$ex); + 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; +?> \ No newline at end of file