Class: Zabbix::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/zabbix/config.rb

Overview

The Zabbix::Config object used for initializing zabbix-monitor

Examples:

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

Instance Attribute Summary collapse

Instance Attribute Details

#config_file_pathString

Returns the zabbix agentd config file location.

Returns:

  • (String)

    the zabbix agentd config file location



22
23
24
# File 'lib/zabbix/config.rb', line 22

def config_file_path
  @config_file_path
end

#log_adapterSymbol #log_adapter=(value) ⇒ Symbol

Overloads:

  • #log_adapterSymbol

    Returns The zabbix-monitor log adapter.

    Returns:

    • (Symbol)

      The zabbix-monitor log adapter

  • #log_adapter=(value) ⇒ Symbol

    Sets the yell / zabbix-monitor log adapter See github.com/rudionrails/yell#usage for more information (optional)

    Options:

    :stdout logs to STDOUT
    :stderr logs to STDERR
    :file logs to a file
    :datefile logs to a timestamped file
    

    Parameters:

    • value (Symbol)

      the log_adapter

    Returns:

    • (Symbol)

      the new log_adapter



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

def log_adapter
  @log_adapter
end

#log_file_pathString

Note:

(optional) Defaults to ./log/#{RACK_ENV}.log

Returns The zabbix-monitor log file location (optional).

Returns:

  • (String)

    The zabbix-monitor log file location (optional)



27
28
29
# File 'lib/zabbix/config.rb', line 27

def log_file_path
  @log_file_path
end

#modeSymbol #mode=(value) ⇒ Symbol

Overloads:

  • #modeSymbol

    Returns the mode zabbix-monitor uses to process the results of the rules.

    Returns:

    • (Symbol)

      the mode zabbix-monitor uses to process the results of the rules

  • #mode=(value) ⇒ Symbol

    Sets the mode type, so zabbix-monitor knows how to process the results of the rules

    Options:

    :push uses the Zabbix agent to push the data to the Zabbix server
    :file writes the data to tmp/zabbix-stats.yml
    :stdout writes the data to the stdout
    

    Parameters:

    • value (Symbol)

      the mode

    Returns:

    • (Symbol)

      the new mode

    Raises:

    • (StandardError)

      when a unsupported mode is specified



63
64
65
# File 'lib/zabbix/config.rb', line 63

def mode
  @mode
end

#rateString

Returns the zabbix hostname.

Returns:

  • (String)

    the zabbix hostname



45
46
47
# File 'lib/zabbix/config.rb', line 45

def rate
  @rate
end

#rulesArray<Symbol>

Returns the set of rules to monitor.

Returns:

  • (Array<Symbol>)

    the set of rules to monitor



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

def rules
  @rules
end