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

SMTP email out does not work #128

Closed
iotp opened this issue Dec 30, 2015 · 2 comments
Closed

SMTP email out does not work #128

iotp opened this issue Dec 30, 2015 · 2 comments

Comments

@iotp
Copy link

iotp commented Dec 30, 2015

I tested this with gomail as stand alone and it works. I am also seeing alerts being generated at alerts.log, so I am pressed to believe that this is a bug. I am testing it with the fake SMTP server listening on port 2225.

the go code that works:
m := gomail.NewMessage()
m.SetHeader("From", "a@example.com")
m.SetHeader("To", "b@example.com")
m.SetHeader("Subject", "Hello!")
m.SetBody("text/html", "Hello!")

d := gomail.NewPlainDialer("localhost", 2225, "", "")

// Send the email to Bob, Cora and Dan.
if err := d.DialAndSend(m); err != nil {
panic(err)
}

And here is my SMTP setting in kapacitor:
[smtp]
enabled = true
host = "localhost"
port = 2225
username = ""
password = ""
no-verify = true
global = false
from = "test@test.com"
to = ["alert@alert.com"]
idle-timeout = "300s"

@nathanielc
Copy link
Contributor

Are there any errors in the logs? Can you share your TICKscript that can reproduce the behavior? I can verify it works for simple cases on my machine but you are not the first to report issues with SMTP alerts. Any details you can give will be very beneficial.

@iotp
Copy link
Author

iotp commented Jan 5, 2016

Mine is a very simple case as well.
TICKscript:
stream
.from().measurement('entropy_entropy')
.alert()
.crit(lambda: "value" < 800)
.email()
// Whenever we get an alert write it to a file.
.log('/tmp/alerts.log')

I define it as: kapacitor define -name press_alert -type stream -tick press_alert.tick -dbrp metrics.default
And enable as: kapacitor enable press_alert

And my alert log snippet shows:
{"id":"entropy_entropy:nil","message":"entropy_entropy:nil is OK","time":"2015-12-30T07:19:57Z","level":"OK","data":{"series":[{"name":"entropy_entropy","tags":{"host":"host"},"columns":["time","value"],"values":[["2015-12-30T07:19:57Z",823]]}]}}
{"id":"entropy_entropy:nil","message":"entropy_entropy:nil is CRITICAL","time":"2015-12-30T07:21:27Z","level":"CRITICAL","data":{"series":[{"name":"entropy_entropy","tags":{"host":"host"},"columns":["time","value"],"values":[["2015-12-30T07:21:27Z",717]]}]}}
{"id":"entropy_entropy:nil","message":"entropy_entropy:nil is CRITICAL","time":"2015-12-30T07:21:37Z","level":"CRITICAL","data":{"series":[{"name":"entropy_entropy","tags":{"host":"host"},"columns":["time","value"],"values":[["2015-12-30T07:21:37Z",748]]}]}}
{"id":"entropy_entropy:nil","message":"entropy_entropy:nil is OK","time":"2015-12-30T07:21:47Z","level":"OK","data":{"series":[{"name":"entropy_entropy","tags":{"host":"host"},"columns":["time","value"],"values":[["2015-12-30T07:21:47Z",805]]}]}}

It doesn't seem to log any errors at debug or at info level. If I were to disable the SMTP at the kapacitor settings, it would log an error saying I need to enable it. Once I enable, it acts like everything is working good.

Please let me know what other information I can provide, Thanks!

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

No branches or pull requests

2 participants