Created
October 28, 2011 13:50
-
-
Save HarryR/1322306 to your computer and use it in GitHub Desktop.
Membase monitor for ServerDensity
This file contains hidden or 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 subprocess | |
| import re | |
| class Membase: | |
| def __init__(self, agentConfig, checksLogger, rawConfig): | |
| self.agentConfig = agentConfig | |
| self.checksLogger = checksLogger | |
| self.rawConfig = rawConfig | |
| def run(self): | |
| p = subprocess.Popen(['memstat','--servers=localhost'], stdout=subprocess.PIPE) | |
| out, err = p.communicate() | |
| data = {} | |
| lines = out.splitlines() | |
| header = lines.pop(0) | |
| for line in lines: | |
| line = line.strip().split() | |
| if re.match('^[0-9]+(\.[0-9]+)?$', line[1]): | |
| data[line[0]] = line[1] | |
| return data | |
| if __name__ == "__main__": | |
| mb = Membase(None, None, None) | |
| print mb.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment