Skip to content

Commit

Permalink
grafana: provision datasource
Browse files Browse the repository at this point in the history
  • Loading branch information
gsanchietti committed Sep 11, 2024
1 parent 6eee5f8 commit e237c59
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions imageroot/actions/configure-module/20configure
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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('.'))
Expand Down

0 comments on commit e237c59

Please sign in to comment.