Class: Zabbix::Event
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
-
#acknowledge(events = [], message = "#{@parent.whoami} is working on this.") ⇒ Object
Mark an event acknowledged and leave a message.
- #call_api(message) ⇒ Object
-
#get(options = {}) ⇒ Object
General event.get.
-
#get_last_by_trigger(triggerid = '') ⇒ Object
Get the most recent event’s information for a particular trigger.
-
#initialize(parent) ⇒ Event
constructor
A new instance of Event.
Constructor Details
#initialize(parent) ⇒ Event
Returns a new instance of Event.
6 7 8 9 |
# File 'lib/zmonitor/api/event.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/event.rb', line 5 def parent @parent end |
Instance Method Details
#acknowledge(events = [], message = "#{@parent.whoami} is working on this.") ⇒ Object
Mark an event acknowledged and leave a message
34 35 36 37 |
# File 'lib/zmonitor/api/event.rb', line 34 def acknowledge( events = [], = "#{@parent.whoami} is working on this." ) request = { 'method' => 'event.acknowledge', 'params' => { 'eventids' => events, 'message' => } } call_api(request) end |
#call_api(message) ⇒ Object
10 11 12 |
# File 'lib/zmonitor/api/event.rb', line 10 def call_api() return @parent.call_api() end |
#get(options = {}) ⇒ Object
General event.get
14 15 16 17 |
# File 'lib/zmonitor/api/event.rb', line 14 def get( = {} ) request = { 'method' => 'event.get', 'params' => } return call_api(request) end |
#get_last_by_trigger(triggerid = '') ⇒ Object
Get the most recent event’s information for a particular trigger
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/zmonitor/api/event.rb', line 19 def get_last_by_trigger( triggerid = '' ) request = { 'method' => 'event.get', 'params' => { 'triggerids' => [triggerid.to_s], 'sortfield' => 'clock', 'sortorder' => 'DESC', 'limit' => '1', 'output' => 'extend' } } return call_api(request)[0] end |