Author Topic: TremSnaps 1.0  (Read 24803 times)

Syntac

  • Posts: 841
  • Turrets: +118/-104
    • Syntac's Stuff
TremSnaps 1.0
« on: October 18, 2008, 05:50:08 am »
TremSnaps is a web app that captures the state of the entire Tremulous network. The state of each server, and each player, is written to a snapshot that can then be viewed by visitors. One snapshot is about 150 KB.

Installation
Just unzip it into whatever directory you like. Make sure PHP has full read/write access to the entire directory, or weird things can happen.

Automatic Snapshots
TremSnaps doesn't take snapshots on its own. You'll have to set up a cron job or something equivalent.

Code: [Select]
0 * * * * tremsnaps/snapshot.php
This would generate a snapshot every hour.

Configuring
The configuration file is common/config.php.

Downloads
Browse

Screenshots
Viewing a snapshot:

Viewing DretchStorm:
« Last Edit: October 28, 2008, 08:33:05 pm by Syntac »

Bissig

  • Posts: 1309
  • Turrets: +103/-131
Re: TremSnaps 1.0
« Reply #1 on: October 18, 2008, 09:03:16 pm »
One Megabyte? Can't you compress it or use another method for data storage?

Looks promising. I'll have a look at it later today.

David

  • Spam Killer
  • *
  • Posts: 3543
  • Turrets: +249/-273
Re: TremSnaps 1.0
« Reply #2 on: October 18, 2008, 09:29:31 pm »
What the hell are you storing?
qstat -R -P only comes out to 141k, 24k gzipped.
Any maps not in the MG repo?  Email me or come to irc.freenode.net/#mg.
--
My words are mine and mine alone.  I can't speak for anyone else, and there is no one who can speak for me.  If I ever make a post that gives the opinions or positions of other users or groups, then they will be clearly labeled as such.
I'm disappointed that people's past actions have forced me to state what should be obvious.
I am not a dev.  Nothing I say counts for anything.

Syntac

  • Posts: 841
  • Turrets: +118/-104
    • Syntac's Stuff
Re: TremSnaps 1.0
« Reply #3 on: October 18, 2008, 09:50:59 pm »
Crap, I was way off. It's about 150 KB. Turns out Mac OS X uses screwy estimation and you have to look at the number of bytes in order to find the real size.

Ellohir

  • Posts: 192
  • Turrets: +14/-13
    • El balrog con alas
Re: TremSnaps 1.0
« Reply #4 on: October 19, 2008, 12:37:41 am »
What does "server with stupid names" mean?

Syntac

  • Posts: 841
  • Turrets: +118/-104
    • Syntac's Stuff
Re: TremSnaps 1.0
« Reply #5 on: October 19, 2008, 12:51:18 am »
Heh, I was hoping someone would ask that. You know how some server owners put black "A"s in front of the title? Well, TremSnaps detects that.

It also removes boxes and deals with nonstandard color escapes.

Colynn'

  • Posts: 308
  • Turrets: +28/-35
Re: TremSnaps 1.0
« Reply #6 on: November 01, 2008, 12:59:22 am »
Hello,
Excuse-me of my newbieness, but does it works on Linux/Windows ?
PS : And for the necro too.
« Last Edit: November 01, 2008, 01:10:23 am by Colynn' »
Currently working on: REAL LIFE STUDIES BULLSHIT

Bissig

  • Posts: 1309
  • Turrets: +103/-131
Re: TremSnaps 1.0
« Reply #7 on: November 01, 2008, 01:26:20 am »
Hello,
Excuse-me of my newbieness, but does it works on Linux/Windows ?
PS : And for the necro too.

It's a php script - it works on almost any OS (well, at least on those where Tremulous runs on)

Syntac

  • Posts: 841
  • Turrets: +118/-104
    • Syntac's Stuff
Re: TremSnaps 1.0
« Reply #8 on: November 01, 2008, 01:33:54 am »
It works on all platforms that support the Apache (2?) web server and PHP 5.

Colynn'

  • Posts: 308
  • Turrets: +28/-35
Re: TremSnaps 1.0
« Reply #9 on: November 01, 2008, 02:49:17 am »
Currently working on: REAL LIFE STUDIES BULLSHIT

Syntac

  • Posts: 841
  • Turrets: +118/-104
    • Syntac's Stuff
Re: TremSnaps 1.0
« Reply #10 on: November 01, 2008, 02:50:46 am »
;D Did you set up a cron job?

[EDIT] Rawr, typo.
« Last Edit: November 01, 2008, 02:54:31 am by Syntac »

Colynn'

  • Posts: 308
  • Turrets: +28/-35
Re: TremSnaps 1.0
« Reply #11 on: November 01, 2008, 04:21:47 am »
Nop, sorry. Actually, I'm on windows (I have Ubuntu too, but I need to fix some things before) and I don't know how to set up a
Code: [Select]
cron on it.
And it's not my own server, it's the one of Symphony/Haptism, a french (??), who hosts me. ;)
Currently working on: REAL LIFE STUDIES BULLSHIT

Syntac

  • Posts: 841
  • Turrets: +118/-104
    • Syntac's Stuff
Re: TremSnaps 1.0
« Reply #12 on: November 01, 2008, 04:27:55 am »
Ohhh... Well, I'm just glad someone was able to get TremSnaps working.

Archangel

  • Guest
Re: TremSnaps 1.0
« Reply #13 on: November 01, 2008, 07:16:00 am »
Code: [Select]
[intellekt@oceanlab.ezbake.org ~/public_html/tremsnaps/] % unzip TremSnaps-R001.zip
Archive:  TremSnaps-R001.zip
   creating: tremsnaps/
  inflating: tremsnaps/.DS_Store     
   creating: __MACOSX/
   creating: __MACOSX/tremsnaps/
  inflating: __MACOSX/tremsnaps/._.DS_Store 
   creating: tremsnaps/common/
  inflating: tremsnaps/common/.DS_Store 
   creating: __MACOSX/tremsnaps/common/
  inflating: __MACOSX/tremsnaps/common/._.DS_Store 
  inflating: tremsnaps/common/config.php 
  inflating: __MACOSX/tremsnaps/common/._config.php 
   creating: tremsnaps/common/css/
  inflating: tremsnaps/common/css/default.css 
   creating: __MACOSX/tremsnaps/common/css/
  inflating: __MACOSX/tremsnaps/common/css/._default.css 
   creating: tremsnaps/common/img/
  inflating: tremsnaps/common/img/favicon.png 
  inflating: tremsnaps/common/tremsnaps.php 
  inflating: __MACOSX/tremsnaps/common/._tremsnaps.php 
  inflating: tremsnaps/common/zendb.php 
  inflating: __MACOSX/tremsnaps/common/._zendb.php 
  inflating: tremsnaps/index.php     
  inflating: __MACOSX/tremsnaps/._index.php 
  inflating: tremsnaps/snapshot.php 
  inflating: __MACOSX/tremsnaps/._snapshot.php 
   creating: tremsnaps/snapshots/
  inflating: tremsnaps/snapshots/.DS_Store 
   creating: __MACOSX/tremsnaps/snapshots/
  inflating: __MACOSX/tremsnaps/snapshots/._.DS_Store 

[oceanlab.ezbake.org - 06:13:57 #22]
[intellekt@oceanlab.ezbake.org ~/public_html/tremsnaps/] % ls
total 22
drwxr-xr-x   4 intellekt  operator    512 Nov  1 06:13 .
drwxr-xr-x  10 intellekt  operator   1024 Nov  1 06:13 ..
-rw-r--r--   1 intellekt  operator  12794 Oct 18 09:03 TremSnaps-R001.zip
drwxrwxr-x   3 intellekt  operator    512 Oct 18 00:03 __MACOSX
drwxrwxrwx   4 intellekt  operator    512 Oct 18 00:00 tremsnaps

Wow, no need for the __MACOSX folder. Please fix permissions out of the box too!

http://oceanlab.ezbake.org/~intellekt/tremsnaps/
« Last Edit: November 01, 2008, 07:28:04 am by Archangel »

Colynn'

  • Posts: 308
  • Turrets: +28/-35
I'm on it! o/
« Reply #14 on: November 01, 2008, 02:30:52 pm »
I'm on it! o/

EDIT : Btw, you should remove the stupid/not correct server's name system. Because some servers who have a correct name are not listed...
« Last Edit: November 01, 2008, 02:41:50 pm by Colynn' »
Currently working on: REAL LIFE STUDIES BULLSHIT

Syntac

  • Posts: 841
  • Turrets: +118/-104
    • Syntac's Stuff
Re: TremSnaps 1.0
« Reply #15 on: November 01, 2008, 04:41:53 pm »
Aargh, there's more wrong with Mac OS X's zip program than I thought! I'll repackage it as a gzip less defective archive.

Btw, you should remove the stupid/not correct server's name system. Because some servers who have a correct name are not listed...
What do you mean?
« Last Edit: November 01, 2008, 04:45:48 pm by Syntac »

Amanieu

  • Posts: 647
  • Turrets: +135/-83
    • Amanieu
Re: TremSnaps 1.0
« Reply #16 on: November 01, 2008, 04:46:59 pm »
Why is the Tremfusion Test Server not on the list ???
Quote
< kevlarman> zakk is getting his patches from shady frenchmen on irc
< kevlarman> this can't be a good sign :P

Syntac

  • Posts: 841
  • Turrets: +118/-104
    • Syntac's Stuff
Re: TremSnaps 1.0
« Reply #17 on: November 01, 2008, 04:48:43 pm »
Not sure. Could be due to packet loss.

Archangel

  • Guest
Re: TremSnaps 1.0
« Reply #18 on: November 01, 2008, 08:50:54 pm »
Yeah. there are a lot of servers that are fairly good that use boxes. I'd say just strip out the boxes, but still print the servers.

Syntac

  • Posts: 841
  • Turrets: +118/-104
    • Syntac's Stuff
Re: TremSnaps 1.0
« Reply #19 on: November 01, 2008, 08:59:41 pm »
It does. Boxes are stripped out when the list is retrieved.

Archangel

  • Guest
Re: TremSnaps 1.0
« Reply #20 on: November 01, 2008, 10:08:21 pm »
I see none of my servers, and they're all local to the machine.

Syntac

  • Posts: 841
  • Turrets: +118/-104
    • Syntac's Stuff
Re: TremSnaps 1.0
« Reply #21 on: November 01, 2008, 10:11:43 pm »
TremSnaps retrieves the list from the master server.

Archangel

  • Guest
Re: TremSnaps 1.0
« Reply #22 on: November 01, 2008, 10:50:25 pm »
I'm well aware. What I am saying is, none of my servers are showing up, and they can't possibly be timing out.

Sap

  • Posts: 42
  • Turrets: +2/-8
Re: TremSnaps 1.0
« Reply #23 on: November 01, 2008, 11:06:30 pm »
hehe ... my name is on top of that DretchStorm snapshot. Good timing Syntac  ;) .
"The views & opinions expressed above are solely of a Dretch and not endorsed by a Dragoon or a Rant. However, ocassional Mara zaps might have had some influence in it. "

Syntac

  • Posts: 841
  • Turrets: +118/-104
    • Syntac's Stuff
Re: TremSnaps 1.0
« Reply #24 on: November 02, 2008, 12:13:48 am »
I'm well aware. What I am saying is, none of my servers are showing up, and they can't possibly be timing out.
There could be packet loss that corrupts the list entry (and causes it to be removed), or something that prevents TremSnaps from connecting. Then there's the possibility of your servers not being public.

Archangel

  • Guest
Re: TremSnaps 1.0
« Reply #25 on: November 02, 2008, 01:54:21 am »
The fact that they're on a 100mbit line, with a 20ms ping to the master server, and they haven't gone down for over 70 days, leads me to believe there is a bug in your code.

Syntac

  • Posts: 841
  • Turrets: +118/-104
    • Syntac's Stuff
Re: TremSnaps 1.0
« Reply #26 on: November 02, 2008, 01:05:43 am »
There is very little possibility of there being a bug. This is all my code does:
    • Fetches a list from the master server (stripping out corrupted entries).
    • For each server on that list, connects to it and retrieves information.
    • Writes the accumulated data to a collection of files.
If you tell me what your servers' names are, I'll be happy to troubleshoot this myself.

[EDIT] Double negative...
« Last Edit: November 02, 2008, 03:44:27 pm by Syntac »

Undeference

  • Tremulous Developers
  • *
  • Posts: 1254
  • Turrets: +122/-45
Re: TremSnaps 1.0
« Reply #27 on: November 02, 2008, 01:10:33 am »
try
Code: [Select]
--- common/tremsnaps.php.orig 2008-11-01 21:08:44.000000000 -0400
+++ common/tremsnaps.php 2008-11-01 21:09:39.000000000 -0400
@@ -205,7 +205,9 @@
  $out = "\xFF\xFF\xFF\xFFgetservers 69 empty full";
 
  @fwrite( $fp, $out );
- $data_string = @fread( $fp, 100000 );
+ $data_string = '';
+ while( ( $read = fread( $fp, 100000 ) ) !== FALSE )
+ $data_string .= $read;
  $meta = @stream_get_meta_data( $fp );
  @fclose( $fp );
 
or some such

By the way, all the files in your current zip are gz'ed. Might want to fix that.
« Last Edit: November 02, 2008, 01:12:55 am by Undeference »
Need help? Ask intelligently. Please share solutions you find.

Thats what we need, helpful players, not more powerful admins.

Syntac

  • Posts: 841
  • Turrets: +118/-104
    • Syntac's Stuff
Re: TremSnaps 1.0
« Reply #28 on: November 02, 2008, 01:11:46 am »
Dammit, I know I'm in trouble when someone makes a diff of my code... :'(

All that aside, thanks Undeference. Will give it a try.

Syntac

  • Posts: 841
  • Turrets: +118/-104
    • Syntac's Stuff
Oh noes! A double post!
« Reply #29 on: November 02, 2008, 01:38:58 am »
I will shortly be remaking TremSnaps into a command-line tool. Projected features include:
    • Scope options
    • Flat-file dumps
    • Rcon console
    • Dump readback
    • And probably more...