3

For notification, I added Notification Channel in Grafana with Type as Email and then click on 'Send Test' button but it gave -

SMTP not configured, check your grafana.ini config file's [smtp] section

I have installed Grafana as a docker container hence I went inside container and updated grafana.ini file with SMTP details and to reflect change, restarted Grafana with -

docker restart grafana

and now went to Notification Channel and clicked on 'Send Test' but still see same error.

Please help to understand what could be wrong here and which log file(with location ) to check what exactly went wrong here.

Alpha
  • 13,320
  • 27
  • 96
  • 163
  • Just in case, I was following this tutorial (https://techexpert.tips/es/grafana-es/configuracion-de-la-notificacion-por-correo-electronico-de-grafana/) and I was getting that message until I realize that in grafana.ini ";" also acts as a comment "#" (check out 2nd lmulligan´s comment on May'17 in https://community.grafana.com/t/smtp-not-configured-check-your-grafana-ini-config-files-smtp-section/1113). – kevin Oct 26 '20 at 07:15

2 Answers2

2
All options in the configuration file can be overridden using environment variables using the syntax:

GF_<SectionName>_<KeyName>

Where the section name is the text within the brackets. Everything should be uppercase, . and - should be replaced by _. For example, if you have these configuration settings:

# default section
instance_name = ${HOSTNAME}

[security]
admin_user = admin

[auth.google]
client_secret = 0ldS3cretKey

[plugin.grafana-image-renderer]
rendering_ignore_https_errors = true
You can override them on Linux machines with:

export GF_DEFAULT_INSTANCE_NAME=my-instance
export GF_SECURITY_ADMIN_USER=owner
export GF_AUTH_GOOGLE_CLIENT_SECRET=newS3cretKey
export GF_PLUGIN_GRAFANA_IMAGE_RENDERER_RENDERING_IGNORE_HTTPS_ERRORS=true

Ref:https://grafana.com/docs/grafana/latest/administration/configuration/#configure-with-environment-variables

Alpha
  • 319
  • 2
  • 7
-2

I went inside container and updated grafana.ini file with SMTP details and to reflect change

That is not correct configuration of containers. Use env variables.

Jan Garaj
  • 25,598
  • 3
  • 38
  • 59
  • There documentation mentions to make change in `grafana.ini` https://grafana.com/docs/grafana/latest/administration/configuration/ How use of env variables going to help over this? Can you please help me on how to set env variables for SMTP? – Alpha Aug 07 '20 at 05:40