27 lines
732 B
Python
27 lines
732 B
Python
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) |