From: R0b0t1
Do you think you could record player statistics on every world? I would like to see them, but I don't have a computer I can run 24/7 (yet).
Also what are you using for graphing?
I could. It would not be worthwhile though, and it would probably make Jagex mad as well (they request you not load the world list at a set time, and that you only do it when a user requests it, as it probably uses quite a bit of their CPU time).
I am using rrdtool + Perl. Runs every 5 minutes.
Perl side (queries player count, adds to RRDatabase):
#!/usr/bin/perl
use LWP::Simple;
$print_flag = shift;
my $content = get("http://www.runescape.com/title.ws");
$content =~ s/(.*)<span id="playerCount">(.*) people currently online//gi;
$content = $2;
$content =~ s/,//gi;
print $content . "\r\n";
if ($print_flag) {
print "rrdtool update /rrd/rsplayers.rrd N:$content\n";
}
print length($content)." length\r\n";
if (length($content) > 1) {
`rrdtool update /var/lib/rrd/rsplayers.rrd N:$content`
} else { print "le fail!\r\n"; }
Bash side (creates the actual graphs using the .rrd files):
#!/bin/bash
rrdtool graph /var/www/harry.lu/files/rrdtool/rsplayers_daily.png \
--title "1-day RuneScape Players Online" \
--width 600 \
--height 350, \
--start -86400 \
--vertical-label "players currently connected" \
--no-legend \
-E \
-W "Created at `date` on Harry.lu" \
DEF:nc=/var/lib/rrd/rsplayers.rrd:connections:AVERAGE \
AREA:nc#32CD32 \
LINE1:nc#336600
rrdtool graph /var/www/harry.lu/files/rrdtool/rsplayers_weekly.png \
--title "1-week RuneScape Players Online" \
--width 600 \
--height 350, \
--start -604800 \
--vertical-label "players currently connected" \
--no-legend \
-E \
-W "Created at `date` on Harry.lu" \
DEF:nc=/var/lib/rrd/rsplayers.rrd:connections:AVERAGE \
AREA:nc#32CD32 \
LINE1:nc#336600
Crontab:
*/5 * * * * /usr/local/bin/rrd_rsplayer.pl > /dev/null 2>&1 && /usr/local/bin/rrd_rsplayer.sh > /dev/null 2>&1
I could probably make them all into one file, but I am le lazy!