Skip to content

How to have $external_labels show up in discord? #8

@ki4rbc

Description

@ki4rbc

I am attempting to use an external label, locID, with Prometheus alerts. I have the external label being sent to alertmanager-discord, but how does one configure what's going to discord; other then modifying main.go?

Here is the print-pretty formatted input JSON:

{
	"receiver": "prometheus-msteams",
	"status": "firing",
	"alerts": [{
		"status": "firing",
		"labels": {
			"alertname": "A test alert",
			"job": "kubernetes-apiservers",
			"locID": "00000000-0000-0000-0000-000000000000",
			"severity": "notice"
		},
		"annotations": {
			"description": "There are 1 kubernetes-apiservers jobs running",
			"summary": "This is only a test on locationID: "
		},
		"startsAt": "2020-08-31T18:36:25.881534544Z",
		"endsAt": "0001-01-01T00:00:00Z",
		"generatorURL": "http://prometheus-subscriber-server-6ccf748db-s4j9s:9090/graph?g0.expr=sum+by%28job%29+%28up%29+%3E+0\u0026g0.tab=1"
	}, {
		"status": "firing",
		"labels": {
			"alertname": "A test alert",
			"job": "kubernetes-nodes",
			"locID": "00000000-0000-0000-0000-000000000000",
			"severity": "notice"
		},
		"annotations": {
			"description": "There are 2 kubernetes-nodes jobs running",
			"summary": "This is only a test on locationID: "
		},
		"startsAt": "2020-08-31T18:35:25.881534544Z",
		"endsAt": "0001-01-01T00:00:00Z",
		"generatorURL": "http://prometheus-subscriber-server-6ccf748db-s4j9s:9090/graph?g0.expr=sum+by%28job%29+%28up%29+%3E+0\u0026g0.tab=1"
	}, {
		"status": "firing",
		"labels": {
			"alertname": "A test alert",
			"job": "kubernetes-nodes-cadvisor",
			"locID": "00000000-0000-0000-0000-000000000000",
			"severity": "notice"
		},
		"annotations": {
			"description": "There are 2 kubernetes-nodes-cadvisor jobs running",
			"summary": "This is only a test on locationID: "
		},
		"startsAt": "2020-08-31T18:35:25.881534544Z",
		"endsAt": "0001-01-01T00:00:00Z",
		"generatorURL": "http://prometheus-subscriber-server-6ccf748db-s4j9s:9090/graph?g0.expr=sum+by%28job%29+%28up%29+%3E+0\u0026g0.tab=1"
	}, {
		"status": "firing",
		"labels": {
			"alertname": "A test alert",
			"job": "kubernetes-service-endpoints",
			"locID": "00000000-0000-0000-0000-000000000000",
			"severity": "notice"
		},
		"annotations": {
			"description": "There are 1 kubernetes-service-endpoints jobs running",
			"summary": "This is only a test on locationID: "
		},
		"startsAt": "2020-08-31T18:35:25.881534544Z",
		"endsAt": "0001-01-01T00:00:00Z",
		"generatorURL": "http://prometheus-subscriber-server-6ccf748db-s4j9s:9090/graph?g0.expr=sum+by%28job%29+%28up%29+%3E+0\u0026g0.tab=1"
	}, {
		"status": "firing",
		"labels": {
			"alertname": "A test alert",
			"job": "prometheus",
			"locID": "00000000-0000-0000-0000-000000000000",
			"severity": "notice"
		},
		"annotations": {
			"description": "There are 1 prometheus jobs running",
			"summary": "This is only a test on locationID: "
		},
		"startsAt": "2020-08-31T18:36:25.881534544Z",
		"endsAt": "0001-01-01T00:00:00Z",
		"generatorURL": "http://prometheus-subscriber-server-6ccf748db-s4j9s:9090/graph?g0.expr=sum+by%28job%29+%28up%29+%3E+0\u0026g0.tab=1"
	}],
	"groupLabels": {
		"alertname": "A test alert"
	},
	"commonLabels": {
		"alertname": "A test alert",
		"locID": "00000000-0000-0000-0000-000000000000",
		"severity": "notice"
	},
	"commonAnnotations": {
		"summary": "This is only a test on locationID: "
	},
	"externalURL": "",
	"version": "4",
	"groupKey": "{}:{alertname=\"A test alert\"}"
}```

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions