Sha256: 40af34de850b99cd2d27afe7c20fa3f40a53d789b87975b710d1efd0505a8a0f

Contents?: true

Size: 792 Bytes

Versions: 3

Compression:

Stored size: 792 Bytes

Contents

module Zabbix

  class ZabbixApi
    def add_application(app_options)
      app_options_default = {
          'hostid' => nil,
          'name' => nil
      }
      application = merge_opt(app_options_default, app_options)
      message = {
          'method' => 'application.create',
          'params' => application
      }
      responce = send_request(message)
      responce.empty? ? nil : responce['applicationids'][0].to_i
    end
  end

  def get_app_id(host_id, app_name)
    message = {
        'method' => 'application.get',
        'params' => {
            'filter' => {
                'name' => app_name,
                'hostid' => host_id
            }
        }
    }
    responce = send_request(message)
    responce.empty? ? nil : responce[0]['applicationid']
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
zabbixapi-0.1.6.3 lib/zabbixapi/application.rb
zabbixapi-0.1.6.2 lib/zabbixapi/application.rb
zabbixapi-0.1.6.1 lib/zabbixapi/application.rb