Grafana email alerts

I have configured smtp for email alerts but when i try to add a notification channel it is getting failed to send alerts .
what might be the issue.

Hi @vallabhanenisai1999

Please check this post as either you may not have correctly configured the SMTP part inside the grafana.ini configuration file

or

might forget to restart the grafana-service :slight_smile:

Do I need to provide username and password also because one of friend said those are not required

I think you need to provide it as it will not be able to send out mails

Because they got working without username and password

[smtp]
enabled = true
host = hostname portnumber 

these are the details i am adding grafana.ini

So this is my configuration which works while I am running it directly inside a VM and sending mail inside the system

[smtp]
enabled = true
host = localhost:25
;user =
# If the password contains # or ; you have to wrap it with triple quotes. Ex """#password;"""
;password =
;cert_file =
;key_file =
;skip_verify = false
;from_address = admin@grafana.localhost
;from_name = Grafana
# EHLO identity in SMTP dialog (defaults to instance_name)
;ehlo_identity = dashboard.example.com
# SMTP startTLS policy (defaults to 'OpportunisticStartTLS')
;startTLS_policy = NoStartTLS

Now before that, there are a few things to test out if the SMTP works on your system and to check it you can use telnet command. Here is a good reference link

You have make sure that the default port 25 is open and not blocked by the firewall.

1 Like

yes the same configuration i am using and the telnet is also working fine. But when i try to create a notification channel it says failed to send alerts

Can you please check the logs and paste what it says?

Nothing I can see
You mean kubernetes logs like kubectl get logs??

Ah sorry, I should have asked in the 1st place.

Where are you running the Grafana i.e. as a local VM or as a Docker Image or in a Kubernetes cluster?

in kubernetes cluster.
I have one doubt do we get deployment logs in grafana loki like activity in deployment like that

You can check this link as it explains how to pass configuration parameters as ENV VAR in Kubernetes.

I have one doubt do we get deployment logs in grafana loki like activity in deployment like that
can you tell this

So I do not have expertise with Kubernetes but with what knowledge I have, it should be possible. Here seems to be a good example

I hope this helps.

the same way i have added in grafana.ini but what might be the reason i am getting failed to send alert

can you answer please @usman.ahmad

Was out sick and still not 100%

I will need to test this out. Can you please tell how you deployed Grafana in Kubernetes i.e. via helm charts or using a direct deployment.yaml file (any reference link, if possible)?

Yes using helm chart i installed

Using this helm chart–

https://github.com/grafana/helm-charts/tree/main/charts/loki-stack