Sha256: e2de61127dac98e168bb3bf197c432e962e87aca02c156142396fd0cb7351b9a

Contents?: true

Size: 1.07 KB

Versions: 11

Compression:

Stored size: 1.07 KB

Contents

class ZabbixApi
  class Hosts < Basic

    def method_name
      "host"
    end

    def indentify
      "host"
    end

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

      @client.api_request(
        :method => "host.get",
        :params => {
          :filter => {
            key.to_sym => data[key.to_sym]
          },
          :output => "extend",
          :selectGroups => "shorten"
        }
      )
    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

11 entries across 11 versions & 2 rubygems

Version Path
logstash-filter-zabbix-0.1.2 vendor/bundle/jruby/1.9/gems/zabbixapi-2.4.9/lib/zabbixapi/classes/hosts.rb
logstash-filter-zabbix-0.1.1 vendor/bundle/jruby/1.9/gems/zabbixapi-2.4.9/lib/zabbixapi/classes/hosts.rb
zabbixapi-3.1.0 lib/zabbixapi/classes/hosts.rb
zabbixapi-3.0.0 lib/zabbixapi/classes/hosts.rb
zabbixapi-2.4.9 lib/zabbixapi/classes/hosts.rb
zabbixapi-2.4.8 lib/zabbixapi/classes/hosts.rb
zabbixapi-2.4.7 lib/zabbixapi/classes/hosts.rb
zabbixapi-2.4.6 lib/zabbixapi/classes/hosts.rb
zabbixapi-2.4.5 lib/zabbixapi/classes/hosts.rb
zabbixapi-2.4.4 lib/zabbixapi/classes/hosts.rb
zabbixapi-2.4.3 lib/zabbixapi/classes/hosts.rb