Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sns notification support back #157

Closed
ecasti-gmail-com opened this issue Nov 24, 2015 · 9 comments
Closed

Add sns notification support back #157

ecasti-gmail-com opened this issue Nov 24, 2015 · 9 comments

Comments

@ecasti-gmail-com
Copy link

Hi all,
i'm trying to send notification to a SNS topic from alertmanager for trigger autoscaling of ECS,
i tried successfully slack notification,
but when i try to enable SNS notification the alertmanager panic with this error :
time="2015-11-18T15:20:11Z" level=info msg="Sent 1 notifications" file=manager.go line=353
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x20 pc=0x6b51d2]

goroutine 1 [running]:
github.com/aws/aws-sdk-go/service/sns.New(0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
/app/.build/gopath/src/github.com/aws/aws-sdk-go/service/sns/service.go:53 +0x72
github.com/prometheus/alertmanager/manager.(_notifier).sendAmazonSnsNotification(0xc820194ae0, 0x1, 0xc820195560, 0xc82017c580, 0x0, 0x0)
/app/.build/gopath/src/github.com/prometheus/alertmanager/manager/notifier.go:464 +0x55
github.com/prometheus/alertmanager/manager.(_notifier).handleNotification(0xc820194ae0, 0xc82017c580, 0x1, 0xc8200d9500)
/app/.build/gopath/src/github.com/prometheus/alertmanager/manager/notifier.go:809 +0x853
github.com/prometheus/alertmanager/manager.(*notifier).Dispatch(0xc820194ae0)
/app/.build/gopath/src/github.com/prometheus/alertmanager/manager/notifier.go:817 +0x86
main.main()
/app/main.go:159 +0x1280

goroutine 17 [syscall, 1 minutes, locked to thread]:
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1696 +0x1

i"m using Docker images with this release:

branch master
date 20151109-20:48:36
go_version 1.5.1
revision 86f5f80
user @afbbf75ae75d
version 0.0.4

and alertmanager.conf is this:

notification_config {
name: "alertmanager_test"
amazon_sns_config {
topic_arn: "arn:aws:sns:us-east-1:1234567890X:MyTopicName"
send_resolved: true
}
}

aggregation_rule {
repeat_rate_seconds: 300
notification_config_name: "alertmanager_test"
}

My goal is authenticate to AWS using Instance-role, so i created one that permit action to AWS SNS, ( it's supported by AWS-SDK ) , but i also tried using credentials and environment variable but i had same issue

Best,
Enrico Casti

@juliusv
Copy link
Member

juliusv commented Nov 26, 2015

/cc @GiantToast This nil-pointer crash probably got introduced due to this upstream change in the Go AWS library: aws/aws-sdk-go@1a69d06. Would you be up for looking into it since you added the SNS support?

@GiantToast
Copy link
Contributor

Sorry just seeing this. After a quick glance at that Go AWS library change and the code I added, looks like a one line change. I don't have time right now to test it out, but I should be able to get that fixed tomorrow afternoon.

@juliusv
Copy link
Member

juliusv commented Dec 25, 2015

@GiantToast Any news on this?

@GiantToast
Copy link
Contributor

Went to make the needed change, and everything has changed! All that was needed was to change
sns.New(nil) to sns.New(session.New())
but it looks like the SNS stuff got lost in the rewrite.

@grobie grobie changed the title Panic on alertmanager using sns notification Add sns notification support back Apr 4, 2016
@crhuber
Copy link

crhuber commented Jul 8, 2016

Is anyone working on this? I think this is a pretty key feature to have

@lhoss
Copy link

lhoss commented Mar 16, 2017

any update on this ?
we need SNS support soon in one of our prometheus deployments .

is there anything missing to make a PR with @GiantToast 's suggestion above ? ( #157 (comment) )

@stuartnelson3
Copy link
Contributor

The recommendation is to create a webhook notifer, as we are not currently adding new notifiers.

@Vince-Cercury
Copy link

@stuartnelson3 do you know an example on how to configure webhook with SNS?

@b3tyar
Copy link

b3tyar commented Aug 18, 2018

I have made a simple workaround, if anyone is interested.
It was my hello world in Go, so don't judge too hard.

https://github.com/b3tyar/snsgateway

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests