mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-21 18:41:03 +00:00
Whitespace cleanup
* remove trailing whitespace * remove empty lines at the end of files
This commit is contained in:
parent
ef851f0c34
commit
17f784270a
604 changed files with 2927 additions and 2945 deletions
|
@ -2,74 +2,74 @@
|
|||
<?php
|
||||
/**
|
||||
** =head1 NAME
|
||||
**
|
||||
**
|
||||
** murmur_ice_users
|
||||
**
|
||||
**
|
||||
** =head1 DESCRIPTION
|
||||
**
|
||||
**
|
||||
** This plugin monitors users on a Mumble server (a.k.a. murmur).
|
||||
** It uses PHP and ICE to to query murmur. On debian, you can install mumble-server-web
|
||||
** to get the dependencies installed and set up.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** =head1 CONFIGURATION
|
||||
**
|
||||
**
|
||||
** You can specify a different ip:port in the munin-node config file as follow:
|
||||
**
|
||||
**
|
||||
** [murmur_ice_users]
|
||||
** env.host 127.0.0.1
|
||||
** env.port 6502
|
||||
** env.IceProfile xxxxx
|
||||
** env.IceSecret xxxxx
|
||||
**
|
||||
**
|
||||
** =head1 AUTHOR
|
||||
**
|
||||
**
|
||||
** Original Author Thomas L<>veil
|
||||
** Modification by DisasteR - 2011/04/19
|
||||
**
|
||||
**
|
||||
** =head1 LICENSE
|
||||
**
|
||||
**
|
||||
** Permission to use, copy, and modify this software with or without fee
|
||||
** is hereby granted, provided that this entire notice is included in
|
||||
** all source code copies of any software which is or includes a copy or
|
||||
** modification of this software.
|
||||
**
|
||||
**
|
||||
** THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR
|
||||
** IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY
|
||||
** REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE
|
||||
** MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR
|
||||
** PURPOSE.
|
||||
**
|
||||
**
|
||||
**
|
||||
** =head1 MAGIC MARKERS
|
||||
**
|
||||
** #%# family=contrib
|
||||
** #%# family=contrib
|
||||
** #%# capabilities=autoconf
|
||||
**
|
||||
**
|
||||
** =head1 VERSION
|
||||
**
|
||||
**
|
||||
** 1.2
|
||||
**
|
||||
**
|
||||
** =head1 CHANGELOG
|
||||
**
|
||||
**
|
||||
** =head2 1.0 - 2009/05/04
|
||||
**
|
||||
**
|
||||
** initial release
|
||||
**
|
||||
**
|
||||
** =head2 1.1 - 2011/01/13
|
||||
**
|
||||
**
|
||||
** fix to make it work with murmur v1.2.2
|
||||
**
|
||||
**
|
||||
** =head3 1.2 - 2011/04/19
|
||||
**
|
||||
** Code cleaning and refactoring
|
||||
** Stats for root server and Virtual Servers
|
||||
**
|
||||
**
|
||||
** =cut
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
$host = "127.0.0.1";
|
||||
$port = "6502";
|
||||
$IceProfile = 'Murmur123';
|
||||
|
@ -82,18 +82,18 @@ if (isset($_ENV['IceScret'])) $IceSecret = array( 'secret' => $_ENV['IceScret']
|
|||
|
||||
if (count($argv)==1) {
|
||||
do_count();
|
||||
}
|
||||
}
|
||||
|
||||
switch ($argv[1])
|
||||
switch ($argv[1])
|
||||
{
|
||||
case 'autoconf':
|
||||
do_autoconf();
|
||||
break;
|
||||
|
||||
|
||||
case 'config':
|
||||
do_config();
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
do_count();
|
||||
break;
|
||||
|
@ -103,7 +103,7 @@ exit(1);
|
|||
function IceConnect()
|
||||
{
|
||||
global $ICE, $host, $port, $IceProfile, $IceSecret;
|
||||
try
|
||||
try
|
||||
{
|
||||
Ice_loadProfile($IceProfile);
|
||||
$iceproxy = $ICE->stringToProxy("Meta:tcp -h $host -p $port");
|
||||
|
@ -146,15 +146,15 @@ function do_config_header()
|
|||
function do_config_data()
|
||||
{
|
||||
global $ICE, $IceSecret;
|
||||
|
||||
try
|
||||
|
||||
try
|
||||
{
|
||||
$metaServer = IceConnect();
|
||||
$AdefaultConf = $metaServer->getDefaultConf();
|
||||
|
||||
|
||||
$AvirtualServer = $metaServer->getAllServers();
|
||||
|
||||
foreach ($AvirtualServer as $numserver=>$s)
|
||||
foreach ($AvirtualServer as $numserver=>$s)
|
||||
{
|
||||
$serverid = $s->ice_context($IceSecret)->id();
|
||||
$servename = $s->ice_context($IceSecret)->getConf( 'registername');
|
||||
|
@ -189,14 +189,14 @@ function do_count()
|
|||
$totalMaxUsers="0";
|
||||
$totalConnectedUsers="0";
|
||||
|
||||
try
|
||||
try
|
||||
{
|
||||
$metaServer = IceConnect();
|
||||
$AdefaultConf = $metaServer->getDefaultConf();
|
||||
|
||||
|
||||
$AvirtualServer = $metaServer->getAllServers();
|
||||
|
||||
foreach ($AvirtualServer as $numserver=>$s)
|
||||
foreach ($AvirtualServer as $numserver=>$s)
|
||||
{
|
||||
$maxusers = $s->ice_context($IceSecret)->getConf( 'users' );
|
||||
if (!$maxusers) $maxusers = $AdefaultConf['users'];
|
||||
|
@ -215,7 +215,7 @@ function do_count()
|
|||
fwrite(STDOUT, "vserver_".$serverid."_maxusers.value ".$maxusers."\n");
|
||||
fwrite(STDOUT, "vserver_".$serverid."_online.value ".$connectedUsers."\n");
|
||||
}
|
||||
|
||||
|
||||
fwrite(STDOUT, "total_maxusers.value ".$totalMaxUsers."\n");
|
||||
fwrite(STDOUT, "total_online.value ".$totalConnectedUsers."\n");
|
||||
exit(0);
|
||||
|
@ -227,4 +227,4 @@ function do_count()
|
|||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -7,7 +7,7 @@ error_reporting( E_ALL &!E_NOTICE); //to avoid of the crap generation
|
|||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Murmur users online grahpher
|
||||
ver 0.2alpha 2008.12.02, 20:32
|
||||
ver 0.2alpha 2008.12.02, 20:32
|
||||
author _KaszpiR_ kaszpir at gmail dot com
|
||||
code is under GPL
|
||||
|
||||
|
@ -18,9 +18,9 @@ Requirements:
|
|||
|
||||
Notice:
|
||||
- script allows the usage of the 'config' and 'autoconf' parameters during startup, make fure you edt config section before running it
|
||||
- $limit - number of lines to tail from the lgo file, better keep it below 5000 for lower cpu load,
|
||||
- $limit - number of lines to tail from the lgo file, better keep it below 5000 for lower cpu load,
|
||||
additionally on busy servers you can keep it really low, suggested 3x maximum number of users online
|
||||
- tested on
|
||||
- tested on
|
||||
PHP 5.2.6-3 with Suhosin-Patch 0.9.6.2 (cli) (built: Aug 21 2008 17:02:32)
|
||||
murmur 1.1.4 precompiled binaries from sourceforge net, all running under debian etch
|
||||
- this is not the best way to get users connected to the murmur server, maybe in the beginningn of the 2009 gonna make another script
|
||||
|
@ -60,7 +60,7 @@ if(isset($argv[1]) && $argv[1] == "autoconf")
|
|||
{
|
||||
fwrite(STDOUT, "Yes\n");
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
fwrite(STDOUT, "No\n");
|
||||
fwrite(STDERR, "check if '$logfile' exists and it is allowed to be read by munin user group\n");
|
||||
|
@ -82,7 +82,7 @@ if(isset($argv[1]) && $argv[1] == "config")
|
|||
fwrite(STDOUT, "murmur.label Users on server\n");
|
||||
fwrite(STDOUT, "murmur.type GAUGE\n");
|
||||
return 0;
|
||||
|
||||
|
||||
}else {
|
||||
echo "check if '$logfile' exists and it is allowed to be read by munin user group\n";
|
||||
return 1;
|
||||
|
@ -125,15 +125,15 @@ for($i=count($fp);$i>(count($fp)-$limit);--$i)
|
|||
strpos($msg," Connection closed")!==FALSE
|
||||
|| strpos($msg," Tiemout")!==FALSE
|
||||
){
|
||||
$seen[$nick]['online'] = 0;
|
||||
$seen[$nick]['online'] = 0;
|
||||
$offline+=1;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$seen[$nick]['online'] = 1;
|
||||
$seen[$nick]['online'] = 1;
|
||||
$online+=1;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -147,4 +147,4 @@ return 0;
|
|||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//end of file
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -7,7 +7,7 @@ error_reporting( E_ALL & ~E_NOTICE ); //to avoid of the crap generation
|
|||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Murmur users online grapher PHP using ICE
|
||||
ver 0.4 2011.06.10, 15:44
|
||||
ver 0.4 2011.06.10, 15:44
|
||||
author _KaszpiR_ kaszpir at gmail dot com
|
||||
code is under GPL
|
||||
|
||||
|
@ -31,8 +31,8 @@ By default script tries to connect 127.0.0.1:6502 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';
|
||||
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.
|
||||
|
||||
|
||||
|
@ -82,7 +82,7 @@ $ice_profile = 'Murmur';
|
|||
|
||||
|
||||
|
||||
// Define STDIN in case if it is not already defined by PHP for some reason
|
||||
// Define STDIN in case if it is not already defined by PHP for some reason
|
||||
if(!defined("STDIN"))
|
||||
{
|
||||
define("STDIN", fopen('php://stdin','r'));
|
||||
|
@ -108,7 +108,7 @@ if(isset($argv[1]) && $argv[1] == "autoconf")
|
|||
if(FALSE)
|
||||
{
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
fwrite(STDOUT, "No\n");
|
||||
fwrite(STDERR, "symlink ".$argv[0]." to somethilg like ".$argv[0]."_127.0.0.1_6502_1_description_here \n");
|
||||
|
@ -123,7 +123,7 @@ if(isset($argv[1]) && $argv[1] == "config")
|
|||
{
|
||||
if(TRUE)
|
||||
{
|
||||
// yea dirty hack
|
||||
// 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";
|
||||
|
@ -134,7 +134,7 @@ if(isset($argv[1]) && $argv[1] == "config")
|
|||
echo "unregistered.label Unregistered\n";
|
||||
echo "chanlinks.label Linked chans\n";
|
||||
echo "error.label Server status error\n";
|
||||
|
||||
|
||||
$arr=array("channels","players","registered","unregistered","chanlinks","error");
|
||||
foreach($arr as $field){
|
||||
echo "".$field.".draw LINE1\n";
|
||||
|
@ -143,7 +143,7 @@ if(isset($argv[1]) && $argv[1] == "config")
|
|||
|
||||
|
||||
return 0;
|
||||
|
||||
|
||||
}else {
|
||||
echo "RTFM\n";
|
||||
return 1;
|
||||
|
@ -174,7 +174,7 @@ try {
|
|||
$initData->properties = Ice_createProperties();
|
||||
$initData->properties->setProperty("Ice.MessageSizeMax", "65536");
|
||||
$ICE = Ice_initialize($initData);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$base = $ICE->stringToProxy("Meta:tcp -h ".$ip." -p ".$port);
|
||||
|
@ -222,4 +222,4 @@ echo "unregistered.value ".$online_noreg."\n";
|
|||
echo "chanlinks.value ".$links."\n";
|
||||
echo "error.value 0\n";
|
||||
return 0;
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -7,7 +7,7 @@ error_reporting( E_ALL & ~E_NOTICE ); //to avoid of the crap generation
|
|||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Murmur users online grapher PHP using ICE, shows averages
|
||||
ver 0.2 2011.06.10, 15:44
|
||||
ver 0.2 2011.06.10, 15:44
|
||||
author _KaszpiR_ kaszpir at gmail dot com
|
||||
code is under GPL
|
||||
|
||||
|
@ -31,8 +31,8 @@ By default script tries to connect 127.0.0.1:6502 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';
|
||||
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.
|
||||
|
||||
|
||||
|
@ -80,7 +80,7 @@ Todo:
|
|||
$ice_profile = 'Murmur';
|
||||
|
||||
|
||||
// Define STDIN in case if it is not already defined by PHP for some reason
|
||||
// Define STDIN in case if it is not already defined by PHP for some reason
|
||||
if(!defined("STDIN"))
|
||||
{
|
||||
define("STDIN", fopen('php://stdin','r'));
|
||||
|
@ -106,7 +106,7 @@ if(isset($argv[1]) && $argv[1] == "autoconf")
|
|||
if(FALSE)
|
||||
{
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
fwrite(STDOUT, "No\n");
|
||||
fwrite(STDERR, "symlink ".$argv[0]." to somethilg like ".$argv[0]."_127.0.0.1_6502_1_description_here \n");
|
||||
|
@ -121,7 +121,7 @@ if(isset($argv[1]) && $argv[1] == "config")
|
|||
{
|
||||
if(TRUE)
|
||||
{
|
||||
// yea dirty hack
|
||||
// yea dirty hack
|
||||
echo "graph_title Mumble Average Users per chan ".($desc?" on ".str_replace("_"," ",$desc):"")."\n";
|
||||
echo "graph_vlabel Number\n";
|
||||
echo "graph_category VoIP\n";
|
||||
|
@ -133,7 +133,7 @@ if(isset($argv[1]) && $argv[1] == "config")
|
|||
echo "selfdeaf.label Self Deafen\n";
|
||||
echo "avgperchan.label Users per chan\n";
|
||||
echo "error.label Server status error\n";
|
||||
|
||||
|
||||
$arr=array("mute","deaf","suppress","selfmute","selfdeaf","avgperchan","error");
|
||||
foreach($arr as $field){
|
||||
echo "".$field.".draw LINE1\n";
|
||||
|
@ -142,7 +142,7 @@ if(isset($argv[1]) && $argv[1] == "config")
|
|||
|
||||
|
||||
return 0;
|
||||
|
||||
|
||||
}else {
|
||||
echo "RTFM\n";
|
||||
return 1;
|
||||
|
@ -177,7 +177,7 @@ try {
|
|||
$initData->properties = Ice_createProperties();
|
||||
$initData->properties->setProperty("Ice.MessageSizeMax", "65536");
|
||||
$ICE = Ice_initialize($initData);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$base = $ICE->stringToProxy("Meta:tcp -h ".$ip." -p ".$port);
|
||||
|
@ -238,4 +238,4 @@ echo "selfdeaf.value ".$selfdeaf."\n";
|
|||
echo "avgperchan.value ".$avg."\n";
|
||||
echo "error.value 0\n";
|
||||
return 0;
|
||||
?>
|
||||
?>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue