Sha256: 3d415e94bd815ca73fd5daa5344b9334c283e76c7f831ae4cca74e8baa1fbdf9
Contents?: true
Size: 1.29 KB
Versions: 3
Compression:
Stored size: 1.29 KB
Contents
#!/usr/bin/env ruby $: << File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..')) require 'lib/visage-app/patches' module Visage module Collectd class RRDs class << self def rrddir @rrddir ||= Visage::Config.rrddir end def hosts(opts={}) case when opts[:hosts].blank? glob = "*" when opts[:hosts] =~ /,/ glob = "{#{opts[:hosts].strip.gsub(/\s*/, '').gsub(/,$/, '')}}" else glob = opts[:hosts] end Dir.glob("#{rrddir}/#{glob}").map {|e| e.split('/').last }.sort.uniq end def metrics(opts={}) case when opts[:metrics].blank? glob = "*/*" when opts[:metrics] =~ /,/ glob = "{" + opts[:metrics].split(/\s*,\s*/).map { |m| m =~ /\// ? m : ["*/#{m}", "#{m}/*"] }.join(',').gsub(/,$/, '') + "}" when opts[:metrics] !~ /\// glob = "#{opts[:metrics]}/#{opts[:metrics]}" else glob = opts[:metrics] end host_glob = (opts[:host] || "*") Dir.glob("#{rrddir}/#{host_glob}/#{glob}.rrd").map {|e| e.split('/')[-2..-1].join('/').gsub(/\.rrd$/, '')}.sort.uniq end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
visage-app-1.0.0 | lib/visage-app/collectd/rrds.rb |
visage-app-0.9.6 | lib/visage-app/collectd/rrds.rb |
visage-app-0.9.5 | lib/visage-app/collectd/rrds.rb |