2012-08-24 23:39:15 +02:00
|
|
|
#!/usr/bin/php
|
2012-08-25 00:14:52 +02:00
|
|
|
# Copyright (C) 2012 David Gagnon <djgagnon@wisc.edu>
|
2012-08-24 23:39:15 +02:00
|
|
|
# Plugin to monitor ARIS users
|
|
|
|
#
|
2012-08-25 00:14:52 +02:00
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU Library General Public License as published by
|
|
|
|
# the Free Software Foundation; version 2 only
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU Library General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Library General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
#
|
2012-08-24 23:39:15 +02:00
|
|
|
# Parameters:
|
|
|
|
#
|
|
|
|
# config (required)
|
2018-08-02 02:03:42 +02:00
|
|
|
#
|
2012-08-24 23:39:15 +02:00
|
|
|
#
|
|
|
|
#%# family=manual
|
|
|
|
|
|
|
|
<?php
|
|
|
|
$aris_db_host='localhost';
|
|
|
|
$aris_db_name='db';
|
|
|
|
$aris_db_user='user';
|
|
|
|
$aris_db_pass='password';
|
|
|
|
|
|
|
|
if ($argv[1]=='config'){
|
|
|
|
print "graph_title ARIS active players\n";
|
|
|
|
print "graph_vlabel Players Count\n";
|
2017-02-21 18:24:41 +01:00
|
|
|
print "graph_category games\n";
|
2012-08-24 23:39:15 +02:00
|
|
|
print "players.label player count\n";
|
|
|
|
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2017-04-17 22:43:38 +02:00
|
|
|
$sqlLink = mysql_connect($aris_db_host,$aris_db_user,$aris_db_pass) or die('MySQL authentication error');
|
2012-08-24 23:39:15 +02:00
|
|
|
mysql_select_db($aris_db_name) or die('MySQL Wrong Scheme Error');
|
|
|
|
|
|
|
|
$query = 'SELECT COUNT(DISTINCT player_id) AS count FROM player_log WHERE timestamp BETWEEN DATE_SUB(NOW(), INTERVAL 5 MINUTE) AND NOW()';
|
|
|
|
$result = mysql_query($query);
|
|
|
|
$numCurrentPlayersObject = mysql_fetch_object($result);
|
|
|
|
$numCurrentPlayers = $numCurrentPlayersObject->count;
|
|
|
|
|
|
|
|
echo 'players.value '. $numCurrentPlayers;
|
|
|
|
|
|
|
|
?>
|