Skip to content

Instantly share code, notes, and snippets.

@nmeans
Created September 19, 2011 21:09
Show Gist options
  • Save nmeans/1227623 to your computer and use it in GitHub Desktop.
Save nmeans/1227623 to your computer and use it in GitHub Desktop.
Simple Redis usage stats plugin for ServerDensity
import redis
class UsageStats:
def __init__(self,agentConfig,checksLogger,rawConfig):
self.agentConfig = agentConfig
self.checksLogger = checksLogger
self.rawConfig = rawConfig
def run(self):
r_server = redis.Redis("localhost")
files = r_server.get("file_count")
r_server.set("file_count",0)
records = r_server.get("record_count")
r_server.set("record_count",0)
data = {'Record Count': records, 'File Count':files}
return data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment