Skip to content

Instantly share code, notes, and snippets.

@gourneau
Created April 5, 2013 00:15
Show Gist options
  • Save gourneau/5315605 to your computer and use it in GitHub Desktop.
Save gourneau/5315605 to your computer and use it in GitHub Desktop.
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