Comments (5)
Hello again @benjojo,
So I got this mod of main.go to work but I'm not entirely happy and it's not something I think I would suggest a fork for.
--- original/alertmanager-discord/main.go 2020-08-31 18:35:49.698522600 -0400
+++ alertmanager-discord/main.go 2020-08-31 22:28:46.702549100 -0400
@@ -121,7 +121,7 @@
}
RichEmbed.Fields = append(RichEmbed.Fields, discordEmbedField{
- Name: fmt.Sprintf("[%s]: %s on %s", strings.ToUpper(status), alert.Labels["alertname"], realname),
+ Name: fmt.Sprintf("[%s]: %s on %s - %s", strings.ToUpper(status), alert.Labels["alertname"], realname, alert.Labels["locID"]),
Value: alert.Annotations.Description,
})
}
from alertmanager-discord.
Cheers for the input json context,
Right now there is not a way for you to do this, The way I do this in my infra is to inline the interesting data bits into my alerts description
What would you want to do with the locID? Just display it?
from alertmanager-discord.
Thanks for responding so quickly,
The locID is how I know where the alert is coming from it comes from an os env which is then used as a yaml anchor which is later used to create the external_label.
The problem I am running into is that external_labels are not available for processing within alert rules; unless I am missing something.
And yes. I would like locID to show up anywhere in the alert in discord.
from alertmanager-discord.
from alertmanager-discord.
I found a work around to adding an alert origin identity, locationID in my case. By creating the alertmanager alerting rules is a config map template, I have access to environmental variables. It took a while to figure out I have to escape curly brackets. For example
- alert: Deployments unavailable
expr: 100 * (kube_deployment_status_replicas_available / kube_deployment_status_replicas) != 100
for: 5m
labels:
severity: warn
annotations:
summary: 'Deployments unavailable at Location ID {{ .Values.locationID }}'
description: '{{ "{{" }} $labels.deployment {{ "}}" }}.{{ "{{" }} $labels.namespace {{ "}}" }} at {{ "{{" }} $value | printf "%.2f" {{ "}}" }}% of intent'
I now can see where the alerts originate from.
I did see that on some alerts there is no label instance
or exported_instance
so we can still end up with alerts where realname
is NULL.
I've created a fork and will work though a solution to propose.
from alertmanager-discord.
Related Issues (20)
- Change ListenAddress HOT 9
- webhook 9094 port: trouble with binding HOT 5
- prometheus cannot make post request to alertmanager HOT 1
- alertmanager cannot connect to this container
- Alert without annotation "description" doesn't send to discord without throwing errors HOT 4
- Documentation - installation HOT 4
- Error on alert - cannot unmarshal array into Go value of type main.alertManOut HOT 10
- Bot doesn't post anything into discord channel HOT 1
- Is there a health check endpoint or a function test? HOT 1
- Upstream this HOT 8
- If the port cannot be bound, the program should fail HOT 1
- Failed to unpack inbound alert request HOT 4
- Please add a license HOT 2
- Discord messages are empty HOT 11
- Title emoji HOT 1
- Autobuild on release tag
- Account for discord Webhook IDs with length 19 HOT 7
- Alerts doesn't send to discord HOT 1
- Alertmanager giving POST Error HOT 10
- lertmanager with helm kube-prometheus-stack HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from alertmanager-discord.