1. Paul Chakravarti
  2. redis_monitor


redis_monitor /

Filename Size Date modified Message
45 B
998 B
636 B


Parse & generate alerts from Redis real-time MONITOR output

The class will parse the MONITOR output from a Redis server and call one or more listener callbacks for each command received.

The signature of the listener callback is:

  • Listener callbacks are attached using the add_listener(f) method.
  • If a listener raises 'Unregister' it will be unregistered
  • If a listener raises 'ExitLoop' the asyncore loop will be terminated (even if there are other active listeners)

Basic Usage:

def debug_listener(verb,key,args,data):
print (verb,key,args,data)

m = RedisMonitor() m.add_listener(debug_listener) asyncore.loop()

To listen & return specific data it is easiest to use a class with an appropriate __call__ method (KeyListener provides an example which listens for updates a specific key):

m = RedisMonitor() l = KeyListener('xxx') m.add_listener(l) asyncore.loop() print l.cmd