News:

Come Chat with us live! Learn how HERE!

Main Menu

TremSnaps 1.0

Started by Syntac, October 18, 2008, 05:50:08 AM

Syntac

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.


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:

Bissig

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

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

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

What does "server with stupid names" mean?

Syntac

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'

#6
Hello,
Excuse-me of my newbieness, but does it works on Linux/Windows ?
PS : And for the necro too.
Currently working on: REAL LIFE STUDIES BULLSHIT

Bissig

Quote from: Colynn' on October 31, 2008, 11:59:22 PM
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

It works on all platforms that support the Apache (2?) web server and PHP 5.

Colynn'

Currently working on: REAL LIFE STUDIES BULLSHIT

Syntac

#10
;D Did you set up a cron job?

[EDIT] Rawr, typo.

Colynn'

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 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

Ohhh... Well, I'm just glad someone was able to get TremSnaps working.

Archangel

#13
[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/

Colynn'

#14
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...
Currently working on: REAL LIFE STUDIES BULLSHIT

Syntac

#15
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.

Quote from: Colynn' on November 01, 2008, 01:30:52 PM
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?

Amanieu

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

Not sure. Could be due to packet loss.

Archangel

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

It does. Boxes are stripped out when the list is retrieved.

Archangel

I see none of my servers, and they're all local to the machine.

Syntac

TremSnaps retrieves the list from the master server.

Archangel

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

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

Quote from: Archangel on November 01, 2008, 09: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.
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

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

#26
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...

Undeference

#27
try
--- 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.
Need help? Ask intelligently. Please share solutions you find.

Quote from: tuple on February 15, 2008, 11:54:10 PMThats what we need, helpful players, not more powerful admins.

Syntac

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

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...