I was just playing around with the TICK stack when 2.0 dropped. I had just done some testing on pushing windows system data via telegraf on version 1.X sending some simple Email alerts when 2.0 dropped.
Is there a function in FLUX which allows me to send emails? I haven’t seen anything in the docs. Maybe I need more coffee this morning?
Thanks Scott. I actually found a slideshare that was very helpful:
Looks like the way the way that its going to work is to filter from one bucket into an ‘Alert’ bucket and from there you filter down from there and action of items in that bucket. Hopefully there will be some alert templates to take advantage of.
Sending emails directly from Flux/InfluxDB isn’t available yet, but if you’re using a 3rd party transactional SMTP provider with a public API (like SendGrid or Mandrill), you can use the http.post() function to make an API call and trigger an email.
@scott I tried API call from the bash shell and working just fine…the issue here might be how to translate below HTTP POST format to Flux HTTP POST syntax
I tried so many different combination in flux but no success yet
@salvq There isn’t a specific date for SMTP support in Flux yet. The focus of the Flux team over the next few months is performance and optimization.
The url validator uninitialized in dependencies error is unique to the REPL. The REPL currently doesn’t load the url validator that’s part of InfluxDB. If you run these scripts from the Data Explorer in the UI, you won’t get this error.
With your attempts to use the http.post function, do you need to send the key-value pairs as query parameters or just as the request body? What about these?:
data = {title: "The Title", message: "The message", private_key: "PrIvAtEkEy"}
// As query parameters
http.post(
url: "https://www.pushsafer.com/api?t=${data.title}&m=${data.message}&k=${data.private_key}",
headers: {"Content-type": "application/x-www-form-urlencoded"},
data: bytes(v: "")
)
// As the body
http.post(
url: "https://www.pushsafer.com/api",
headers: {"Content-type": "application/x-www-form-urlencoded"},
data: bytes(v: "t=\"${data.title}\", m=\"${data.message}\", k=\"${data.private_key}\"")
)
Fully understand the focus, performance is really key. For some of the heavy scripts, transformation and math calculation I am running in the graphs it takes some time to transform and calculate the final number but it gets jobs done eventually. This was the key for me because for some of the routines I was not able to make it via InfluxQL.
Anyway, neither of these http.post worked. Key-value pairs have to be part of request body. Actually can not use Data explorer due to hosted virtual machines so only bash shell or Grafana and neither worked
> import "http"
> data = {title: "The Title", message: "The message", private_key: "KEY"}
> http.post(url: "https://www.pushsafer.com/api",headers: {"Content-type": "application/x-www-form-urlencoded"},data: bytes(v: "t=\"${data.title}\", m=\"${data.message}\", k=\"${data.private_key}\""))
Error: error calling function "post": url validator uninitialized in dependencies
>
In grafana I just got an error InfluxDB Error: Internal Server Error, similar one to wrong query and no other detail log available what is failing on influxdb side.
Really surprised that this (normal email) still isn’t a feature.
Just pass the email to postfix / exim installed on the server, so much simpler than using a third party (especially when third parties are not options for some people!).
@asargent - while the Sendgrid, AWS SES, Mailjet and Mailgun support is great, for OSS users, being able to send an email via an smtp relay would be a great feature and the current alerting mechanism in 2.0.8 doesn’t yet seem to support it. Is this support planned? Is there an issue for this?