Class: ZabbixManager::Scripts

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

Instance Method Summary collapse

Methods inherited from Basic

#add, #all, #create, #create_or_update, #default_options, #delete, #destroy, #dump_by_id, #get, #get_full_data, #get_id, #get_ids, #get_ids_by_identify, #get_key_ids, #get_key_ids_by_identify, #get_or_create, #get_or_create_keys, #get_raw, #hash_equals?, #initialize, #key, #keys, #log, #merge_hashes, #normalize_array, #normalize_hash, #parse_keys, #request_raw, #symbolize_keys, #update

Constructor Details

This class inherits a constructor from ZabbixManager::Basic

Instance Method Details

#execute(data) ⇒ Object

执行 Zabbix API 中特定主机上的脚本

示例:

execute({ scriptid: '12', hostid: '32' })


19
20
21
22
23
24
25
26
27
# File 'lib/zabbix_manager/classes/scripts.rb', line 19

def execute(data)
  @client.api_request(
    method: "script.execute",
    params: {
      scriptid: data[:scriptid],
      hostid: data[:hostid]
    }
  )
end

#get_scripts_by_host(data) ⇒ Object

使用 Zabbix API 通过主机获取脚本



30
31
32
# File 'lib/zabbix_manager/classes/scripts.rb', line 30

def get_scripts_by_host(data)
  @client.api_request(method: "script.getscriptsbyhosts", params: data)
end

#identifyObject

用于通过 Zabbix API 标识特定脚本对象的 ID 字段名称



11
12
13
# File 'lib/zabbix_manager/classes/scripts.rb', line 11

def identify
  "name"
end

#method_nameObject

与 Zabbix API 交互的方法名称



6
7
8
# File 'lib/zabbix_manager/classes/scripts.rb', line 6

def method_name
  "script"
end