#!/usr/bin/env python

import sys
import bson
import redis

if __name__ == '__main__':

    if len(sys.argv) < 3:
        print 'Usage: %s <xray server> <HOST:VMNAME:PATH filter>' % sys.argv[0]
        exit(-1)

    server = sys.argv[1]
    filter_string = sys.argv[2]

    print 'Connecting to server \'%s\' with filter \'%s\'' % (server,
                                                              filter_string)

    r = redis.Redis(host='localhost', port=6379, db=4)
    pubsub = r.pubsub()

    pubsub.psubscribe(filter_string)

    for m in pubsub.listen():
        print "Message on Channel: %s" % (m['channel'])
        m = bson.loads(m['data'])
        for k,v in m.items():
            print '\t',
            print k,
            print ' : ',
            try:
                print int(v)
            except:
                print v

@@ -704,55 +704,24 @@
  '%5Ct
-',%0A            print k,%0A            print ' : '
+%25.6s%5Ct%5Ct:%5Ct' %25 k
 ,%0A  

update whitespace in follow tool