Class: Host
- Inherits:
-
Object
- Object
- Host
- Defined in:
- lib/zapix/zabbix_classes/host.rb
Instance Attribute Summary collapse
-
#group_ids ⇒ Object
Returns the value of attribute group_ids.
-
#interfaces ⇒ Object
Returns the value of attribute interfaces.
-
#macros ⇒ Object
Returns the value of attribute macros.
-
#template_ids ⇒ Object
Returns the value of attribute template_ids.
Instance Method Summary collapse
- #add_encryption_options(opts) ⇒ Object
- #add_group_ids(*ids) ⇒ Object
- #add_interfaces(*ifaces) ⇒ Object
- #add_macros(*host_macros) ⇒ Object
- #add_name(name) ⇒ Object
- #add_template_ids(*ids) ⇒ Object
- #add_visible_name(visible_name) ⇒ Object
-
#initialize ⇒ Host
constructor
A new instance of Host.
- #to_hash ⇒ Object
Constructor Details
#initialize ⇒ Host
Returns a new instance of Host.
4 5 6 7 8 9 10 |
# File 'lib/zapix/zabbix_classes/host.rb', line 4 def initialize @group_ids = [] @template_ids = [] @interfaces = [] @macros = [] @properties = {} end |
Instance Attribute Details
#group_ids ⇒ Object
Returns the value of attribute group_ids.
2 3 4 |
# File 'lib/zapix/zabbix_classes/host.rb', line 2 def group_ids @group_ids end |
#interfaces ⇒ Object
Returns the value of attribute interfaces.
2 3 4 |
# File 'lib/zapix/zabbix_classes/host.rb', line 2 def interfaces @interfaces end |
#macros ⇒ Object
Returns the value of attribute macros.
2 3 4 |
# File 'lib/zapix/zabbix_classes/host.rb', line 2 def macros @macros end |
#template_ids ⇒ Object
Returns the value of attribute template_ids.
2 3 4 |
# File 'lib/zapix/zabbix_classes/host.rb', line 2 def template_ids @template_ids end |
Instance Method Details
#add_encryption_options(opts) ⇒ Object
27 28 29 |
# File 'lib/zapix/zabbix_classes/host.rb', line 27 def (opts) @properties.merge!(opts) end |
#add_group_ids(*ids) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/zapix/zabbix_classes/host.rb', line 20 def add_group_ids(*ids) ids.each do |id| group_ids << { 'groupid' => id } end @properties.merge!('groups' => group_ids) end |
#add_interfaces(*ifaces) ⇒ Object
31 32 33 34 |
# File 'lib/zapix/zabbix_classes/host.rb', line 31 def add_interfaces(*ifaces) interfaces.concat(ifaces) @properties.merge!('interfaces' => interfaces) end |
#add_macros(*host_macros) ⇒ Object
43 44 45 46 |
# File 'lib/zapix/zabbix_classes/host.rb', line 43 def add_macros(*host_macros) macros.concat(host_macros) @properties.merge!('macros' => host_macros) end |
#add_name(name) ⇒ Object
12 13 14 |
# File 'lib/zapix/zabbix_classes/host.rb', line 12 def add_name(name) @properties.merge!('host' => name) end |
#add_template_ids(*ids) ⇒ Object
36 37 38 39 40 41 |
# File 'lib/zapix/zabbix_classes/host.rb', line 36 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
16 17 18 |
# File 'lib/zapix/zabbix_classes/host.rb', line 16 def add_visible_name(visible_name) @properties.merge!('name' => visible_name) end |
#to_hash ⇒ Object
48 49 50 |
# File 'lib/zapix/zabbix_classes/host.rb', line 48 def to_hash @properties end |