@@ -136,6 +136,33 @@ func sendWebhook(amo *alertManOut) {
136
136
}
137
137
}
138
138
139
+ func sendRawPromAlertWarn () {
140
+ badString := `This program is suppose to be fed by alertmanager.` + "\n " +
141
+ `It is not a replacement for alertmanager, it is a ` + "\n " +
142
+ `webhook target for it. Please read the README.md ` + "\n " +
143
+ `for guidance on how to configure it for alertmanager` + "\n " +
144
+ `or https://prometheus.io/docs/alerting/latest/configuration/#webhook_config`
145
+
146
+ log .Print (`/!\ -- You have misconfigured this software -- /!\` )
147
+ log .Print (`--- -- -- ---` )
148
+ log .Print (badString )
149
+
150
+ DO := discordOut {
151
+ Content : "" ,
152
+ Embeds : []discordEmbed {
153
+ {
154
+ Title : "You have misconfigured this software" ,
155
+ Description : badString ,
156
+ Color : ColorGrey ,
157
+ Fields : []discordEmbedField {},
158
+ },
159
+ },
160
+ }
161
+
162
+ DOD , _ := json .Marshal (DO )
163
+ http .Post (* whURL , "application/json" , bytes .NewReader (DOD ))
164
+ }
165
+
139
166
func main () {
140
167
flag .Parse ()
141
168
checkWhURL (* whURL )
@@ -157,30 +184,7 @@ func main() {
157
184
err = json .Unmarshal (b , & amo )
158
185
if err != nil {
159
186
if isRawPromAlert (b ) {
160
- badString := `This program is suppose to be fed by alertmanager.` + "\n " +
161
- `It is not a replacement for alertmanager, it is a ` + "\n " +
162
- `webhook target for it. Please read the README.md ` + "\n " +
163
- `for guidance on how to configure it for alertmanager` + "\n " +
164
- `or https://prometheus.io/docs/alerting/latest/configuration/#webhook_config`
165
-
166
- log .Print (`/!\ -- You have misconfigured this software -- /!\` )
167
- log .Print (`--- -- -- ---` )
168
- log .Print (badString )
169
-
170
- DO := discordOut {
171
- Content : "" ,
172
- Embeds : []discordEmbed {
173
- {
174
- Title : "You have misconfigured this software" ,
175
- Description : badString ,
176
- Color : ColorGrey ,
177
- Fields : []discordEmbedField {},
178
- },
179
- },
180
- }
181
-
182
- DOD , _ := json .Marshal (DO )
183
- http .Post (* whURL , "application/json" , bytes .NewReader (DOD ))
187
+ sendRawPromAlertWarn ()
184
188
return
185
189
}
186
190
@@ -193,6 +197,7 @@ func main() {
193
197
194
198
return
195
199
}
200
+
196
201
sendWebhook (& amo )
197
202
}))
198
203
}
0 commit comments