Skip to content

Commit

Permalink
reduce duplicate GET calls, refs and fixes #20
Browse files Browse the repository at this point in the history
  • Loading branch information
obfuscurity committed Apr 6, 2015
1 parent 11ea930 commit aaa2253
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions check_graphite
Expand Up @@ -92,11 +92,12 @@ data = {}
data["total"] = 0

begin
if JSON.parse(RestClient.get(URI.encode(url))).empty?
response = JSON.parse(RestClient.get(URI.encode(url)))
if response.empty?
puts "UNKNOWN no data reported by Graphite"
exit EXIT_UNKNOWN
else
JSON.parse(RestClient.get(URI.encode(url))).each do |cache|
response.each do |cache|
data["#{cache['target']}"] = 0
count = 0
cache["datapoints"].each do |point|
Expand Down

0 comments on commit aaa2253

Please sign in to comment.