Révision 17f78427
Whitespace cleanup
- remove trailing whitespace
- remove empty lines at the end of files
| plugins/voip/murmur_ice_users | ||
|---|---|---|
| 2 | 2 |
<?php |
| 3 | 3 |
/** |
| 4 | 4 |
** =head1 NAME |
| 5 |
**
|
|
| 5 |
** |
|
| 6 | 6 |
** murmur_ice_users |
| 7 |
**
|
|
| 7 |
** |
|
| 8 | 8 |
** =head1 DESCRIPTION |
| 9 |
**
|
|
| 9 |
** |
|
| 10 | 10 |
** This plugin monitors users on a Mumble server (a.k.a. murmur). |
| 11 | 11 |
** It uses PHP and ICE to to query murmur. On debian, you can install mumble-server-web |
| 12 | 12 |
** to get the dependencies installed and set up. |
| 13 |
**
|
|
| 14 |
**
|
|
| 13 |
** |
|
| 14 |
** |
|
| 15 | 15 |
** =head1 CONFIGURATION |
| 16 |
**
|
|
| 16 |
** |
|
| 17 | 17 |
** You can specify a different ip:port in the munin-node config file as follow: |
| 18 |
**
|
|
| 18 |
** |
|
| 19 | 19 |
** [murmur_ice_users] |
| 20 | 20 |
** env.host 127.0.0.1 |
| 21 | 21 |
** env.port 6502 |
| 22 | 22 |
** env.IceProfile xxxxx |
| 23 | 23 |
** env.IceSecret xxxxx |
| 24 |
**
|
|
| 24 |
** |
|
| 25 | 25 |
** =head1 AUTHOR |
| 26 |
**
|
|
| 26 |
** |
|
| 27 | 27 |
** Original Author Thomas L�veil |
| 28 | 28 |
** Modification by DisasteR - 2011/04/19 |
| 29 |
**
|
|
| 29 |
** |
|
| 30 | 30 |
** =head1 LICENSE |
| 31 |
**
|
|
| 31 |
** |
|
| 32 | 32 |
** Permission to use, copy, and modify this software with or without fee |
| 33 | 33 |
** is hereby granted, provided that this entire notice is included in |
| 34 | 34 |
** all source code copies of any software which is or includes a copy or |
| 35 | 35 |
** modification of this software. |
| 36 |
**
|
|
| 36 |
** |
|
| 37 | 37 |
** THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR |
| 38 | 38 |
** IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY |
| 39 | 39 |
** REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE |
| 40 | 40 |
** MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR |
| 41 | 41 |
** PURPOSE. |
| 42 |
**
|
|
| 42 |
** |
|
| 43 | 43 |
** |
| 44 | 44 |
** =head1 MAGIC MARKERS |
| 45 | 45 |
** |
| 46 |
** #%# family=contrib
|
|
| 46 |
** #%# family=contrib |
|
| 47 | 47 |
** #%# capabilities=autoconf |
| 48 | 48 |
** |
| 49 | 49 |
** |
| 50 | 50 |
** =head1 VERSION |
| 51 |
**
|
|
| 51 |
** |
|
| 52 | 52 |
** 1.2 |
| 53 |
**
|
|
| 53 |
** |
|
| 54 | 54 |
** =head1 CHANGELOG |
| 55 |
**
|
|
| 55 |
** |
|
| 56 | 56 |
** =head2 1.0 - 2009/05/04 |
| 57 |
**
|
|
| 57 |
** |
|
| 58 | 58 |
** initial release |
| 59 |
**
|
|
| 59 |
** |
|
| 60 | 60 |
** =head2 1.1 - 2011/01/13 |
| 61 |
**
|
|
| 61 |
** |
|
| 62 | 62 |
** fix to make it work with murmur v1.2.2 |
| 63 |
**
|
|
| 63 |
** |
|
| 64 | 64 |
** =head3 1.2 - 2011/04/19 |
| 65 | 65 |
** |
| 66 | 66 |
** Code cleaning and refactoring |
| 67 | 67 |
** Stats for root server and Virtual Servers |
| 68 |
**
|
|
| 68 |
** |
|
| 69 | 69 |
** =cut |
| 70 | 70 |
*/ |
| 71 |
|
|
| 72 |
|
|
| 71 |
|
|
| 72 |
|
|
| 73 | 73 |
$host = "127.0.0.1"; |
| 74 | 74 |
$port = "6502"; |
| 75 | 75 |
$IceProfile = 'Murmur123'; |
| ... | ... | |
| 82 | 82 |
|
| 83 | 83 |
if (count($argv)==1) {
|
| 84 | 84 |
do_count(); |
| 85 |
}
|
|
| 85 |
} |
|
| 86 | 86 |
|
| 87 |
switch ($argv[1])
|
|
| 87 |
switch ($argv[1]) |
|
| 88 | 88 |
{
|
| 89 | 89 |
case 'autoconf': |
| 90 | 90 |
do_autoconf(); |
| 91 | 91 |
break; |
| 92 |
|
|
| 92 |
|
|
| 93 | 93 |
case 'config': |
| 94 | 94 |
do_config(); |
| 95 | 95 |
break; |
| 96 |
|
|
| 96 |
|
|
| 97 | 97 |
default: |
| 98 | 98 |
do_count(); |
| 99 | 99 |
break; |
| ... | ... | |
| 103 | 103 |
function IceConnect() |
| 104 | 104 |
{
|
| 105 | 105 |
global $ICE, $host, $port, $IceProfile, $IceSecret; |
| 106 |
try
|
|
| 106 |
try |
|
| 107 | 107 |
{
|
| 108 | 108 |
Ice_loadProfile($IceProfile); |
| 109 | 109 |
$iceproxy = $ICE->stringToProxy("Meta:tcp -h $host -p $port");
|
| ... | ... | |
| 146 | 146 |
function do_config_data() |
| 147 | 147 |
{
|
| 148 | 148 |
global $ICE, $IceSecret; |
| 149 |
|
|
| 150 |
try
|
|
| 149 |
|
|
| 150 |
try |
|
| 151 | 151 |
{
|
| 152 | 152 |
$metaServer = IceConnect(); |
| 153 | 153 |
$AdefaultConf = $metaServer->getDefaultConf(); |
| 154 |
|
|
| 154 |
|
|
| 155 | 155 |
$AvirtualServer = $metaServer->getAllServers(); |
| 156 | 156 |
|
| 157 |
foreach ($AvirtualServer as $numserver=>$s)
|
|
| 157 |
foreach ($AvirtualServer as $numserver=>$s) |
|
| 158 | 158 |
{
|
| 159 | 159 |
$serverid = $s->ice_context($IceSecret)->id(); |
| 160 | 160 |
$servename = $s->ice_context($IceSecret)->getConf( 'registername'); |
| ... | ... | |
| 189 | 189 |
$totalMaxUsers="0"; |
| 190 | 190 |
$totalConnectedUsers="0"; |
| 191 | 191 |
|
| 192 |
try
|
|
| 192 |
try |
|
| 193 | 193 |
{
|
| 194 | 194 |
$metaServer = IceConnect(); |
| 195 | 195 |
$AdefaultConf = $metaServer->getDefaultConf(); |
| 196 |
|
|
| 196 |
|
|
| 197 | 197 |
$AvirtualServer = $metaServer->getAllServers(); |
| 198 | 198 |
|
| 199 |
foreach ($AvirtualServer as $numserver=>$s)
|
|
| 199 |
foreach ($AvirtualServer as $numserver=>$s) |
|
| 200 | 200 |
{
|
| 201 | 201 |
$maxusers = $s->ice_context($IceSecret)->getConf( 'users' ); |
| 202 | 202 |
if (!$maxusers) $maxusers = $AdefaultConf['users']; |
| ... | ... | |
| 215 | 215 |
fwrite(STDOUT, "vserver_".$serverid."_maxusers.value ".$maxusers."\n"); |
| 216 | 216 |
fwrite(STDOUT, "vserver_".$serverid."_online.value ".$connectedUsers."\n"); |
| 217 | 217 |
} |
| 218 |
|
|
| 218 |
|
|
| 219 | 219 |
fwrite(STDOUT, "total_maxusers.value ".$totalMaxUsers."\n"); |
| 220 | 220 |
fwrite(STDOUT, "total_online.value ".$totalConnectedUsers."\n"); |
| 221 | 221 |
exit(0); |
| ... | ... | |
| 227 | 227 |
} |
| 228 | 228 |
} |
| 229 | 229 |
|
| 230 |
?> |
|
| 230 |
?> |
|
Formats disponibles : Unified diff