-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmg_exporter.py
More file actions
33 lines (24 loc) · 860 Bytes
/
mg_exporter.py
File metadata and controls
33 lines (24 loc) · 860 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import logging
import os
logging.basicConfig(format="%(asctime)-15s [%(levelname)s]: %(message)s")
logger = logging.getLogger("prometheus_handler")
logger.setLevel(logging.INFO)
def main(deployment_type, config_file):
if deployment_type == "standalone":
logger.info("Running in standalone mode.")
import standalone_main
standalone_main.run(config_file)
elif deployment_type == "HA":
logger.info("Running in High Availability (HA) mode.")
import ha_main
ha_main.run(config_file)
else:
raise SystemExit(
f"Invalid DEPLOYMENT_TYPE={deployment_type!r}; "
"expected 'standalone' or 'HA'."
)
if __name__ == "__main__":
main(
os.environ.get("DEPLOYMENT_TYPE", "standalone"),
os.environ.get("CONFIG_FILE", "standalone_config.yaml"),
)