Class: RZabbix::Template

Inherits:
Base
  • Object
show all
Defined in:
lib/rzabbix/template.rb

Instance Attribute Summary

Attributes inherited from Base

#attributes

Class Method Summary collapse

Methods inherited from Base

#[], #initialize, perform_request, #to_hash, #to_json

Constructor Details

This class inherits a constructor from RZabbix::Base

Class Method Details

.default_attributesObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/rzabbix/template.rb', line 13

def self.default_attributes
  {                           
    :nodeids => nil,
    :groupids => nil,
    :templateids => nil,
    :parentTemplateids => nil,
    :hostids => nil,
    :graphids => nil,
    :itemids => nil,
    :triggerids => nil,
    :with_items => nil,
    :with_triggers => nil,
    :with_graphs => nil,
    :editable => nil,
    :nopermissions => nil
    
#        :filter => nil,
#        :pattern => '',
#        
#        :output => API_OUTPUT_REFER,
#        :extendoutput => nil,
#        :select_groups => nil,
#        :select_hosts => nil,
#        :select_templates => nil,
#        :selectParentTemplates => nil,
#        :select_items => nil,
#        :select_triggers => nil,
#        :select_graphs => nil,
#        :select_applications => nil,
#        :select_macros => nil,
#        :countOutput => nil,
#        :groupCount => nil,
#        :preservekeys => nil,
#        :sortfield => '',
#        :sortorder => '',
#        :limit => nil,
#        :limitSelects => nil
  }
end

.find_by_name(name) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/rzabbix/template.rb', line 5

def self.find_by_name(name)
  templates_hash = perform_request(:template, :get, :filter => {:host=>name}, :output=>"extend")
  if templates_hash.kind_of?(Hash) && !templates_hash.keys.empty?
    template_hash = templates_hash[templates_hash.keys.first]
    self.new(template_hash.rzbx_recursively_symbolize_keys)
  end
end