Created
September 7, 2016 10:14
-
-
Save bluebycode/ff4a9ac6bb98929106f3f593da8ec293 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
import sys | |
import subprocess | |
if len(sys.argv) == 1: | |
tail = subprocess.Popen('tail -1000 GSGame.log'.split(), stdout=subprocess.PIPE) | |
rooms = subprocess.Popen('grep Rooms'.split(),stdin=tail.stdout, stdout=subprocess.PIPE) | |
last = subprocess.Popen('tail -1'.split(),stdin=rooms.stdout, stdout=subprocess.PIPE) | |
output = last.communicate()[0] | |
parameters = output.rstrip().split() | |
if len(parameters) == 0: | |
print "rooms.value 0" | |
else: | |
print "rooms.value %s" % parameters[8] | |
elif sys.argv[1] == 'name': | |
print "rooms" | |
elif sys.argv[1] == 'config': | |
print "graph_title Number of rooms" | |
print "graph_vlabel number of rooms" | |
print "graph_category game" | |
print "graph_info This graph shows the number of rooms" | |
print "rooms.label rooms" | |
print "rooms.info The current number of active rooms" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment