pager_tree-integrations 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/pager_tree/integrations/alert.rb +3 -1
- data/app/models/pager_tree/integrations/app_dynamics/v3.rb +74 -0
- data/app/models/pager_tree/integrations/auvik/v3.rb +94 -0
- data/app/models/pager_tree/integrations/aws_cloudwatch/v3.rb +108 -0
- data/app/models/pager_tree/integrations/azure_monitor/v3.rb +79 -0
- data/app/models/pager_tree/integrations/boolean_store_accessor.rb +42 -0
- data/app/models/pager_tree/integrations/channel/hangouts/v3.rb +176 -0
- data/app/models/pager_tree/integrations/channel/mattermost/v3.rb +6 -0
- data/app/models/pager_tree/integrations/channel/microsoft_teams/v3.rb +142 -0
- data/app/models/pager_tree/integrations/channel/slack/v3.rb +136 -0
- data/app/models/pager_tree/integrations/cronitor/v3.rb +64 -0
- data/app/models/pager_tree/integrations/datadog/v3.rb +72 -0
- data/app/models/pager_tree/integrations/dead_mans_snitch/v3.rb +76 -0
- data/app/models/pager_tree/integrations/elast_alert/v3.rb +63 -0
- data/app/models/pager_tree/integrations/form/v3.rb +114 -0
- data/app/models/pager_tree/integrations/freshdesk/v3.rb +103 -0
- data/app/models/pager_tree/integrations/freshservice/v3.rb +103 -0
- data/app/models/pager_tree/integrations/grafana/v3.rb +67 -0
- data/app/models/pager_tree/integrations/healthchecks/v3.rb +68 -0
- data/app/models/pager_tree/integrations/honeybadger/v3.rb +76 -0
- data/app/models/pager_tree/integrations/hyperping/v3.rb +60 -0
- data/app/models/pager_tree/integrations/integration.rb +27 -5
- data/app/models/pager_tree/integrations/jira_server/v3.rb +61 -0
- data/app/models/pager_tree/integrations/jotform/v3.rb +50 -0
- data/app/models/pager_tree/integrations/kapacitor/v3.rb +65 -0
- data/app/models/pager_tree/integrations/logic_monitor/v3.rb +79 -0
- data/app/models/pager_tree/integrations/mattermost/outgoing_webhook/v3.rb +77 -0
- data/app/models/pager_tree/integrations/new_relic/v3.rb +67 -0
- data/app/models/pager_tree/integrations/outgoing_event.rb +2 -0
- data/app/models/pager_tree/integrations/outgoing_webhook/v3.rb +37 -6
- data/app/models/pager_tree/integrations/outgoing_webhook_delivery/hook_relay.rb +8 -6
- data/app/models/pager_tree/integrations/outgoing_webhook_delivery.rb +1 -1
- data/app/models/pager_tree/integrations/pingdom/v3.rb +71 -0
- data/app/models/pager_tree/integrations/prometheus/v3.rb +79 -0
- data/app/models/pager_tree/integrations/prtg/v3.rb +58 -0
- data/app/models/pager_tree/integrations/server_guard24/v3.rb +74 -0
- data/app/models/pager_tree/integrations/site24x7/v3.rb +68 -0
- data/app/models/pager_tree/integrations/solar_winds/v3.rb +77 -0
- data/app/models/pager_tree/integrations/stackdriver/v3.rb +60 -0
- data/app/models/pager_tree/integrations/status_cake/v3.rb +65 -0
- data/app/models/pager_tree/integrations/twilio/incoming_sms/v3.rb +78 -0
- data/app/models/pager_tree/integrations/typeform/v3.rb +43 -0
- data/app/models/pager_tree/integrations/uptime/v3.rb +68 -0
- data/app/models/pager_tree/integrations/uptime_robot/v3.rb +79 -0
- data/app/models/pager_tree/integrations/webhook/v3.rb +112 -0
- data/app/models/pager_tree/integrations/zendesk/v3.rb +83 -0
- data/app/views/pager_tree/integrations/app_dynamics/v3/_form_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/app_dynamics/v3/_show_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/auvik/v3/_form_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/auvik/v3/_show_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/aws_cloudwatch/v3/_form_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/aws_cloudwatch/v3/_show_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/azure_monitor/v3/_form_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/azure_monitor/v3/_show_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/channel/hangouts/v3/_form_options.html.erb +34 -0
- data/app/views/pager_tree/integrations/channel/hangouts/v3/_show_options.html.erb +40 -0
- data/app/views/pager_tree/integrations/channel/mattermost/v3/_form_options.html.erb +1 -0
- data/app/views/pager_tree/integrations/channel/mattermost/v3/_show_options.html.erb +1 -0
- data/app/views/pager_tree/integrations/channel/microsoft_teams/v3/_form_options.html.erb +34 -0
- data/app/views/pager_tree/integrations/channel/microsoft_teams/v3/_show_options.html.erb +40 -0
- data/app/views/pager_tree/integrations/channel/slack/v3/_form_options.html.erb +34 -0
- data/app/views/pager_tree/integrations/channel/slack/v3/_show_options.html.erb +40 -0
- data/app/views/pager_tree/integrations/cronitor/v3/_form_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/cronitor/v3/_show_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/datadog/v3/_form_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/datadog/v3/_show_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/dead_mans_snitch/v3/_form_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/dead_mans_snitch/v3/_show_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/elast_alert/v3/_form_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/elast_alert/v3/_show_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/form/v3/_form_options.html.erb +64 -0
- data/app/views/pager_tree/integrations/form/v3/_show_options.html.erb +122 -0
- data/app/views/pager_tree/integrations/freshdesk/v3/_form_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/freshdesk/v3/_show_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/freshservice/v3/_form_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/freshservice/v3/_show_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/grafana/v3/_form_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/grafana/v3/_show_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/healthchecks/v3/_form_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/healthchecks/v3/_show_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/honeybadger/v3/_form_options.html.erb +7 -0
- data/app/views/pager_tree/integrations/honeybadger/v3/_show_options.html.erb +12 -0
- data/app/views/pager_tree/integrations/hyperping/v3/_form_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/hyperping/v3/_show_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/jira_server/v3/_form_options.html.erb +7 -0
- data/app/views/pager_tree/integrations/jira_server/v3/_show_options.html.erb +12 -0
- data/app/views/pager_tree/integrations/jotform/v3/_form_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/jotform/v3/_show_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/kapacitor/v3/_form_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/kapacitor/v3/_show_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/logic_monitor/v3/_form_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/logic_monitor/v3/_show_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/mattermost/outgoing_webhook/v3/_form_options.html.erb +7 -0
- data/app/views/pager_tree/integrations/mattermost/outgoing_webhook/v3/_show_options.html.erb +12 -0
- data/app/views/pager_tree/integrations/new_relic/v3/_form_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/new_relic/v3/_show_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/outgoing_webhook/v3/_form_options.html.erb +12 -4
- data/app/views/pager_tree/integrations/outgoing_webhook/v3/_show_options.html.erb +20 -2
- data/app/views/pager_tree/integrations/pingdom/v3/_form_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/pingdom/v3/_show_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/prometheus/v3/_form_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/prometheus/v3/_show_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/prtg/v3/_form_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/prtg/v3/_show_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/server_guard24/v3/_form_options.html.erb +7 -0
- data/app/views/pager_tree/integrations/server_guard24/v3/_show_options.html.erb +12 -0
- data/app/views/pager_tree/integrations/site24x7/v3/_form_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/site24x7/v3/_show_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/solar_winds/v3/_form_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/solar_winds/v3/_show_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/stackdriver/v3/_form_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/stackdriver/v3/_show_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/status_cake/v3/_form_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/status_cake/v3/_show_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/twilio/incoming_sms/v3/_form_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/twilio/incoming_sms/v3/_show_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/typeform/v3/_form_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/typeform/v3/_show_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/uptime/v3/_form_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/uptime/v3/_show_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/uptime_robot/v3/_form_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/uptime_robot/v3/_show_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/webhook/v3/_form_options.html.erb +15 -0
- data/app/views/pager_tree/integrations/webhook/v3/_show_options.html.erb +26 -0
- data/app/views/pager_tree/integrations/zendesk/v3/_form_options.html.erb +0 -0
- data/app/views/pager_tree/integrations/zendesk/v3/_show_options.html.erb +0 -0
- data/config/locales/en.yml +83 -23
- data/lib/generators/integration/integration_generator.rb +2 -1
- data/lib/generators/integration/templates/model.rb.tt +16 -6
- data/lib/pager_tree/integrations/version.rb +1 -1
- metadata +121 -3
@@ -0,0 +1,74 @@
|
|
1
|
+
module PagerTree::Integrations
|
2
|
+
class ServerGuard24::V3 < Integration
|
3
|
+
OPTIONS = [
|
4
|
+
{key: :resolve_warn, type: :boolean, default: false}
|
5
|
+
]
|
6
|
+
store_accessor :options, *OPTIONS.map { |x| x[:key] }.map(&:to_s), prefix: "option"
|
7
|
+
|
8
|
+
validates :option_resolve_warn, inclusion: {in: [true, false]}
|
9
|
+
|
10
|
+
after_initialize do
|
11
|
+
self.option_resolve_warn ||= false
|
12
|
+
end
|
13
|
+
|
14
|
+
def adapter_supports_incoming?
|
15
|
+
true
|
16
|
+
end
|
17
|
+
|
18
|
+
def adapter_supports_outgoing?
|
19
|
+
false
|
20
|
+
end
|
21
|
+
|
22
|
+
def adapter_incoming_can_defer?
|
23
|
+
true
|
24
|
+
end
|
25
|
+
|
26
|
+
def adapter_thirdparty_id
|
27
|
+
[adapter_incoming_request_params.dig("server_name"), adapter_incoming_request_params.dig("service_shortname")].compact_blank.join("_")
|
28
|
+
end
|
29
|
+
|
30
|
+
def adapter_action
|
31
|
+
check_result = adapter_incoming_request_params.dig("check_result")
|
32
|
+
|
33
|
+
if check_result == "CRITICAL"
|
34
|
+
:create
|
35
|
+
elsif check_result == "OK" || (check_result == "WARNING" && self.option_resolve_warn == true)
|
36
|
+
:resolve
|
37
|
+
else
|
38
|
+
:other
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def adapter_process_create
|
43
|
+
Alert.new(
|
44
|
+
title: _title,
|
45
|
+
description: _description,
|
46
|
+
thirdparty_id: adapter_thirdparty_id,
|
47
|
+
dedup_keys: [adapter_thirdparty_id],
|
48
|
+
additional_data: _additional_datums
|
49
|
+
)
|
50
|
+
end
|
51
|
+
|
52
|
+
private
|
53
|
+
|
54
|
+
def _title
|
55
|
+
"#{adapter_incoming_request_params.dig("server_name")} is DOWN"
|
56
|
+
end
|
57
|
+
|
58
|
+
def _description
|
59
|
+
"#{adapter_incoming_request_params.dig("server_name")} is DOWN because #{adapter_incoming_request_params.dig("check_output")}"
|
60
|
+
end
|
61
|
+
|
62
|
+
def _additional_datums
|
63
|
+
[
|
64
|
+
AdditionalDatum.new(format: "text", label: "Server Name", value: adapter_incoming_request_params.dig("server_name")),
|
65
|
+
AdditionalDatum.new(format: "text", label: "Server Address", value: adapter_incoming_request_params.dig("server_address")),
|
66
|
+
AdditionalDatum.new(format: "text", label: "Service Name", value: adapter_incoming_request_params.dig("service_name")),
|
67
|
+
AdditionalDatum.new(format: "text", label: "Service Short Name", value: adapter_incoming_request_params.dig("service_shortname")),
|
68
|
+
AdditionalDatum.new(format: "datetime", label: "Notification Time", value: adapter_incoming_request_params.dig("notification_time")),
|
69
|
+
AdditionalDatum.new(format: "text", label: "Check Result", value: adapter_incoming_request_params.dig("check_result")),
|
70
|
+
AdditionalDatum.new(format: "text", label: "Check Output", value: adapter_incoming_request_params.dig("check_output"))
|
71
|
+
]
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
module PagerTree::Integrations
|
2
|
+
class Site24x7::V3 < Integration
|
3
|
+
OPTIONS = []
|
4
|
+
store_accessor :options, *OPTIONS.map { |x| x[:key] }.map(&:to_s), prefix: "option"
|
5
|
+
|
6
|
+
after_initialize do
|
7
|
+
end
|
8
|
+
|
9
|
+
def adapter_supports_incoming?
|
10
|
+
true
|
11
|
+
end
|
12
|
+
|
13
|
+
def adapter_supports_outgoing?
|
14
|
+
false
|
15
|
+
end
|
16
|
+
|
17
|
+
def adapter_incoming_can_defer?
|
18
|
+
true
|
19
|
+
end
|
20
|
+
|
21
|
+
def adapter_thirdparty_id
|
22
|
+
adapter_incoming_request_params.dig("MONITOR_ID")
|
23
|
+
end
|
24
|
+
|
25
|
+
def adapter_action
|
26
|
+
case adapter_incoming_request_params.dig("STATUS")
|
27
|
+
when "DOWN"
|
28
|
+
:create
|
29
|
+
when "UP"
|
30
|
+
:resolve
|
31
|
+
else
|
32
|
+
:other
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def adapter_process_create
|
37
|
+
Alert.new(
|
38
|
+
title: _title,
|
39
|
+
description: _description,
|
40
|
+
thirdparty_id: adapter_thirdparty_id,
|
41
|
+
dedup_keys: [adapter_thirdparty_id],
|
42
|
+
additional_data: _additional_datums
|
43
|
+
)
|
44
|
+
end
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
def _title
|
49
|
+
"#{adapter_incoming_request_params.dig("MONITORNAME")} is DOWN"
|
50
|
+
end
|
51
|
+
|
52
|
+
def _description
|
53
|
+
"#{adapter_incoming_request_params.dig("MONITORNAME")} is DOWN because #{adapter_incoming_request_params.dig("INCIDENT_REASON")}"
|
54
|
+
end
|
55
|
+
|
56
|
+
def _additional_datums
|
57
|
+
[
|
58
|
+
AdditionalDatum.new(format: "link", label: "Site 24x7 Dashboard URL", value: adapter_incoming_request_params.dig("MONITOR_DASHBOARD_LINK")),
|
59
|
+
AdditionalDatum.new(format: "text", label: "Monitor Name", value: adapter_incoming_request_params.dig("MONITORNAME")),
|
60
|
+
AdditionalDatum.new(format: "link", label: "Monitor URL", value: adapter_incoming_request_params.dig("MONITORURL")),
|
61
|
+
AdditionalDatum.new(format: "text", label: "Group Name", value: adapter_incoming_request_params.dig("MONITOR_GROUPNAME")),
|
62
|
+
AdditionalDatum.new(format: "text", label: "Reason", value: adapter_incoming_request_params.dig("INCIDENT_REASON")),
|
63
|
+
AdditionalDatum.new(format: "text", label: "Failed Locations", value: adapter_incoming_request_params.dig("FAILED_LOCATIONS")),
|
64
|
+
AdditionalDatum.new(format: "datetime", label: "Failed At", value: adapter_incoming_request_params.dig("INCIDENT_TIME_ISO"))
|
65
|
+
]
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
module PagerTree::Integrations
|
2
|
+
class SolarWinds::V3 < Integration
|
3
|
+
OPTIONS = []
|
4
|
+
store_accessor :options, *OPTIONS.map { |x| x[:key] }.map(&:to_s), prefix: "option"
|
5
|
+
|
6
|
+
after_initialize do
|
7
|
+
end
|
8
|
+
|
9
|
+
def adapter_supports_incoming?
|
10
|
+
true
|
11
|
+
end
|
12
|
+
|
13
|
+
def adapter_supports_outgoing?
|
14
|
+
false
|
15
|
+
end
|
16
|
+
|
17
|
+
def adapter_incoming_can_defer?
|
18
|
+
true
|
19
|
+
end
|
20
|
+
|
21
|
+
def adapter_thirdparty_id
|
22
|
+
adapter_incoming_request_params.dig("AlertID")
|
23
|
+
end
|
24
|
+
|
25
|
+
def adapter_action
|
26
|
+
case adapter_incoming_request_params.dig("ActionType").to_s.downcase
|
27
|
+
when "create"
|
28
|
+
:create
|
29
|
+
when "resolve"
|
30
|
+
:resolve
|
31
|
+
else
|
32
|
+
:other
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def adapter_process_create
|
37
|
+
Alert.new(
|
38
|
+
title: _title,
|
39
|
+
description: _description,
|
40
|
+
urgency: _urgency,
|
41
|
+
thirdparty_id: adapter_thirdparty_id,
|
42
|
+
dedup_keys: [adapter_thirdparty_id],
|
43
|
+
additional_data: _additional_datums
|
44
|
+
)
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
def _title
|
50
|
+
adapter_incoming_request_params.dig("AlertMessage")
|
51
|
+
end
|
52
|
+
|
53
|
+
def _description
|
54
|
+
adapter_incoming_request_params.dig("AlertDescription")
|
55
|
+
end
|
56
|
+
|
57
|
+
def _urgency
|
58
|
+
case adapter_incoming_request_params.dig(:severity).to_s.downcase
|
59
|
+
when "notice", "informational"
|
60
|
+
"low"
|
61
|
+
when "warning"
|
62
|
+
"medium"
|
63
|
+
when "serious"
|
64
|
+
"high"
|
65
|
+
when "critical"
|
66
|
+
"critical"
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def _additional_datums
|
71
|
+
[
|
72
|
+
AdditionalDatum.new(format: "link", label: "Alert Details URL", value: adapter_incoming_request_params.dig("AlertDetailsURL")),
|
73
|
+
AdditionalDatum.new(format: "text", label: "Node", value: adapter_incoming_request_params.dig("NodeName"))
|
74
|
+
]
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module PagerTree::Integrations
|
2
|
+
class Stackdriver::V3 < Integration
|
3
|
+
OPTIONS = []
|
4
|
+
store_accessor :options, *OPTIONS.map { |x| x[:key] }.map(&:to_s), prefix: "option"
|
5
|
+
|
6
|
+
after_initialize do
|
7
|
+
end
|
8
|
+
|
9
|
+
def adapter_supports_incoming?
|
10
|
+
true
|
11
|
+
end
|
12
|
+
|
13
|
+
def adapter_supports_outgoing?
|
14
|
+
false
|
15
|
+
end
|
16
|
+
|
17
|
+
def adapter_incoming_can_defer?
|
18
|
+
true
|
19
|
+
end
|
20
|
+
|
21
|
+
def adapter_thirdparty_id
|
22
|
+
adapter_incoming_request_params.dig("incident", "incident_id")
|
23
|
+
end
|
24
|
+
|
25
|
+
def adapter_action
|
26
|
+
case adapter_incoming_request_params.dig("incident", "state")
|
27
|
+
when "open"
|
28
|
+
:create
|
29
|
+
when "closed"
|
30
|
+
:resolve
|
31
|
+
else
|
32
|
+
:other
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def adapter_process_create
|
37
|
+
Alert.new(
|
38
|
+
title: _title,
|
39
|
+
thirdparty_id: adapter_thirdparty_id,
|
40
|
+
dedup_keys: [adapter_thirdparty_id],
|
41
|
+
additional_data: _additional_datums
|
42
|
+
)
|
43
|
+
end
|
44
|
+
|
45
|
+
private
|
46
|
+
|
47
|
+
def _title
|
48
|
+
adapter_incoming_request_params.dig("incident", "summary")
|
49
|
+
end
|
50
|
+
|
51
|
+
def _additional_datums
|
52
|
+
[
|
53
|
+
AdditionalDatum.new(format: "link", label: "Incident URL", value: adapter_incoming_request_params.dig("incident", "url")),
|
54
|
+
AdditionalDatum.new(format: "text", label: "Policy Name", value: adapter_incoming_request_params.dig("incident", "policy_name")),
|
55
|
+
AdditionalDatum.new(format: "text", label: "Condition Name", value: adapter_incoming_request_params.dig("incident", "condition_name")),
|
56
|
+
AdditionalDatum.new(format: "text", label: "Resource Name", value: adapter_incoming_request_params.dig("incident", "resource_name"))
|
57
|
+
]
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
module PagerTree::Integrations
|
2
|
+
class StatusCake::V3 < Integration
|
3
|
+
OPTIONS = []
|
4
|
+
store_accessor :options, *OPTIONS.map { |x| x[:key] }.map(&:to_s), prefix: "option"
|
5
|
+
|
6
|
+
after_initialize do
|
7
|
+
end
|
8
|
+
|
9
|
+
def adapter_supports_incoming?
|
10
|
+
true
|
11
|
+
end
|
12
|
+
|
13
|
+
def adapter_supports_outgoing?
|
14
|
+
false
|
15
|
+
end
|
16
|
+
|
17
|
+
def adapter_incoming_can_defer?
|
18
|
+
true
|
19
|
+
end
|
20
|
+
|
21
|
+
def adapter_thirdparty_id
|
22
|
+
adapter_incoming_request_params.dig("URL")
|
23
|
+
end
|
24
|
+
|
25
|
+
def adapter_action
|
26
|
+
case adapter_incoming_request_params.dig("Status").to_s.downcase
|
27
|
+
when "down"
|
28
|
+
:create
|
29
|
+
when "up"
|
30
|
+
:resolve
|
31
|
+
else
|
32
|
+
:other
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def adapter_process_create
|
37
|
+
Alert.new(
|
38
|
+
title: _title,
|
39
|
+
thirdparty_id: adapter_thirdparty_id,
|
40
|
+
dedup_keys: [adapter_thirdparty_id],
|
41
|
+
additional_data: _additional_datums,
|
42
|
+
tags: _tags
|
43
|
+
)
|
44
|
+
end
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
def _title
|
49
|
+
"#{adapter_incoming_request_params.dig("Name")} is down"
|
50
|
+
end
|
51
|
+
|
52
|
+
def _additional_datums
|
53
|
+
[
|
54
|
+
AdditionalDatum.new(format: "link", label: "URL", value: adapter_incoming_request_params.dig("URL")),
|
55
|
+
AdditionalDatum.new(format: "text", label: "Status Code", value: adapter_incoming_request_params.dig("StatusCode")),
|
56
|
+
AdditionalDatum.new(format: "text", label: "IP", value: adapter_incoming_request_params.dig("IP")),
|
57
|
+
AdditionalDatum.new(format: "text", label: "Check Rate", value: adapter_incoming_request_params.dig("Check Rate"))
|
58
|
+
]
|
59
|
+
end
|
60
|
+
|
61
|
+
def _tags
|
62
|
+
adapter_incoming_request_params.dig("Tags").to_s.split(",").map(&:strip).uniq
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
module PagerTree::Integrations
|
2
|
+
class Twilio::IncomingSms::V3 < Integration
|
3
|
+
OPTIONS = []
|
4
|
+
store_accessor :options, *OPTIONS.map { |x| x[:key] }.map(&:to_s), prefix: "option"
|
5
|
+
|
6
|
+
after_initialize do
|
7
|
+
end
|
8
|
+
|
9
|
+
def adapter_supports_incoming?
|
10
|
+
true
|
11
|
+
end
|
12
|
+
|
13
|
+
def adapter_supports_outgoing?
|
14
|
+
false
|
15
|
+
end
|
16
|
+
|
17
|
+
def adapter_incoming_can_defer?
|
18
|
+
true
|
19
|
+
end
|
20
|
+
|
21
|
+
def adapter_thirdparty_id
|
22
|
+
adapter_incoming_request_params.dig("MessageSid")
|
23
|
+
end
|
24
|
+
|
25
|
+
def adapter_action
|
26
|
+
:create
|
27
|
+
end
|
28
|
+
|
29
|
+
def adapter_process_create
|
30
|
+
Alert.new(
|
31
|
+
title: _title,
|
32
|
+
description: _description,
|
33
|
+
thirdparty_id: adapter_thirdparty_id,
|
34
|
+
dedup_keys: [adapter_thirdparty_id],
|
35
|
+
additional_data: _additional_datums
|
36
|
+
)
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def _title
|
42
|
+
"Incoming SMS from #{adapter_incoming_request_params.dig("From")} - See description for details"
|
43
|
+
end
|
44
|
+
|
45
|
+
def _description
|
46
|
+
adapter_incoming_request_params.dig("Body")
|
47
|
+
end
|
48
|
+
|
49
|
+
def _additional_datums
|
50
|
+
datums = [
|
51
|
+
AdditionalDatum.new(format: "link", label: "Twilio URL", value: "https://www.twilio.com/console/sms/logs/#{adapter_incoming_request_params.dig("MessageSid")}"),
|
52
|
+
AdditionalDatum.new(format: "text", label: "Account SID", value: adapter_incoming_request_params.dig("AccountSid")),
|
53
|
+
AdditionalDatum.new(format: "text", label: "Message SID", value: adapter_incoming_request_params.dig("MessageSid")),
|
54
|
+
AdditionalDatum.new(format: "phone", label: "To", value: adapter_incoming_request_params.dig("To")),
|
55
|
+
AdditionalDatum.new(format: "phone", label: "From", value: adapter_incoming_request_params.dig("From")),
|
56
|
+
AdditionalDatum.new(format: "text", label: "From Country", value: adapter_incoming_request_params.dig("FromCountry")),
|
57
|
+
AdditionalDatum.new(format: "text", label: "From State", value: adapter_incoming_request_params.dig("FromState")),
|
58
|
+
AdditionalDatum.new(format: "text", label: "From City", value: adapter_incoming_request_params.dig("FromCity")),
|
59
|
+
AdditionalDatum.new(format: "text", label: "From Zip", value: adapter_incoming_request_params.dig("FromZip"))
|
60
|
+
]
|
61
|
+
|
62
|
+
num_media = adapter_incoming_request_params.dig("NumMedia").to_i
|
63
|
+
index = 0
|
64
|
+
|
65
|
+
while index < num_media
|
66
|
+
media_content_type = adapter_incoming_request_params.dig("MediaContentType#{index}")
|
67
|
+
datums.push(AdditionalDatum.new(
|
68
|
+
format: media_content_type.starts_with?("im") ? "img" : "link",
|
69
|
+
label: "Media ##{index + 1}",
|
70
|
+
value: adapter_incoming_request_params.dig("MediaUrl#{index}")
|
71
|
+
))
|
72
|
+
index += 1
|
73
|
+
end
|
74
|
+
|
75
|
+
datums
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module PagerTree::Integrations
|
2
|
+
class Typeform::V3 < Integration
|
3
|
+
OPTIONS = []
|
4
|
+
store_accessor :options, *OPTIONS.map { |x| x[:key] }.map(&:to_s), prefix: "option"
|
5
|
+
|
6
|
+
after_initialize do
|
7
|
+
end
|
8
|
+
|
9
|
+
def adapter_supports_incoming?
|
10
|
+
true
|
11
|
+
end
|
12
|
+
|
13
|
+
def adapter_supports_outgoing?
|
14
|
+
false
|
15
|
+
end
|
16
|
+
|
17
|
+
def adapter_incoming_can_defer?
|
18
|
+
true
|
19
|
+
end
|
20
|
+
|
21
|
+
def adapter_thirdparty_id
|
22
|
+
adapter_incoming_request_params.dig("form_response", "token")
|
23
|
+
end
|
24
|
+
|
25
|
+
def adapter_action
|
26
|
+
:create
|
27
|
+
end
|
28
|
+
|
29
|
+
def adapter_process_create
|
30
|
+
Alert.new(
|
31
|
+
title: _title,
|
32
|
+
thirdparty_id: adapter_thirdparty_id,
|
33
|
+
dedup_keys: [adapter_thirdparty_id]
|
34
|
+
)
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def _title
|
40
|
+
[adapter_incoming_request_params.dig("form_response", "definition", "title"), adapter_incoming_request_params.dig("form_response", "submitted_at")].compact_blank.join(": ")
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
module PagerTree::Integrations
|
2
|
+
class Uptime::V3 < Integration
|
3
|
+
OPTIONS = []
|
4
|
+
store_accessor :options, *OPTIONS.map { |x| x[:key] }.map(&:to_s), prefix: "option"
|
5
|
+
|
6
|
+
after_initialize do
|
7
|
+
end
|
8
|
+
|
9
|
+
def adapter_supports_incoming?
|
10
|
+
true
|
11
|
+
end
|
12
|
+
|
13
|
+
def adapter_supports_outgoing?
|
14
|
+
false
|
15
|
+
end
|
16
|
+
|
17
|
+
def adapter_incoming_can_defer?
|
18
|
+
true
|
19
|
+
end
|
20
|
+
|
21
|
+
def adapter_thirdparty_id
|
22
|
+
adapter_incoming_request_params.dig("data", "service", "id")
|
23
|
+
end
|
24
|
+
|
25
|
+
def adapter_action
|
26
|
+
case adapter_incoming_request_params.dig("event")
|
27
|
+
when "alert_raised"
|
28
|
+
:create
|
29
|
+
when "alert_cleared"
|
30
|
+
:resolve
|
31
|
+
else
|
32
|
+
:other
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def adapter_process_create
|
37
|
+
Alert.new(
|
38
|
+
title: _title,
|
39
|
+
description: _description,
|
40
|
+
thirdparty_id: adapter_thirdparty_id,
|
41
|
+
dedup_keys: [adapter_thirdparty_id],
|
42
|
+
additional_data: _additional_datums,
|
43
|
+
tags: _tags
|
44
|
+
)
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
def _title
|
50
|
+
adapter_incoming_request_params.dig("data", "service", "display_name")
|
51
|
+
end
|
52
|
+
|
53
|
+
def _description
|
54
|
+
adapter_incoming_request_params.dig("data", "alert", "output")
|
55
|
+
end
|
56
|
+
|
57
|
+
def _tags
|
58
|
+
Array(adapter_incoming_request_params.dig("data", "service", "tags")).compact_blank.uniq
|
59
|
+
end
|
60
|
+
|
61
|
+
def _additional_datums
|
62
|
+
[
|
63
|
+
AdditionalDatum.new(format: "text", label: "Service Name", value: adapter_incoming_request_params.dig("data", "service", "name")),
|
64
|
+
AdditionalDatum.new(format: "text", label: "Service Address", value: adapter_incoming_request_params.dig("data", "service", "msp_address"))
|
65
|
+
]
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
module PagerTree::Integrations
|
2
|
+
class UptimeRobot::V3 < Integration
|
3
|
+
OPTIONS = []
|
4
|
+
store_accessor :options, *OPTIONS.map { |x| x[:key] }.map(&:to_s), prefix: "option"
|
5
|
+
|
6
|
+
after_initialize do
|
7
|
+
end
|
8
|
+
|
9
|
+
def adapter_supports_incoming?
|
10
|
+
true
|
11
|
+
end
|
12
|
+
|
13
|
+
def adapter_supports_outgoing?
|
14
|
+
false
|
15
|
+
end
|
16
|
+
|
17
|
+
def adapter_incoming_can_defer?
|
18
|
+
true
|
19
|
+
end
|
20
|
+
|
21
|
+
def adapter_thirdparty_id
|
22
|
+
monitor_id = adapter_incoming_request_params.dig("monitorID")
|
23
|
+
|
24
|
+
# LEGACY: We offerred the ability to aggregate for one of our customers
|
25
|
+
# we did this through a groupSeconds parameter. Technically, with our new aggregration
|
26
|
+
# this shouldn't be here, but to support our legacy customers it is.
|
27
|
+
group_seconds = adapter_incoming_request_params.dig("groupSeconds").to_i
|
28
|
+
|
29
|
+
return monitor_id unless group_seconds > 0
|
30
|
+
|
31
|
+
alert_datetime = Time.at(adapter_incoming_request_params.dig("alertDateTime").to_i)
|
32
|
+
|
33
|
+
# return the rounded off time as the id (as so to group them together by id)
|
34
|
+
_round_off(alert_datetime, group_seconds.seconds).to_i
|
35
|
+
end
|
36
|
+
|
37
|
+
def adapter_action
|
38
|
+
case adapter_incoming_request_params.dig("alertTypeFriendlyName").to_s.downcase
|
39
|
+
when "down"
|
40
|
+
:create
|
41
|
+
when "up"
|
42
|
+
:resolve
|
43
|
+
else
|
44
|
+
:other
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def adapter_process_create
|
49
|
+
Alert.new(
|
50
|
+
title: _title,
|
51
|
+
description: _description,
|
52
|
+
thirdparty_id: adapter_thirdparty_id,
|
53
|
+
dedup_keys: [adapter_thirdparty_id],
|
54
|
+
additional_data: _additional_datums
|
55
|
+
)
|
56
|
+
end
|
57
|
+
|
58
|
+
private
|
59
|
+
|
60
|
+
def _title
|
61
|
+
"#{adapter_incoming_request_params.dig("monitorFriendlyName")} is DOWN"
|
62
|
+
end
|
63
|
+
|
64
|
+
def _description
|
65
|
+
"#{adapter_incoming_request_params.dig("monitorFriendlyName")} is DOWN because #{adapter_incoming_request_params.dig("alertDetails")}"
|
66
|
+
end
|
67
|
+
|
68
|
+
def _additional_datums
|
69
|
+
[
|
70
|
+
AdditionalDatum.new(format: "link", label: "Monitor URL", value: adapter_incoming_request_params.dig("monitorURL")),
|
71
|
+
AdditionalDatum.new(format: "datetime", label: "Triggered At", value: Time.at(adapter_incoming_request_params.dig("alertDateTime").to_i).utc.to_datetime)
|
72
|
+
]
|
73
|
+
end
|
74
|
+
|
75
|
+
def _round_off(time, seconds)
|
76
|
+
Time.at((time.to_f / seconds).floor * seconds).utc
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|