lib/zabbixapi/classes/graphs.rb in zabbixapi-2.4.9 vs lib/zabbixapi/classes/graphs.rb in zabbixapi-3.0.0

- old
+ new

@@ -46,9 +46,18 @@ def get_items(data) @client.api_request(:method => "graphitem.get", :params => { :graphids => [data], :output => "extend" } ) end + def get_or_create(data) + log "[DEBUG] Call get_or_create with parameters: #{data.inspect}" + + unless (id = get_id(:name => data[:name], :templateid => data[:templateid])) + id = create(data) + end + id + end + def create_or_update(data) graphid = get_id(:name => data[:name], :templateid => data[:templateid]) graphid ? _update(data.merge(:graphid => graphid)) : create(data) end