Class: Zabbix::Trigger
Instance Attribute Summary collapse
-
#parent ⇒ Object
Returns the value of attribute parent.
Attributes inherited from API
#event, #server, #token, #trigger, #user, #verbose, #whoami
Instance Method Summary collapse
- #call_api(message) ⇒ Object
-
#get(options = {}) ⇒ Object
General trigger.get.
-
#get_active(min_severity = 2, maint = 0, lastack = 0, priority_list = '') ⇒ Object
Get a hash of all unresolved problem triggers.
-
#initialize(parent) ⇒ Trigger
constructor
A new instance of Trigger.
Constructor Details
#initialize(parent) ⇒ Trigger
Returns a new instance of Trigger.
6 7 8 9 |
# File 'lib/zmonitor/api/trigger.rb', line 6 def initialize(parent) @parent = parent @verbose = @parent.verbose end |
Instance Attribute Details
#parent ⇒ Object
Returns the value of attribute parent.
5 6 7 |
# File 'lib/zmonitor/api/trigger.rb', line 5 def parent @parent end |
Instance Method Details
#call_api(message) ⇒ Object
10 11 12 |
# File 'lib/zmonitor/api/trigger.rb', line 10 def call_api() return @parent.call_api() end |
#get(options = {}) ⇒ Object
General trigger.get
14 15 16 17 |
# File 'lib/zmonitor/api/trigger.rb', line 14 def get( = {} ) request = { 'method' => 'trigger.get', 'params' => } return call_api(request) end |
#get_active(min_severity = 2, maint = 0, lastack = 0, priority_list = '') ⇒ Object
Get a hash of all unresolved problem triggers
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/zmonitor/api/trigger.rb', line 19 def get_active( min_severity = 2, maint = 0, lastack = 0, priority_list = '' ) request = { 'method' => 'trigger.get', 'params' => { 'sortfield' => 'priority,lastchange', 'sortorder' => 'desc', 'templated' => '0', 'filter' => { 'value' => '1', 'status' => '0' }, 'expandData' => 'host', 'expandDescription' => '1', 'select_hosts' => 'extend', 'select_items' => 'extend', 'output' => 'extend' } } request['params']['maintenance'] = 0 if maint == 1 request['params']['withLastEventUnacknowledged'] = 1 if lastack == 1 if priority_list == '' request['params']['min_severity'] = min_severity.to_s else request['params']['filter']['priority'] = priority_list.split(",") end return call_api(request) end |