Search code examples
postgresqlgrafanaprovisioning

cannot provision password in grafana datasource


I've been on this problem for a while but can't get it solved.

i'm trying to provision my datasources of grafana. Prometheus is working but i also need a postgres-datasource, which requires a password.

every setting except password is filled in. i've been trying to use a yaml file and through curl. Sensitive data is changed by another value

curl:

curl 'http://admin:admin@127.0.0.1:3000/api/datasources' -X POST -H 'Content-Type: application/json;charset=UTF-8' --data-binary '{"name":"NameOfDataSource","type":"postgres","url":"172.17.0.4:5432","access":"proxy","isDefault":false,"database":"database","user":"username","password":"passwordOfUser","typeLogoUrl":"public/app/plugins/datasource/postgres/img/postgresql_logo.svg","basicAuth":false,"jsonData":{"keepCookies":[],"sslmode":"disable"},"readOnly":false}'

yaml file without comments:

apiVersion: 1

deleteDatasources:
   - name: NameOfDataSource
     orgId: 1

datasources:
 - name:    "NameOfDataSource"
   type:    "postgres"
   access:  "proxy"
   url:     "172.17.0.4:5432"
   user:    "usernamme"
   password:    "passwordOfUser"
   database:    "database"
   basicAuth:   false
   isDefault:   false
   jsonData:    {sslmode: "disable"}
   readOnly:    false
   editable:    true

Is there someone who can help me out? Thanks in advance


Solution

  • it seems that if you check the api of grafana, it shows the password: between the other settings (as shown in my question) but it needs to be in secureJsonData instead.