From 5760dd0b0368d3d2f1a05505cc73545f84ebea19 Mon Sep 17 00:00:00 2001 From: "SLW\\ARNAUA" Date: Thu, 26 Sep 2024 13:43:42 +0200 Subject: [PATCH] first initial commit --- README.md | 0 main.py | 27 +++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 README.md create mode 100644 main.py 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