mjc-gh / batsd-dash

Sinatra-based dash app for batsd
49 stars 11 forks source link

Can't get dashboard working #6

Closed pkhamre closed 12 years ago

pkhamre commented 12 years ago

Installed the batsd-dash gem, and added a simple config.ru-file and ran rackup. Requests to the server causes 500 internal server error.

root@precise:~/dash :) cat config.ru 
require 'batsd-dash'

BatsdDash::ConnectionPool.settings = { host:'localhost', port: 8127, pool_size: 4 }
run BatsdDash::App
root@precise:~/dash :) rackup
[2012-07-05 15:26:34] INFO  WEBrick 1.3.1
[2012-07-05 15:26:34] INFO  ruby 1.9.3 (2012-04-20) [x86_64-linux]
[2012-07-05 15:26:34] INFO  WEBrick::HTTPServer#start: pid=5518 port=9292
192.168.122.1 - - [05/Jul/2012 15:26:38] "GET /version HTTP/1.1" 500 33187 0.0352

A sample request:

pkhamre@koda:~ :( GET -USed http://precise:9292/version
GET http://precise:9292/version
User-Agent: lwp-request/6.03 libwww-perl/6.03

500 Internal Server Error
Connection: close
Date: Thu, 05 Jul 2012 13:26:38 GMT
Server: WEBrick/1.3.1 (Ruby/1.9.3/2012-04-20)
Content-Length: 33187
Content-Type: text/html
Client-Date: Thu, 05 Jul 2012 13:26:37 GMT
Client-Peer: 192.168.122.141:9292
Client-Response-Num: 1
Title: NoMethodError at /version

pkhamre@koda:~ :(

Any suggestions?

mjc-gh commented 12 years ago

Try using thin instead of webrick. First make sure you have thin (gem install thin).

Then run:

bundle exec thin start -R config.ru
pkhamre commented 12 years ago

Thanks, that helped.

/ respons as I expected, but I get 404 on /version, /available, /counters etc.

mjc-gh commented 12 years ago

Very strange. What type of output are you getting?

pkhamre commented 12 years ago

/

pkhamre@koda:~ :( GET -USed http://precise:3000/
GET http://precise:3000/
User-Agent: lwp-request/6.03 libwww-perl/6.03

200 OK
Connection: close
Server: thin 1.4.1 codename Chromeo
Content-Length: 832
Content-Type: text/html;charset=utf-8
Client-Date: Thu, 05 Jul 2012 13:50:26 GMT
Client-Peer: 192.168.122.141:3000
Client-Response-Num: 1
Link: </css/jquery-ui.css>; rel="stylesheet"; type="text/css"
Link: </css/datetimepicker.css>; rel="stylesheet"; type="text/css"
Link: </css/public.css>; rel="stylesheet"; type="text/css"
Title: Batsd Dash
X-Frame-Options: sameorigin
X-Meta-Author: http://breakbase.com
X-XSS-Protection: 1; mode=block

/version

pkhamre@koda:~ :) GET -USed http://precise:3000/version
GET http://precise:3000/version
User-Agent: lwp-request/6.03 libwww-perl/6.03

404 Not Found
Connection: close
Server: thin 1.4.1 codename Chromeo
Content-Length: 441
Content-Type: text/html;charset=utf-8
Client-Date: Thu, 05 Jul 2012 13:50:33 GMT
Client-Peer: 192.168.122.141:3000
Client-Response-Num: 1
X-Cascade: pass
X-Frame-Options: sameorigin
X-XSS-Protection: 1; mode=block

/counters

pkhamre@koda:~ :( GET -USed http://precise:3000/counters
GET http://precise:3000/counters
User-Agent: lwp-request/6.03 libwww-perl/6.03

404 Not Found
Connection: close
Server: thin 1.4.1 codename Chromeo
Content-Length: 442
Content-Type: text/html;charset=utf-8
Client-Date: Thu, 05 Jul 2012 13:50:36 GMT
Client-Peer: 192.168.122.141:3000
Client-Response-Num: 1
X-Cascade: pass
X-Frame-Options: sameorigin
X-XSS-Protection: 1; mode=block

pkhamre@koda:~ :(
pkhamre commented 12 years ago

I should also add that I have no data in batsd yet.

mjc-gh commented 12 years ago

The 404's are because you need to set the Accept header to application/json for accessing data.

Try hitting /counters#metrics=requests in your browser and see if you get a response.

Note that, in the next few days when we push our updates, these routes will change somewhat.

pkhamre commented 12 years ago

Ah, thank you! :)

pkhamre@koda:~ :) GET -H'Accept: application/json' http://precise:3000/version
{"version":"0.2.1"}