[bf1942] MRTG for BF player stats?

john g-lists at cloned.org.uk
Mon Sep 15 20:00:20 EDT 2003


Only just spied this thread.

I use this (called bf-query.01):

 -- --
#!/bin/sh
#
# MRTG Game Server player count log script

dir="/usr/local/mrtg-2/games"
file="players-bf.01"
ip="yourip"
port="23000"

cd $dir
/usr/local/bin/qstat -R -gps $ip:$port -old > $file
/usr/bin/perl -p -i -e 'print "$1\n" if(m/(\d{2}).{4}players/) or (m/(\d{1}).{4}players/) or (print "0")' $file
cut -c 1-2 $file | head -1
 -- --

it'll probably wrap so after the "cd $dir" there should be three lines
which start:
1) usr local bin qstat
2) usr bin perl
3) cut

to get mrtg to like it, i call it using

another shell script which just has this in it (called bfplayers.ag01):
 -- --
/usr/local/mrtg-2/games/bf-query.01
/usr/local/mrtg-2/games/bf-query.01
 -- --

and the mrtg conf has this in it:

 -- --
### dc.01 players

Target[bf-01]: `/bin/sh /usr/local/mrtg-2/games/bfplayers.01`
Options[bf-01]: nopercent,gauge,noinfo,growright,integer
MaxBytes[bf-01]: 20
ShortLegend[bf-01]: players
YLegend[bf-01]: Players
LegendI[bf-01]:  Players:
LegendO[bf-01]:
Legend1[bf-01]: Number of players on BF1942 server: yourip:14567
Title[bf-01]: Number of players on BF1942 server: yourip:14567
XSize[bf-01]: 450
YSize[bf-01]: 121.5
PageTop[bf-01]: <H1>01 DC (conquest) - Player Count</H1>
 -- --

Hope that makes sense. I use the same base for statting players on my
CS and UT2k3 servers and used to do the same for JK2 when i ran them, so
its pretty univeral with only a few changes required for different games.
Can't remember where I originally got the script from but I believe it was
on one of the links on the mrtg page.

Hope that helps

john

On Wed, 10 Sep 2003, Christopher Kunz wrote:

> Hey,
>
> does anyone of you have a small MRTG script that can be used to show the
> player statistics for a battlefield server? I'm running 1.45 with Secret
> Weapons now and would like to see about player vs. bandwidth ratio
> without having to constantly watch the box.
>
> --ck
> --
> php development | hosting |  housing | professional game server hosting
> http://www.de-punkt.de   [ chris at de-punkt.de ]    http://www.stormix.de
> +49 511 1237504 | +49 511 1237505 | laportestr. 2a, 30449 hannover.de
> Filoo auf dem Linuxtag 2003 (F15) - http://www.de-punkt.de/lt2003.php
>
>




More information about the Bf1942 mailing list