Class: ZabbixApi::Items

Inherits:
Basic
  • Object
show all
Defined in:
lib/zabbixapi/classes/items.rb

Instance Method Summary collapse

Methods inherited from Basic

#add, #all, #create, #create_or_update, #destroy, #dump_by_id, #get, #get_full_data, #get_id, #get_or_create, #hash_equals?, #initialize, #key, #keys, #log, #merge_params, #normalize_hash, #parse_keys, #symbolize_keys, #update

Constructor Details

This class inherits a constructor from ZabbixApi::Basic

Instance Method Details

#array_flagObject



4
5
6
# File 'lib/zabbixapi/classes/items.rb', line 4

def array_flag
  true
end

#default_optionsObject



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/zabbixapi/classes/items.rb', line 16

def default_options 
  {
    :name => nil,
    :key_ => nil,
    :hostid => nil,
    :delay => 60,
    :history => 60,
    :status => 0,
    :type => 7,
    :snmp_community => '',
    :snmp_oid => '',
    :value_type => 3,
    :data_type => 0,
    :trapper_hosts => 'localhost',
    :snmp_port => 161,
    :units => '',
    :multiplier => 0,
    :delta => 0,
    :snmpv3_securityname => '',
    :snmpv3_securitylevel => 0,
    :snmpv3_authpassphrase => '',
    :snmpv3_privpassphrase => '',
    :formula => 0,
    :trends => 365,
    :logtimefmt => '',
    :valuemapid => 0,
    :delay_flex => '',
    :authtype => 0,
    :username => '',
    :password => '',
    :publickey => '',
    :privatekey => '',
    :params => '',
    :ipmi_sensor => ''
  }
end

#delete(data) ⇒ Object



53
54
55
56
57
58
59
# File 'lib/zabbixapi/classes/items.rb', line 53

def delete(data)
  log "[DEBUG] Call delete with parametrs: #{data.inspect}"

  data_delete = array_flag ? [data] : [key.to_sym => data]
  result = @client.api_request(:method => "#{method_name}.delete", :params => data_delete)
  result['itemids'].keys[0].to_i
end

#indentifyObject



12
13
14
# File 'lib/zabbixapi/classes/items.rb', line 12

def indentify
  "name"
end

#method_nameObject



8
9
10
# File 'lib/zabbixapi/classes/items.rb', line 8

def method_name
  "item"
end