class Nagios::Promoo::Opennebula::Probes::BaseProbe

Base probe for all ONe-related probes.

@author Boris Parak <parak@cesnet.cz>

Attributes

options[R]

Public Class Methods

new(options) click to toggle source
# File lib/nagios/promoo/opennebula/probes/base_probe.rb, line 17
def initialize(options)
  @options = options
end
runnable?() click to toggle source
# File lib/nagios/promoo/opennebula/probes/base_probe.rb, line 10
def runnable?
  false
end

Public Instance Methods

client() click to toggle source
# File lib/nagios/promoo/opennebula/probes/base_probe.rb, line 21
def client
  return @_client if @_client

  token = token_file? ? read_token : options[:token]
  @_client = OpenNebula::Client.new(token.to_s, options[:endpoint])
end

Private Instance Methods

read_token() click to toggle source
# File lib/nagios/promoo/opennebula/probes/base_probe.rb, line 34
def read_token
  File.read(options[:token].gsub('file://', ''))
end
token_file?() click to toggle source
# File lib/nagios/promoo/opennebula/probes/base_probe.rb, line 30
def token_file?
  options[:token].start_with?('file://')
end