Class: ZabbixApi::Graphs
- Inherits:
-
Basic
- Object
- Basic
- ZabbixApi::Graphs
show all
- Defined in:
- lib/zabbixapi/classes/graphs.rb
Instance Method Summary
collapse
Methods inherited from Basic
#add, #all, #create, #default_options, #delete, #destroy, #dump_by_id, #get, #get_id, #get_or_create, #hash_equals?, #initialize, #key, #keys, #log, #merge_params, #normalize_hash, #parse_keys, #symbolize_keys, #update
Instance Method Details
#_update(data) ⇒ Object
60
61
62
63
|
# File 'lib/zabbixapi/classes/graphs.rb', line 60
def _update(data)
data.delete(:name)
update(data)
end
|
#array_flag ⇒ Object
4
5
6
|
# File 'lib/zabbixapi/classes/graphs.rb', line 4
def array_flag
true
end
|
#create_or_update(data) ⇒ Object
55
56
57
58
|
# File 'lib/zabbixapi/classes/graphs.rb', line 55
def create_or_update(data)
graphid = get_id(:name => data[:name], :templateid => data[:templateid])
graphid ? _update(data.merge(:graphid => graphid)) : create(data)
end
|
#get_full_data(data) ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/zabbixapi/classes/graphs.rb', line 16
def get_full_data(data)
log "[DEBUG] Call get_full_data with parametrs: #{data.inspect}"
@client.api_request(
:method => "#{method_name}.get",
:params => {
:search => {
indentify.to_sym => data[indentify.to_sym]
},
:output => "extend"
}
)
end
|
#get_ids_by_host(data) ⇒ Object
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/zabbixapi/classes/graphs.rb', line 30
def get_ids_by_host(data)
ids = []
graphs = Hash.new
result = @client.api_request(:method => "graph.get", :params => {:filter => {:host => data[:host]}, :output => "extend"})
result.each do |graph|
num = graph['graphid']
name = graph['name']
graphs[name] = num
filter = data[:filter]
unless filter.nil?
if /#{filter}/ =~ name
ids.push(graphs[name])
end
else
ids.push(graphs[name])
end
end
ids
end
|
#get_items(data) ⇒ Object
51
52
53
|
# File 'lib/zabbixapi/classes/graphs.rb', line 51
def get_items(data)
@client.api_request(:method => "graphitem.get", :params => { :graphids => [data], :output => "extend" } )
end
|
#indentify ⇒ Object
12
13
14
|
# File 'lib/zabbixapi/classes/graphs.rb', line 12
def indentify
"name"
end
|
#method_name ⇒ Object
8
9
10
|
# File 'lib/zabbixapi/classes/graphs.rb', line 8
def method_name
"graph"
end
|