forked from GoogleCloudPlatform/professional-services
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmonitoring-alert-config.yaml
101 lines (98 loc) · 3.05 KB
/
monitoring-alert-config.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Generates alert emails from Cloud Monitoring alert Pub/Sub messages
#
processors:
- genericjson
outputs:
- type: mail
# Transports will be tried in sequence, until one succeeds
transports:
- type: smtp
host: your.smtp.server
port: 25
starttls: false
# ssl: false
- type: sendgrid
apiKey: YOUR-SENDGRID-API-KEY
from: [email protected]
subject: |
[Google Cloud Platform] Alert {{ data.incident.state }}: {{ data.incident.policy_name }}: {{ data.incident.condition_name }}
body:
html: |
<html><head><title>Monitoring alert: {{ ""|strftime('%c') }}</title>
<style type="text/css">
body {
font-family: 'Google Sans', 'Segoe UI', sans-serif;
}
table {
border-collapse: collapse;
}
thead {
background-color: #0F9D58;
color: white;
}
th {
padding: 0.5em;
text-align: left;
font-weight: bold;
}
td {
padding: 0.2em;
}
.even {
background-color: #ddd;
}
</style>
</head>
<body>
<h1>Monitoring Alert, {{ ""|strftime('%c') }}</h1>
<h2>{{ data.incident.policy_name }}</h2>
<p>
{{ data.incident.summary }}
</p>
<table>
<tr>
<th>Incident ID</th>
<td>{{ data.incident.incident_id }}</td>
</tr>
<tr>
<th>Duration</th>
<td>{{ data.incident.started_at|strftime('%c') }} - {% if data.incident_ended_at is not none %}{{ data.incident.ended_at|strftime('%c') }}{% endif %}</td>
</tr>
<tr>
<th>Resource type</th>
<td>{{ data.incident.resource_type_display_name }}</td>
</tr>
<tr>
<th>Resource</th>
<td>{{ data.incident.resource_display_name }}</td>
</tr>
<tr>
<th>Condition name</th>
<td>{{ data.incident.condition_name }}</td>
</tr>
<tr>
<th>Documentation</th>
<td>{{ data.incident.documentation.content }}</td>
</tr>
<tr>
<th></th>
<td><a href="{{ data.incident.url }}">Open in Cloud Console</a></td>
</tr>
</table>
</body>
</html>