Skip to content

Commit

Permalink
A few updates, better colour range
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert May committed Jun 7, 2013
1 parent 070b7be commit 2be790a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pingdom_pi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class Monitor
def initialize(auth = {}, options = {})
@client = Client.new(auth)
@options = options
@file_path = File.expand_path(@options[:file])
end

def checks
Expand Down Expand Up @@ -40,8 +41,7 @@ def handle_checks(checks)

def notify(colour = "000")
p "Notifying #{colour}"
path = File.expand_path(@options[:file])
File.open(path, "w") { |f| f.write colour }
File.open(@file_path, "w") { |f| f.write(colour) }
p "Colour written to #{path}"
end
end
Expand Down Expand Up @@ -79,8 +79,8 @@ def parse_response(body)
api_key: ENV['PINGDOM_API_KEY']
}, {
response_time: [
{ range: 1...700, colour: "010" },
{ range: 700...1500, colour: "011" },
{ range: 1...700, colour: "020" },
{ range: 700...1500, colour: "010" },
{ range: 1500...5000, colour: "220" },
{ range: 5000..100000, colour: "200" }
],
Expand Down

0 comments on commit 2be790a

Please sign in to comment.