Class: ZabbixManager::HttpTests
- Defined in:
- lib/zabbix_manager/classes/httptests.rb
Instance Method Summary collapse
-
#create_or_update(data) ⇒ Integer, ...
Create or update HttpTest object using Zabbix API.
-
#default_options ⇒ Hash
The default options used when creating HttpTest objects via Zabbix API.
-
#get_or_create(data) ⇒ Integer
Get or Create HttpTest object using Zabbix API.
-
#identify ⇒ String
The id field name used for identifying specific HttpTest objects via Zabbix API.
-
#method_name ⇒ String
The method name used for interacting with HttpTests via Zabbix API.
Methods inherited from Basic
#add, #all, #create, #delete, #destroy, #dump_by_id, #get, #get_full_data, #get_id, #get_key_ids, #get_key_ids_by_identify, #get_or_create_keys, #get_raw, #hash_equals?, #initialize, #key, #keys, #log, #merge_params, #normalize_array, #normalize_hash, #parse_keys, #symbolize_keys, #update
Constructor Details
This class inherits a constructor from ZabbixManager::Basic
Instance Method Details
#create_or_update(data) ⇒ Integer, ...
Create or update HttpTest object using Zabbix API
51 52 53 54 |
# File 'lib/zabbix_manager/classes/httptests.rb', line 51 def create_or_update(data) httptestid = get_id(name: data[:name], hostid: data[:hostid]) httptestid ? update(data.merge(httptestid: httptestid)) : create(data) end |
#default_options ⇒ Hash
The default options used when creating HttpTest objects via Zabbix API
22 23 24 25 26 27 28 |
# File 'lib/zabbix_manager/classes/httptests.rb', line 22 def { hostid: nil, name: nil, steps: [] } end |
#get_or_create(data) ⇒ Integer
Get or Create HttpTest object using Zabbix API
36 37 38 39 40 41 42 43 |
# File 'lib/zabbix_manager/classes/httptests.rb', line 36 def get_or_create(data) log "[DEBUG] Call get_or_create with parameters: #{data.inspect}" unless (id = get_id(name: data[:name], hostid: data[:hostid])) id = create(data) end id end |
#identify ⇒ String
The id field name used for identifying specific HttpTest objects via Zabbix API
15 16 17 |
# File 'lib/zabbix_manager/classes/httptests.rb', line 15 def identify "name" end |
#method_name ⇒ String
The method name used for interacting with HttpTests via Zabbix API
8 9 10 |
# File 'lib/zabbix_manager/classes/httptests.rb', line 8 def method_name "httptest" end |