Created
March 24, 2010 18:27
-
-
Save oremj/342591 to your computer and use it in GitHub Desktop.
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/python | |
from urllib2 import urlopen, URLError | |
metrics = ['ReqPerSec', 'BytesPerSec', 'BytesPerReq', 'BusyWorkers', 'IdleWorkers'] | |
def get_metrics(): | |
try: | |
u = urlopen('http://localhost/server-status?auto') | |
except: | |
print "status err can't talk to apache" | |
return | |
print "status ok everything looks good" | |
for l in u.readlines(): | |
key, value = (i.strip() for i in l.split(':')) | |
if key in metrics: | |
print "metric %s int %d" % (key, float(value)) | |
get_metrics() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment