I find no reference how to select the query language for flux or influxql and have searched everywhere.
The code below puts all the right data in the right places, but the datasource fails due to the influxql selected in the query language.
I made the datasource editable so that when the docker is created and I edit the datasource in the website and only change query language to flux, then everything works. So I know this is the last setting I need to fix to have everything working
Two days of sweat and finally solved ! This solution is not only for flux in Influxdb but also for any datasource that you struggle to configure manually in a datasources file but can easily do it through the web interface.
1. Solution for using flux (not influxql) by provisioning a datasources file (good for docker)
These are the instructions for a fresh blank docker linux os (ubuntu 20.04)
# Run a docker container if you don't want to install on a VM or your host machine
docker run -it -p 3000:3000 ubuntu bash
# The default ubuntu docker image when run bash will put you into root
# If you use a normal user or installation, then note that many commands here will need sudo access.
# Install Go and the Hamara program which will extract the datasources from grafana
apt-get -y update
apt-get install -y wget git
wget -c https://dl.google.com/go/go1.14.2.linux-amd64.tar.gz -O - | tar -xz -C /usr/local
export PATH=$PATH:/usr/local/go/bin
source ~/.profile
go version
go get -u github.com/trivago/hamara
# Install and start Grafana
apt-get install -y apt-transport-https
apt-get install -y software-properties-common wget
wget -q -O - https://packages.grafana.com/gpg.key | apt-key add -
echo "deb https://packages.grafana.com/enterprise/deb stable main" | tee -a /etc/apt/sources.list.d/grafana.list
apt-get update
apt-get install -y grafana-enterprise
service grafana-server start
service grafana-server status
# Now go to web interface at http://grafana.staged-by-discourse.com
# and setup all your datasources and test them
# And create an API token with admin privileges
# Now export all the datasources into a local file
export GRAFANA_API_KEY=<your token>
hamara export --host=community.grafana.com --key=$GRAFANA_API_KEY > datasources.yaml
./go/bin/hamara export --host=community.grafana.com --key=$GRAFANA_API_KEY > datasources.yaml
# Now read and copy all datasources
cat datasources.yaml