Class: Interface

Inherits:
Object
  • Object
show all
Defined in:
lib/zapix/zabbix_classes/interface.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ Interface

for more info see

https://www.zabbix.com/documentation/2.0/manual/appendix/api/hostinterface/definitions#host_interface

we assume ip and dns shall always be set



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/zapix/zabbix_classes/interface.rb', line 8

def initialize(attributes)
  @type = attributes['type'] ||= 1
  @main = attributes['main'] ||= 1
  @useip = attributes['useip'] ||= 1
  @ip = attributes['ip'] = attributes['ip']
  @dns = attributes['dns'] = attributes['dns']
  @port = attributes['port'] = attributes['port'] ||= 10_050
  @result = {
    'type' => type,
    'main' => main,
    'useip' => useip,
    'ip' => ip,
    'dns' => dns,
    'port' => port
  }
end

Instance Attribute Details

#dnsObject (readonly)

Returns the value of attribute dns.



2
3
4
# File 'lib/zapix/zabbix_classes/interface.rb', line 2

def dns
  @dns
end

#ipObject (readonly)

Returns the value of attribute ip.



2
3
4
# File 'lib/zapix/zabbix_classes/interface.rb', line 2

def ip
  @ip
end

#mainObject (readonly)

Returns the value of attribute main.



2
3
4
# File 'lib/zapix/zabbix_classes/interface.rb', line 2

def main
  @main
end

#portObject (readonly)

Returns the value of attribute port.



2
3
4
# File 'lib/zapix/zabbix_classes/interface.rb', line 2

def port
  @port
end

#typeObject (readonly)

Returns the value of attribute type.



2
3
4
# File 'lib/zapix/zabbix_classes/interface.rb', line 2

def type
  @type
end

#useipObject (readonly)

Returns the value of attribute useip.



2
3
4
# File 'lib/zapix/zabbix_classes/interface.rb', line 2

def useip
  @useip
end

Instance Method Details

#to_hashObject



25
26
27
# File 'lib/zapix/zabbix_classes/interface.rb', line 25

def to_hash
  @result
end