Sha256: 94e36a062614b2364c3d09ac016ac541b4b4c54b24bd11c23d2177d23583ba95

Contents?: true

Size: 750 Bytes

Versions: 2

Compression:

Stored size: 750 Bytes

Contents

class ZabbixApi
  class Hosts < Basic

    def method_name
      "host"
    end

    def indentify
      "host"
    end

    def default_options
      {
        :host => nil,
        :interfaces => [],
        :status => 0,
        :available => 1,
        :groups => [],
        :proxy_hostid => nil
      }
    end

    def unlink_templates(data)
      result = @client.api_request(
        :method => "host.massRemove",
        :params => {
          :hostids => data[:hosts_id],
          :templates => data[:templates_id]
        }
      )
      result.empty? ? false : true
    end

    def create_or_update(data)
      hostid = get_id(:host => data[:host])
      hostid ? update(data.merge(:hostid => hostid)) : create(data)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
zabbixapi-2.4.2 lib/zabbixapi/classes/hosts.rb
zabbixapi-2.4.1 lib/zabbixapi/classes/hosts.rb