diff options
author | Joe Robinson <joe@lc8n.com> | 2019-02-17 16:59:11 +0000 |
---|---|---|
committer | Joe Robinson <joe@lc8n.com> | 2019-02-17 16:59:11 +0000 |
commit | 96d72ed4d7fdd9cfa429e6b17e0a289f37427723 (patch) | |
tree | ccc10cbb9f0011b602ec0981c5ee4c08d6308c3d /scarecrow.rb | |
parent | 69be8ba8f3e6435df3e726eac03d069ea2503123 (diff) |
Add prometheus endpoint
Diffstat (limited to 'scarecrow.rb')
-rw-r--r-- | scarecrow.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/scarecrow.rb b/scarecrow.rb index a527515..71adf45 100644 --- a/scarecrow.rb +++ b/scarecrow.rb @@ -9,6 +9,9 @@ require 'dm-migrations' set :public_folder, File.dirname(__FILE__) + '/public' set :bind, '::' +configure do + mime_type :text, 'text/plain' +end DataMapper.setup(:default, ENV['DATABASE_URL'] || "sqlite3://#{Dir.pwd}/scarecrow.sqlite") class Temperature @@ -86,4 +89,11 @@ get '/humidity' do "#{humidity}" end +get '/metrics' do + content_type :text + humidity = Humidity.last[:value] + temp = Temperature.last[:value] + "humidity #{humidity}\ntemperature #{temp}" +end + init |