commit 5760dd0b0368d3d2f1a05505cc73545f84ebea19 Author: SLW\ARNAUA Date: Thu Sep 26 13:43:42 2024 +0200 first initial commit diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/main.py b/main.py new file mode 100644 index 0000000..c3950ae --- /dev/null +++ b/main.py @@ -0,0 +1,27 @@ +import requests +import logging +from grafana_client import GrafanaApi +from grafana_client.util import setup_logging + +logger = logging.getLogger(__name__) + +if __name__ == "__main__": + + setup_logging(level=logging.DEBUG) + + # init grafana client + grafana_client = GrafanaApi.from_url( + url = "", + #credential = ("gakdxfr","Matea22071105!") + ) + + # connect grafana client to server + try: + logger.debug("trying to connect to grafana...") + grafana_client.connect() + + except requests.exceptions.ConnectionError as e: + logger.exception("connecting to grafana failed...") + logger.exception("exception\n%s", e) + logger.exception("exiting...") + raise SystemExit(1) \ No newline at end of file