class CheckMK::Agents::DummyAgent

Constants

AGENT_NAME

Agent name – appears in CheckMK output

Attributes

name[R]

Public Class Methods

new(opts = {}) click to toggle source
# File lib/check_mk/agents/dummy_agent.rb, line 17
def initialize(opts = {})
  @name = opts[:name] || self.class::AGENT_NAME
end

Public Instance Methods

lines() click to toggle source
# File lib/check_mk/agents/dummy_agent.rb, line 21
def lines
  result = []
  result << formatted_header
  stats.each do |stat, _|
    result << formatted_stat(stat)
  end
  result
end
output() click to toggle source
# File lib/check_mk/agents/dummy_agent.rb, line 30
def output
  lines.join("\n")
end
stats() click to toggle source

Redefine this method in your subclass to return stats

# File lib/check_mk/agents/dummy_agent.rb, line 13
def stats
  {}
end

Private Instance Methods

formatted_header() click to toggle source
# File lib/check_mk/agents/dummy_agent.rb, line 36
def formatted_header
  "<<<#{@name}>>>"
end
formatted_stat(stat) click to toggle source
# File lib/check_mk/agents/dummy_agent.rb, line 40
def formatted_stat(stat)
  "#{stat} #{stats[stat]}"
end