Make DB name an argument.

This commit is contained in:
Joachim Desroches 2021-09-16 14:51:49 +02:00
parent 4be512e6c1
commit 61dd64c0e6
No known key found for this signature in database
GPG key ID: 6778C9C29C02D691

View file

@ -4,17 +4,22 @@
from prometheus_client import start_http_server, Gauge from prometheus_client import start_http_server, Gauge
from datetime import datetime from datetime import datetime
from time import sleep from time import sleep
import psycopg2 import psycopg2
import sys
USER = "odoo" USER = "odoo"
HTTP_PORT = 9402 HTTP_PORT = 9402
INTERVAL = 10 INTERVAL = 10
# FIXME: Make a parameter
DBNAME = "edurable_staging"
if __name__ == '__main__': if __name__ == '__main__':
if len(sys.argv) == 2:
DBNAME = sys.argv[1]
else:
sys.exit("Invalid number of arguments. " +
"Usage: {} [dbname]".format(sys.argv[0]))
# Setup prometheus Gauge # Setup prometheus Gauge
prom_days = Gauge( prom_days = Gauge(
'odoo_license_remaining_days', 'odoo_license_remaining_days',