class Zabbix::Sender::Connection

Connection is an abstract class that defines the basis of specific connection types (Pipe, Socket). It is not meant to be instantiated on its own.

Attributes

pipe[R]
targetHost[R]

target host (server or proxy) name or ip

Public Class Methods

new(proxy: Zabbix::AgentConfiguration.zabbixProxy) click to toggle source

Initialize a new Connector object. Proxy is optional.

An attempt is made to provide sane default values. If you have a zabbix_agentd.conf file in one of the usual places and zabbix_sender is on your path, it'll probably just work

# File lib/zabbix_sender_api/api.rb, line 88
def initialize(proxy: Zabbix::AgentConfiguration.zabbixProxy)
  @targetHost = proxy
  @pipe = nil
end

Public Instance Methods

flush() click to toggle source

Closes the zabbix_sender pipe if it's open

# File lib/zabbix_sender_api/api.rb, line 116
def flush
  if @pipe and not @pipe.closed?
    @pipe.close
  end
end
open() click to toggle source

Aborts execution if directly called. Subclasses must override.

# File lib/zabbix_sender_api/api.rb, line 95
def open
  abort("Call to abstract method Connection::open")
end
sendBatch(aBatch) click to toggle source

Aborts execution if directly called. Subclasses must override.

# File lib/zabbix_sender_api/api.rb, line 101
def sendBatch(aBatch)
  abort("Call to abstract method Connection::sendBatch(aBatch)")
end
sendBatchAtomic(aBatch) click to toggle source

Send a Batch instance to zabbix (via zabbix_sender). This opens the pipe, writes the data to the pipe, and closes the pipe all in one go.

# File lib/zabbix_sender_api/api.rb, line 108
def sendBatchAtomic(aBatch)
  self.open
  self.sendBatch(aBatch)
  return self.flush
end