Class: ZabbixManager::HttpTests

Inherits:
Basic
  • Object
show all
Defined in:
lib/zabbix_manager/classes/httptests.rb

Instance Method Summary collapse

Methods inherited from Basic

#add, #all, #create, #create_or_update, #create_raw, #delete, #delete_raw, #destroy, #dump_by_id, #get, #get_full_data, #get_id, #get_or_create, #get_raw, #hash_equals?, #initialize, #key, #keys, #log, #normalize_hash, #parse_keys, #update, #update_raw

Constructor Details

This class inherits a constructor from ZabbixManager::Basic

Instance Method Details

#default_optionsHash

返回创建 Web 场景时使用的默认步骤列表。

Returns:

  • (Hash)

    Web 场景默认属性



22
23
24
25
26
# File 'lib/zabbix_manager/classes/httptests.rb', line 22

def default_options
  {
    steps: []
  }
end

#identifyString

返回 Web 场景用于业务识别的字段名。

Returns:

  • (String)


15
16
17
# File 'lib/zabbix_manager/classes/httptests.rb', line 15

def identify
  "name"
end

#identity_filter(data) ⇒ Hash

生成由 Web 场景名称和所属主机构成的稳定查询条件。

Parameters:

  • data (Hash)

    包含 name 和 hostid 的 Web 场景属性

Returns:

  • (Hash)

    Web 场景唯一查询条件

Raises:

  • (KeyError)

    缺少 name 或 hostid 时抛出



33
34
35
36
# File 'lib/zabbix_manager/classes/httptests.rb', line 33

def identity_filter(data)
  attributes = data.deep_symbolize_keys
  { name: attributes.fetch(:name), hostid: attributes.fetch(:hostid) }
end

#method_nameString

返回 Web 场景对象对应的 Zabbix API 方法前缀。

Returns:

  • (String)


8
9
10
# File 'lib/zabbix_manager/classes/httptests.rb', line 8

def method_name
  "httptest"
end