1
+ {
2
+ "name" : " nrids_app_<%= service.name %>_<%= environment %>" ,
3
+ "type" : " monitor" ,
4
+ "monitor_type" : " query_level_monitor" ,
5
+ "enabled" : true ,
6
+ "schedule" : {
7
+ "period" : {
8
+ "interval" : 1 ,
9
+ "unit" : " MINUTES"
10
+ }
11
+ },
12
+ "inputs" : [
13
+ {
14
+ "search" : {
15
+ "indices" : [
16
+ " nrm-metrics"
17
+ ],
18
+ "query" : {
19
+ "size" : 0 ,
20
+ "aggregations" : {},
21
+ "query" : {
22
+ "bool" : {
23
+ "must" : [
24
+ {
25
+ "range" : {
26
+ "http.response.status_code" : {
27
+ "gt" : 499
28
+ }
29
+ }
30
+ },
31
+ {
32
+ "term" : {
33
+ "service.environment" : " <%= environment %>"
34
+ }
35
+ },
36
+ {
37
+ "range" : {
38
+ "@timestamp" : {
39
+ "gte" : " now-5m"
40
+ }
41
+ }
42
+ }
43
+ ]
44
+ }
45
+ }
46
+ }
47
+ }
48
+ }
49
+ ],
50
+ "triggers" : [
51
+ {
52
+ "query_level_trigger" : {
53
+ "id" : " <%= idgen('trigger', service.name, environment) %>" ,
54
+ "name" : " <%= service.name %> (<%= environment %>) is responding with http errors" ,
55
+ "severity" : " 1" ,
56
+ "condition" : {
57
+ "script" : {
58
+ "source" : " ctx.results[0].hits.total.value == 0" ,
59
+ "lang" : " painless"
60
+ }
61
+ },
62
+ "actions" : [
63
+ {
64
+ "id" : " <%= idgen('action-teams', service.name, environment) %>" ,
65
+ "name" : " Notify Teams Channel" ,
66
+ "destination_id" : " appinfra-msteams" ,
67
+ "message_template" : {
68
+ "source" : " { \" text\" : \" Monitor {{ctx.monitor.name}} just entered alert status. Please investigate the issue.\n - Trigger: {{ctx.trigger.name}}\n - Severity: {{ctx.trigger.severity}}\n - Period start: {{ctx.periodStart}}\n - Period end: {{ctx.periodEnd}}\" }" ,
69
+ "lang" : " mustache"
70
+ },
71
+ "throttle_enabled" : true ,
72
+ "throttle" : {
73
+ "value" : 10 ,
74
+ "unit" : " MINUTES"
75
+ },
76
+ "subject_template" : {
77
+ "source" : " " ,
78
+ "lang" : " mustache"
79
+ }
80
+ },
81
+ {
82
+ "id" : " <%= idgen('action-sqs', server.name, agent.index) %>" ,
83
+ "name" : " Notify Automation Queue" ,
84
+ "destination_id" : " automation-sqs-sns" ,
85
+ "message_template" : {
86
+ "source" : " { \" type\" : \" agent_down\" , \" server\" : \" <%= server.name %>\" , \" agent\" : \" fluent-bit.<%= agent.index %>\" , \" periodStart\" : \" {{ctx.periodStart}}\" , \" periodEnd\" : \" {{ctx.periodEnd}}\" }" ,
87
+ "lang" : " mustache"
88
+ },
89
+ "throttle_enabled" : true ,
90
+ "throttle" : {
91
+ "value" : 10 ,
92
+ "unit" : " MINUTES"
93
+ },
94
+ "subject_template" : {
95
+ "source" : " Notify" ,
96
+ "lang" : " mustache"
97
+ }
98
+ },
99
+ {
100
+ "$$OMIT" : " <%= !serverTag('wildfire') || !serverTag('nonproduction') ? 'true' : 'false' %>" ,
101
+ "id" : " <%= idgen('action-nonprod-wf', server.name, agent.index) %>" ,
102
+ "name" : " notify" ,
103
+ "destination_id" : " wf-nonprod-msteams" ,
104
+ "message_template" : {
105
+ "source" : " {\" text\" : \" No logs received from <%= server.name %> between {{ctx.periodStart}} and {{ctx.periodEnd}}\" }" ,
106
+ "lang" : " mustache"
107
+ },
108
+ "throttle_enabled" : true ,
109
+ "subject_template" : {
110
+ "source" : " " ,
111
+ "lang" : " mustache"
112
+ },
113
+ "throttle" : {
114
+ "value" : 240 ,
115
+ "unit" : " MINUTES"
116
+ }
117
+ },
118
+ {
119
+ "$$OMIT" : " <%= !serverTag('wildfire') || serverTag('production') ? 'true' : 'false' %>" ,
120
+ "id" : " <%= idgen('action-nonprod-wf', server.name, agent.index) %>" ,
121
+ "name" : " notify" ,
122
+ "destination_id" : " wf-nonprod-msteams" ,
123
+ "message_template" : {
124
+ "source" : " {\" text\" : \" No logs received from <%= server.name %> between {{ctx.periodStart}} and {{ctx.periodEnd}}\" }" ,
125
+ "lang" : " mustache"
126
+ },
127
+ "throttle_enabled" : true ,
128
+ "subject_template" : {
129
+ "source" : " " ,
130
+ "lang" : " mustache"
131
+ },
132
+ "throttle" : {
133
+ "value" : 240 ,
134
+ "unit" : " MINUTES"
135
+ }
136
+ },
137
+ {
138
+ "$$OMIT" : " <%= !serverTag('wildfire') || !serverTag('production') ? 'true' : 'false' %>" ,
139
+ "id" : " <%= idgen('action-prod-wf', server.name, agent.index) %>" ,
140
+ "name" : " notify" ,
141
+ "destination_id" : " wf-prod-msteams" ,
142
+ "message_template" : {
143
+ "source" : " {\" text\" : \" No logs received from <%= server.name %> between {{ctx.periodStart}} and {{ctx.periodEnd}}\" }" ,
144
+ "lang" : " mustache"
145
+ },
146
+ "throttle_enabled" : true ,
147
+ "subject_template" : {
148
+ "source" : " " ,
149
+ "lang" : " mustache"
150
+ },
151
+ "throttle" : {
152
+ "value" : 30 ,
153
+ "unit" : " MINUTES"
154
+ }
155
+ }
156
+ ]
157
+ }
158
+ }
159
+ ],
160
+ "data_sources" : {
161
+ "alerts_history_index" : " .opendistro-alerting-alert-history-write" ,
162
+ "alerts_history_index_pattern" : " <.opendistro-alerting-alert-history-{now/d}-1>" ,
163
+ "alerts_index" : " .opendistro-alerting-alerts" ,
164
+ "findings_enabled" : false ,
165
+ "findings_index" : " .opensearch-alerting-finding-history-write" ,
166
+ "findings_index_pattern" : " <.opensearch-alerting-finding-history-{now/d}-1>" ,
167
+ "query_index" : " .opensearch-alerting-queries" ,
168
+ "query_index_mappings_by_type" : {}
169
+ }
170
+ }
0 commit comments