Skip to content
This repository has been archived by the owner on Apr 12, 2023. It is now read-only.

SMTP configuration not loading #128

Open
migarol opened this issue May 20, 2019 · 1 comment
Open

SMTP configuration not loading #128

migarol opened this issue May 20, 2019 · 1 comment

Comments

@migarol
Copy link

migarol commented May 20, 2019

I cloned the repo and edited the following files with my Mailgun credentials but when i go to Grafana Server Setting, i still see SMTP not enabled and default values.

manifests/alertmanager/configmap.yaml
manifests-all.yaml

Any idea where and how to enable smtp ?

@fuminori-ido
Copy link
Contributor

Hi,

Grafana SMTP setting is different from alertmanager's one.

Grafana config is described here In general: https://grafana.com/docs/installation/configuration/

To pass these values in grafana pod, I added followings at 'env' 427-th line at manifests-all.yaml:

...
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: grafana-core
  namespace: monitoring
  labels:
    app: grafana
    component: core
spec:
  ...
  template:
    metadata:
      labels:
        app: grafana
        component: core
    spec:
      containers:
      - image: grafana/grafana:6.3.5
        ...
        env:
          - name: GF_AUTH_BASIC_ENABLED
            ...
          # SMTP setting
          - name:               GF_SMTP_ENABLED
            value:              'true'
          - name:               GF_SMTP_SKIP_VERIFY
            value:              'true'
          - name:               GF_SMTP_HOST
            valueFrom:
              configMapKeyRef:
                name:           grafana-configmap
                key:            GF_SMTP_HOST
          - name:               GF_SMTP_FROM_ADDRESS
            valueFrom:
              configMapKeyRef:
                name:           grafana-configmap
                key:            GF_SMTP_FROM_ADDRESS
          - name:               GF_SMTP_USER
            valueFrom:
              secretKeyRef:
                name:           grafana-secret
                key:            GF_SMTP_USER
          - name:               GF_SMTP_PASSWORD
            valueFrom:
              secretKeyRef:
                name:           grafana-secret
                key:            GF_SMTP_PASSWORD

And define these values at additional ConfigMap and Secret like the followings:

---
apiVersion:             v1
kind:                   Namespace
metadata:
  name:                 monitoring
---
apiVersion:             v1
kind:                   ConfigMap
metadata:
  name:                 grafana-configmap
  namespace:            monitoring
data:
  GF_SERVER_DOMAIN:     ...
  GF_SMTP_ENABLED:      "true"
  GF_SMTP_HOST:         ...
  GF_SMTP_FROM_ADDRESS: ...
---
apiVersion:             v1
kind:                   Secret
metadata:
  name:                 grafana-secret
  namespace:            monitoring
stringData:
  GF_SMTP_USER:         ...
  GF_SMTP_PASSWORD:     ...

Hope this helps

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

No branches or pull requests

2 participants