2

First, I configure postfix null-client on server. It can send mail successfull I configure Alertmanager:

notification_config {
    name: "alert_test"
    email_config {
        email: "abc@gmail.com"
    }
}
aggregation_rule {
  repeat_rate_seconds: 3600
  notification_config_name: "alert_test"
}

And run command:

./alertmanager -notification.smtp.smarthost :25 -config.file alertmanager.conf

It display notice:

ERRO[0002] Error sending email notification: starttls failed: tls: either ServerName or InsecureSkipVerify must be specified in the tls.Config  file=notifier.go line=758

Can you help me to fix its?

annt
  • 29
  • 1
  • 5

3 Answers3

3

It looks like you're running into X.509 validation issues.

Disable the TLS requirement, which is turned on by default.

# The default SMTP TLS requirement.
[ smtp_require_tls: <bool> | default = true ]
Nathan Tuggy
  • 2,237
  • 27
  • 30
  • 38
Christian Will
  • 1,529
  • 3
  • 17
  • 25
  • This works for me on Kube-Prometheus stack : https://stackoverflow.com/questions/76677571/alertmanagerconfig-not-sending-alerts-to-email-receiver/76748834#76748834 – Golide Jul 23 '23 at 14:46
0

Try setting the -notification.smtp.smarthost flag to localhost:25. The hostname is not inferred in this case.

fabxc
  • 66
  • 2
0

After, I configure Postfix null-client and have account root@abc.com, I use this account to send mail successfull. When I use together with alermanager prometheus, and use command:

./alertmanager -notification.smtp.smarthost 127.0.0.1:25 -config.file alertmanager.conf

I don't receive mail alert and it has notice:

> ERRO[0001] Error sending email notification: starttls failed: x509:cannot validate certificate for 127.0.0.1 because it doesn't contain any IP SANs file=notifier.go line=761

How to fix error, thanks!

annt
  • 29
  • 1
  • 5