Created
October 16, 2014 16:32
-
-
Save rsff/59b889d78d2666ba8923 to your computer and use it in GitHub Desktop.
WSO2 stats parser
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
import subprocess | |
import re | |
USER = 'admin' | |
PASSWD = 'admin' | |
PORT = '9999' | |
HOST = '' | |
JMXSH = '/home/rsff/Theorem/jmxsh.jar' | |
METRICS = {} | |
METRICS['suckme']="org.wso2.carbon:type=StatisticsAdmin SystemResponseCount" | |
sh = 'jmx_connect -h ' + HOST + ' -p ' + PORT + ' -U ' + USER + ' -P ' + PASSWD + ' \n' | |
for name,mbean in METRICS.items(): | |
sh += 'puts "' + name + ': [jmx_get -m ' + mbean + ']"\n' | |
cmd = "java -jar " + JMXSH + " -q" | |
p = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE,stderr=subprocess.PIPE) | |
out, err = p.communicate(sh) | |
response = re.findall("suckme: (\d+)", out) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment