Sha256: b2585e88e67944f0e03831fac9a9271c36f03ba4a3fee4108238d997b6a2f51b

Contents?: true

Size: 761 Bytes

Versions: 6

Compression:

Stored size: 761 Bytes

Contents

class ZabbixApi
  class Hosts < Basic

    def array_flag
      true
    end

    def method_name
      "host"
    end

    def indentify
      "host"
    end

    def default_options
      {
        :host => nil,
        :interfaces => [],
        :status => 0,
        :available => 1,
        :groups => [],
      }
    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

6 entries across 6 versions & 1 rubygems

Version Path
zabbixapi-0.6.4 lib/zabbixapi/2.0/classes/hosts.rb
zabbixapi-0.6.3 lib/zabbixapi/2.0/classes/hosts.rb
zabbixapi-0.6.2 lib/zabbixapi/2.0/classes/hosts.rb
zabbixapi-0.6.1 lib/zabbixapi/2.0/classes/hosts.rb
zabbixapi-0.6.0 lib/zabbixapi/2.0/classes/hosts.rb
zabbixapi-0.5.9 lib/zabbixapi/2.0/classes/hosts.rb