Skip to content
Browse files

variables are a little saner.

  • Loading branch information...
1 parent 44caf0e commit 205b9599bcfe8cd17e055d4393847d96f9074a8d @agoddard committed
Showing with 6 additions and 6 deletions.
  1. +4 −4 events.rb
  2. +2 −2 views/new.haml
View
8 events.rb
@@ -1,18 +1,18 @@
require 'sinatra'
require 'socket'
-$graphite_host = "graphite.host"
-port = 2003
+HOST = "mon03.core.cli.mbl.edu"
+PORT = 2003
get '/:event' do
@event = params[:event]
- haml :new
+ haml :new, :locals => {:graphite_host => HOST}
end
get '/:event/new' do
event = params[:event]
- graphite = TCPSocket.new($graphite_host,port)
+ graphite = TCPSocket.new(HOST, PORT)
graphite.puts("events.test.#{event} 1 #{Time.now.to_i}")
graphite.close
redirect "/#{event}"
View
4 views/new.haml
@@ -1,4 +1,4 @@
-%img{:src => "http://#{$graphite_host}/render/?target=drawAsInfinite%28events.test.#{@event}%29&from=-20minutes&template=plain&width=1000&height=500&lineWidth=2", :alt => "Graph"}
+%img{:src => "http://#{graphite_host}/render/?target=drawAsInfinite%28events.test.#{@event}%29&from=-20minutes&template=plain&width=1000&height=500&lineWidth=2", :alt => "Graph"}
-%img{:src => "http://#{$graphite_host}/render/?target=carbon.agents.mon03.metricsReceived&target=drawAsInfinite%28events.test.#{@event}%29&from=-1hour&template=plain&width=1000&height=500&lineWidth=2", :alt => "Graph"}
+%img{:src => "http://#{graphite_host}/render/?target=carbon.agents.mon03.metricsReceived&target=drawAsInfinite%28events.test.#{@event}%29&from=-1hour&template=plain&width=1000&height=500&lineWidth=2", :alt => "Graph"}

0 comments on commit 205b959

Please sign in to comment.
Something went wrong with that request. Please try again.