fetep / pencil

Graphite dashboard system
http://fetep.github.com/pencil/
Other
155 stars 14 forks source link

NoMethodError at /dash/global #24

Open jeeveeyes opened 11 years ago

jeeveeyes commented 11 years ago

Hi,

I am using Pencil (rewrite branch 0.4.0a ) and have built and installed the Pencil gem properly.

I have a test metric up that shows up in Graphite's webUI and I tried to pull the same into Pencil. The test metric is in the format mysrv.server.testmetric where mysrv is the name of the host.

When I browse the Pencil home page at :9292 , I get the below error :

pencil

I, [2012-11-29T07:49:00.916454 #17168] INFO -- : no :manifest key for webapp, using default == Sinatra/1.3.3 has taken the stage on 9292 for development with backup from Mongrel 192.168.114.58 - - [29/Nov/2012 07:49:07] "GET / HTTP/1.1" 302 - 0.0092 NoMethodError - undefined method each' for nil:NilClass: /usr/lib/ruby/gems/1.8/gems/pencil-0.4.0a/lib/../views/global.erb:43:inevaluate_source' /usr/lib/ruby/gems/1.8/gems/pencil-0.4.0a/lib/../views/global.erb:37:in each' /usr/lib/ruby/gems/1.8/gems/pencil-0.4.0a/lib/../views/global.erb:37:inevaluate_source' /usr/lib/ruby/gems/1.8/gems/tilt-1.3.3/lib/tilt/template.rb:144:in cached_evaluate' /usr/lib/ruby/gems/1.8/gems/tilt-1.3.3/lib/tilt/template.rb:127:inevaluate' /usr/lib/ruby/gems/1.8/gems/tilt-1.3.3/lib/tilt/template.rb:76:in render' /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.3/lib/sinatra/base.rb:686:inrender' /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.3/lib/sinatra/base.rb:572:in erb' /usr/lib/ruby/gems/1.8/gems/pencil-0.4.0a/lib/pencil.rb:120:inGET /dash/:cluster/?' /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.3/lib/sinatra/base.rb:1264:in call' /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.3/lib/sinatra/base.rb:1264 /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.3/lib/sinatra/base.rb:835:in[]' /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.3/lib/sinatra/base.rb:835:in route!' /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.3/lib/sinatra/base.rb:851:inroute_eval' /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.3/lib/sinatra/base.rb:835:in route!' /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.3/lib/sinatra/base.rb:872:inprocess_route' /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.3/lib/sinatra/base.rb:870:in catch' /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.3/lib/sinatra/base.rb:870:inprocess_route' /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.3/lib/sinatra/base.rb:834:in route!' /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.3/lib/sinatra/base.rb:833:ineach' /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.3/lib/sinatra/base.rb:833:in route!' /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.3/lib/sinatra/base.rb:936:indispatch!' /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.3/lib/sinatra/base.rb:769:in call!' /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.3/lib/sinatra/base.rb:921:ininvoke' /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.3/lib/sinatra/base.rb:921:in catch' /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.3/lib/sinatra/base.rb:921:ininvoke' /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.3/lib/sinatra/base.rb:769:in call!' /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.3/lib/sinatra/base.rb:755:incall' /usr/lib/ruby/gems/1.8/gems/rack-1.4.1/lib/rack/logger.rb:15:in call' /usr/lib/ruby/gems/1.8/gems/rack-protection-1.2.0/lib/rack/protection/xss_header.rb:22:incall' /usr/lib/ruby/gems/1.8/gems/rack-protection-1.2.0/lib/rack/protection/path_traversal.rb:16:in call' /usr/lib/ruby/gems/1.8/gems/rack-protection-1.2.0/lib/rack/protection/json_csrf.rb:17:incall' /usr/lib/ruby/gems/1.8/gems/rack-protection-1.2.0/lib/rack/protection/base.rb:47:in call' /usr/lib/ruby/gems/1.8/gems/rack-protection-1.2.0/lib/rack/protection/xss_header.rb:22:incall' /usr/lib/ruby/gems/1.8/gems/rack-1.4.1/lib/rack/logger.rb:15:in call' /usr/lib/ruby/gems/1.8/gems/rack-1.4.1/lib/rack/commonlogger.rb:20:incall_without_check' /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.3/lib/sinatra/base.rb:136:in call' /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.3/lib/sinatra/base.rb:129:incall' /usr/lib/ruby/gems/1.8/gems/rack-1.4.1/lib/rack/head.rb:9:in call' /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.3/lib/sinatra/showexceptions.rb:21:incall' /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.3/lib/sinatra/base.rb:99:in call' /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.3/lib/sinatra/base.rb:1389:incall' /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.3/lib/sinatra/base.rb:1471:in synchronize' /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.3/lib/sinatra/base.rb:1389:incall' /usr/lib/ruby/gems/1.8/gems/rack-1.4.1/lib/rack/handler/mongrel.rb:77:in process' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:159:inprocess_client' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in each' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:inprocess_client' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:ininitialize' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in new' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:inrun' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in initialize' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:innew' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in run' /usr/lib/ruby/gems/1.8/gems/rack-1.4.1/lib/rack/handler/mongrel.rb:38:inrun' /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.3/lib/sinatra/base.rb:1350:in run!' /usr/lib/ruby/gems/1.8/gems/pencil-0.4.0a/bin/pencil:4 /usr/bin/pencil:23:inload' /usr/bin/pencil:23

The Sinatra debug error page shows up with something like :

NoMethodError at /dash/global undefined method `each' for nil:NilClass file: global.erb location: evaluate_source line: 43


My pencil.yml is

cat pencil.yml

:graphite_url: http:///graphite :port: 9292 :host_sort: "sensible" :metric_format: "%h.%m" #%m metric, %h host :templates_dir: "./conf" :refresh_rate: 60 # refresh rate for images in seconds

careful! these are properties as specified by the graphite-dsl now

:default_url_opts: :width: 1400 :height: 400 :fontsize: 15 :template: "noc" :ymin: 0 :margin: 5 :thickness: 2

:webapp: true :default_views:

My conf/global/testmet.graph :

-- mode: ruby --

title 'mysrv test metric' area :stacked

field :testmetric, :alias => "testmetric", :color => 'yellow', :data => "server.testmetric"

As per the wiki guidelines on configuration , I left the data unqualified i.e I omitted that host details. IOW, instead of :data => "mysrv.server.testmetric" I gave :data => "server.testmetric"

Any pointers on what could be wrong in this setup ?

jeeveeyes commented 11 years ago

Update on this :

I am able to get the nice-looking Pencil UI when I edit views/global.erb and truncate the file starting from this line till the end of the file ,

<% if !@cluster.psuedo %>

I get the Pencil UI although my metric is not visible. I think it might be a simple config issue from now on and I shall double check the config files.

jeeveeyes commented 11 years ago

After getting my dashboard , graph and metric config closely modelled after the examples, I am able to view my metrics on Pencil !

Looks great and am playing with various other options available.

Thanks.

War story: Once when I could not see my metric but rather only a place holder graphic image, I opened that image in a seperate browser tab. It turned out to be an image of a traceback that the Graphite Webapp had thrown when it tried to render the metric. From that I could see that it was a time zone related (Pytz library) error. Upgrading the Pytz version on my system seemed to make graphite happy and after that the graph in Pencil came up fine.