Class: Host

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeHost

Returns a new instance of Host.



5
6
7
8
9
10
11
# File 'lib/zapix/zabbix_classes/host.rb', line 5

def initialize()
  @group_ids = Array.new
  @template_ids = Array.new
  @interfaces = Array.new
  @macros = Array.new
  @properties = Hash.new
end

Instance Attribute Details

#group_idsObject

Returns the value of attribute group_ids.



3
4
5
# File 'lib/zapix/zabbix_classes/host.rb', line 3

def group_ids
  @group_ids
end

#interfacesObject

Returns the value of attribute interfaces.



3
4
5
# File 'lib/zapix/zabbix_classes/host.rb', line 3

def interfaces
  @interfaces
end

#macrosObject

Returns the value of attribute macros.



3
4
5
# File 'lib/zapix/zabbix_classes/host.rb', line 3

def macros
  @macros
end

#template_idsObject

Returns the value of attribute template_ids.



3
4
5
# File 'lib/zapix/zabbix_classes/host.rb', line 3

def template_ids
  @template_ids
end

Instance Method Details

#add_encryption_options(opts) ⇒ Object



28
29
30
# File 'lib/zapix/zabbix_classes/host.rb', line 28

def add_encryption_options(opts)
  @properties.merge!(opts)
end

#add_group_ids(*ids) ⇒ Object



21
22
23
24
25
26
# File 'lib/zapix/zabbix_classes/host.rb', line 21

def add_group_ids(*ids)
  ids.each do |id|
    group_ids << {'groupid' => id}
  end
  @properties.merge!('groups' => group_ids)
end

#add_interfaces(*ifaces) ⇒ Object



32
33
34
35
# File 'lib/zapix/zabbix_classes/host.rb', line 32

def add_interfaces(*ifaces)
  interfaces.concat(ifaces)
  @properties.merge!('interfaces' => interfaces)
end

#add_macros(*host_macros) ⇒ Object



44
45
46
47
# File 'lib/zapix/zabbix_classes/host.rb', line 44

def add_macros(*host_macros)
  macros.concat(host_macros)
  @properties.merge!('macros' => host_macros)
end

#add_name(name) ⇒ Object



13
14
15
# File 'lib/zapix/zabbix_classes/host.rb', line 13

def add_name(name)
  @properties.merge!('host' => name)
end

#add_template_ids(*ids) ⇒ Object



37
38
39
40
41
42
# File 'lib/zapix/zabbix_classes/host.rb', line 37

def add_template_ids(*ids)
  ids.each do |id|
    template_ids << {'templateid' => id}
  end
  @properties.merge!('templates' => template_ids)
end

#add_visible_name(visible_name) ⇒ Object



17
18
19
# File 'lib/zapix/zabbix_classes/host.rb', line 17

def add_visible_name(visible_name)
  @properties.merge!('name' => visible_name)
end

#to_hashObject



49
50
51
# File 'lib/zapix/zabbix_classes/host.rb', line 49

def to_hash
  @properties
end