lib/heartbeat-client.rb in heartbeat-client-0.2.5 vs lib/heartbeat-client.rb in heartbeat-client-0.3.0
- old
+ new
@@ -3,11 +3,10 @@
require 'httparty'
require 'logger'
class Heartbeat
include HTTParty
- base_uri 'http://heartbeat-server.herokuapp.com'
def self.is_mac?
RUBY_PLATFORM.downcase.include?("darwin")
end
@@ -17,11 +16,11 @@
def self.log
Logger.new('/tmp/heartbeat.log')
end
- def self.create(apikey, name = nil)
+ def self.create(apikey, endpoint, name = nil)
procs = {'total' => 0, 'running' => 0, 'stuck' => 0, 'sleeping' => 0, 'threads' => 0, 'stopped' => 0, 'zombie' => 0}
load_avg = []
cpu_usage = {'user' => 0, 'sys' => 0, 'idle' => 0}
processes = []
memory = {'free' => 0, 'used' => 0}
@@ -87,18 +86,10 @@
}
}
}
}
- #puts procs.inspect
- #puts load_avg.inspect
- #puts cpu_usage.inspect
- #puts processes.inspect
- #puts memory.inspect
- #puts disks.inspect
- #puts swap.inspect
-
- Heartbeat.post('/heartbeat', options)
+ Heartbeat.post(endpoint + '/heartbeat', options)
else
put "No top output found."
end
end