Skip to content

Instantly share code, notes, and snippets.

@ChrisLundquist
Created October 16, 2012 09:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ChrisLundquist/3898403 to your computer and use it in GitHub Desktop.
Save ChrisLundquist/3898403 to your computer and use it in GitHub Desktop.
def get_rrd_backend
Visage::Collectd::RRD.new( :rrddir => Visage::Config.rrddir,
:collectdsock => Visage::Config.collectdsock,
:rrdcachedsock => Visage::Config.rrdcachedsock)
end
def get_foo_backend
# something else
end
def get_current_backend
# when the config file options says :backend => :rrd
get_rrd_backend()
# When the config file says :backend => :foo
get_foo_backend()
# else misconfiguration or unknown backend, raise "unknown backend"
end
json = get_current_backend.json(
:host => host,
:plugin => plugin,
:instances => instances,
:start => start,
:finish => finish,
:percentiles => percentiles,
:resolution => resolution)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment