Created
April 5, 2013 00:15
-
-
Save gourneau/5315605 to your computer and use it in GitHub Desktop.
This file contains 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
from __future__ import division | |
import requests | |
import math | |
r = requests.get("http://ionwest.itw/rundb/api/v1/pluginresult/?format=json&endtime__gte=2013-01-10&limit=0") | |
s = [o["state"] for o in r.json["objects"] if o["state"] != "Queued" or o["state"] != "Pending"] | |
success = 0 | |
error = 0 | |
for x in s: | |
if x == "Error": | |
error += 1 | |
elif x == "Completed": | |
success += 1 | |
else: | |
print x | |
print "Plugins ran today " , len(s) | |
print "Plugins that have failed today", error | |
print math.ceil((error/len(s)) * 100), "% failure rate" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment