Sha256: df492ab73f963b3958f439e058c6406bee3bee9951e009d56ed4370d175dc2f9

Contents?: true

Size: 1.1 KB

Versions: 6

Compression:

Stored size: 1.1 KB

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,
        :port => 10050,
        :status => 1,
        :useip => 1,
        :dns => '',
        :ip => '0.0.0.0',
        :proxy_hostid => 0,
        :groups => [],
        :useipmi => 0,
        :ipmi_ip => '',
        :ipmi_port => 623,
        :ipmi_authtype => 0,
        :ipmi_privilege => 0,
        :ipmi_username => '',
        :ipmi_password => ''
      }
    end

    def unlink_templates(data)
      result = @client.api_request(
        :method => "host.massRemove",
        :params => {
          :hostids => data[:hosts_id],
          :templates => data[:templates_id]
        }
      )
      case @client.api_version
        when "1.2"
          result ? true : false
        else
          result.empty? ? false : true
      end
    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.6 lib/zabbixapi/1.8/classes/hosts.rb
zabbixapi-0.6.4 lib/zabbixapi/1.8/classes/hosts.rb
zabbixapi-0.6.3 lib/zabbixapi/1.8/classes/hosts.rb
zabbixapi-0.6.2 lib/zabbixapi/1.8/classes/hosts.rb
zabbixapi-0.6.1 lib/zabbixapi/1.8/classes/hosts.rb
zabbixapi-0.6.0 lib/zabbixapi/1.8/classes/hosts.rb