auxesis / visage

Graph collectd metrics in the browser, backed by a JSON API
http://visage-app.com/
Other
381 stars 56 forks source link

hosts(opts={}) returns incorrect values when a host is passed through #87

Closed beezly closed 12 years ago

beezly commented 12 years ago

In the autocomplete branch it looks like the code that works out what glob to use for looking up hosts is wrong in rrds.rb

I used the following;

    def hosts(opts={})
      hosts = opts[:hosts]
      case hosts
      when String && /,/
        glob = "{#{hosts}}"
      when Array
        glob = "{#{opts[:hosts].join(',')}}"
      when String
        glob = "#{hosts}"
      else
        glob = "*"
      end

      Dir.glob("#{rrddir}/#{glob}").map {|e| e.split('/').last }.sort.uniq
    end

Note the added "when String". This will make /data/ return the correct metrics for a given host.

beezly commented 12 years ago

Looks fixed now :D