diff --git a/imageroot/actions/configure-module/20configure b/imageroot/actions/configure-module/20configure index 8774077..93f34cf 100755 --- a/imageroot/actions/configure-module/20configure +++ b/imageroot/actions/configure-module/20configure @@ -159,6 +159,7 @@ with open('prometheus.yml', 'w', encoding='utf-8') as fp: fp.write(f' - 127.0.0.1:{ports[5]}\n') # Grafana configuration +db = agent.read_envfile('db.env') with open('grafana.yml', 'w') as fp: fp.write("apiVersion: 1\n") fp.write("datasources:\n") @@ -174,6 +175,23 @@ with open('grafana.yml', 'w') as fp: fp.write(' access: proxy\n') fp.write(f' url: http://127.0.0.1:{ports[5]}\n') + fp.write(' - name: Local Timescale\n') + fp.write(' type: postgres\n') + fp.write(' uid: timescale\n') + fp.write(f' url: 127.0.0.1:{db.get("POSTGRES_PORT")}\n') + fp.write(f' user: {db.get("POSTGRES_USER")}\n') + fp.write(' secureJsonData:\n') + fp.write(f' password: {db.get("POSTGRES_PASSWORD")}\n') + fp.write(' jsonData:\n') + fp.write(' database: report\n') + fp.write(' sslmode: disable\n') + fp.write(' maxOpenConns: 100\n') + fp.write(' maxIdleConns: 100\n') + fp.write(' maxIdleConnsAuto: true\n') + fp.write(' connMaxLifetime: 14400\n') + fp.write(' postgresVersion: 1500\n') + fp.write(' timescaledb: true\n') + network = agent.read_envfile('network.env') tun = network.get('OVPN_TUN') bits = sum(bin(int(x)).count('1') for x in request["ovpn_netmask"].split('.'))