class Edwig::Munin::Plugin

Attributes

referential[RW]
server[RW]
token[RW]

Public Class Methods

create(name) click to toggle source
# File lib/edwig/munin/plugin.rb, line 4
def self.create(name)
  camelcase_name = name.split('_').collect(&:capitalize).join
  Edwig::Munin.const_get(camelcase_name).new
end

Public Instance Methods

config() click to toggle source
# File lib/edwig/munin/plugin.rb, line 11
def config
  {}
end
env(name, required = false) click to toggle source
# File lib/edwig/munin/plugin.rb, line 37
def env(name, required = false)
  value = ENV[name]
  unless value
          raise MissingEnv.new "Missing #{name} environment variable"
  end
  value
end
run(arguments) click to toggle source
# File lib/edwig/munin/plugin.rb, line 19
def run(arguments)
  self.server = env 'EDWIG_SERVER'

  if arguments.first == "config"
    config.each do |key, value|
      puts "#{key} #{value}"
    end
    return
  end

  self.referential = env 'EDWIG_REFERENTIAL'
  self.token = env 'EDWIG_TOKEN'

  values.each do |key, value|
    puts "#{key}.value #{value}"
  end
end
values() click to toggle source
# File lib/edwig/munin/plugin.rb, line 15
def values
  {}
end