Module: Zabbix

Defined in:
lib/zabbix.rb,
lib/zabbix/config.rb,
lib/zabbix/reader.rb,
lib/zabbix/monitor.rb

Overview

Zabbix Monitor

Defined Under Namespace

Classes: Config, FileNotFoundError, Monitor, Reader

Class Method Summary collapse

Class Method Details

.configZabbix::Config

Returns creates a new or returns the existing the zabbix-monitor config.

Returns:

  • (Zabbix::Config)

    creates a new or returns the existing the zabbix-monitor config



37
38
39
# File 'lib/zabbix.rb', line 37

def config
  @config ||= Config.new
end

.configure {|config| ... } ⇒ Object

Call this method to modify defaults in your initializers.

Examples:

require 'zabbix'

Zabbix.configure do |config|
  config.config_file_path = '/etc/zabbix/zabbix_agentd.conf'
  config.log_file_path = '/var/log/monitor.log' #optional
  config.rate = '1m'
  config.mode = :push
  config.rules = [
    {
      :command => 'Monitor.new.test',
      :zabbix_key => 'zabbix.test'
    }
  ]
end

Parameters:

  • config (Hash)

    variables

Yields:



32
33
34
# File 'lib/zabbix.rb', line 32

def configure
  yield config
end

.loggerYell

Returns creates a new or returns the Yell logger instance.

Returns:

  • (Yell)

    creates a new or returns the Yell logger instance



46
47
48
49
50
# File 'lib/zabbix.rb', line 46

def logger
  @logger ||= Yell.new do |l|
    l.adapter self.config.log_adapter, :filename => self.config.log_file_path, :symlink => false
  end
end

.runObject



41
42
43
# File 'lib/zabbix.rb', line 41

def run
  File.exist?(config.config_file_path)
end