Class: Zabbix::V3

Inherits:
Integration
  • Object
show all
Defined in:
app/models/pager_tree/integrations/zabbix/v3.rb

Constant Summary collapse

OPTIONS =
[
  {key: :map_urgency, type: :boolean, default: false}
]

Instance Method Summary collapse

Instance Method Details

#adapter_actionObject



30
31
32
33
34
35
36
37
# File 'app/models/pager_tree/integrations/zabbix/v3.rb', line 30

def adapter_action
  case adapter_incoming_request_params.dig("event_value")
  when "{EVENT.VALUE}" then :create # testing scenario
  when "1" then :create
  when "0" then :resolve
  else :other
  end
end

#adapter_incoming_can_defer?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'app/models/pager_tree/integrations/zabbix/v3.rb', line 22

def adapter_incoming_can_defer?
  true
end

#adapter_process_createObject



39
40
41
42
43
44
45
46
47
48
49
# File 'app/models/pager_tree/integrations/zabbix/v3.rb', line 39

def adapter_process_create
  Alert.new(
    title: _title,
    description: _description,
    urgency: _urgency,
    thirdparty_id: adapter_thirdparty_id,
    dedup_keys: [],
    tags: _tags,
    additional_data: _additional_datums
  )
end

#adapter_supports_incoming?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'app/models/pager_tree/integrations/zabbix/v3.rb', line 14

def adapter_supports_incoming?
  true
end

#adapter_supports_outgoing?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'app/models/pager_tree/integrations/zabbix/v3.rb', line 18

def adapter_supports_outgoing?
  false
end

#adapter_thirdparty_idObject



26
27
28
# File 'app/models/pager_tree/integrations/zabbix/v3.rb', line 26

def adapter_thirdparty_id
  adapter_incoming_request_params.dig("trigger_id").presence || adapter_incoming_request_params.dig("event_id").presence || ULID.generate
end