From b9ada83376f74d9e3653ae2e9bab0d6b49d4abc9 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 4 Apr 2007 23:22:33 +0200 Subject: [PATCH] Actually add the MBD status too. --- web/mbd-status.pl | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100755 web/mbd-status.pl diff --git a/web/mbd-status.pl b/web/mbd-status.pl new file mode 100755 index 0000000..33dee1d --- /dev/null +++ b/web/mbd-status.pl @@ -0,0 +1,44 @@ +#! /usr/bin/perl +use CGI; +use DBI; +use lib '../include'; +use nms; +my $cgi = CGI->new; + +my $dbh = nms::db_connect(); +print $cgi->header(-type=>'text/html', -refresh=>'10; http://nms.tg07.gathering.org/mbd-status.pl'); + +print <<"EOF"; + + + MBD status + + +

MBD status

+ +

Spill søkt etter siste 15 minutter:

+ + + + + + +EOF + +my $q = $dbh->prepare('select description,sum(active_servers) as active_servers from (select distinct on (game,port) * from mbd_log where ts >= now() - interval \'30 minutes\' order by game,port,ts desc ) t1 group by game,description order by sum(active_servers) desc, description;'); +$q->execute(); +while (my $ref = $q->fetchrow_hashref()) { + print <<"EOF"; + + + + +EOF +} +$dbh->disconnect; + +print <<"EOF"; +
BeskrivelseAktive servere
$ref->{'description'}$ref->{'active_servers'}
+ + +EOF -- 2.39.2