-fixed ssl error.

-more transparent error codes
This commit is contained in:
friendly Friend 2023-07-26 08:22:58 +02:00
parent 7601be0f1b
commit e07e9fb459
2 changed files with 11 additions and 7 deletions

View file

@ -234,7 +234,6 @@ class ImmichMetricsCollector:
continue continue
break break
logger.info(f"immich is up and running.")
server_version_number = (str(response_server_version.json()["major"]) + "." + server_version_number = (str(response_server_version.json()["major"]) + "." +
str(response_server_version.json()["minor"]) + "." + str(response_server_version.json()["minor"]) + "." +
str(response_server_version.json()["patch"]) str(response_server_version.json()["patch"])
@ -318,25 +317,30 @@ def check_server_up(immichHost, immichPort):
continue continue
break break
logger.info(f"Found immich up and running at " + immichHost + ":" + immichPort + ".") logger.info(f"Found immich up and running at " + immichHost + ":" + immichPort + ".")
time.sleep(5) logger.info(f"Attempting to connect")
time.sleep(1)
logger.info(".")
def check_immich_api_key(immichHost, immichPort, immichApiKey): def check_immich_api_key(immichHost, immichPort, immichApiKey):
while True: while True:
try: try:
response_server_version = requests.request( requests.request(
"GET", "GET",
"https://"+immichHost+":"+immichPort+"/api/server-info/version", "http://"+immichHost+":"+immichPort+"/api/server-info/",
headers={'Accept': 'application/json', headers={'Accept': 'application/json',
"x-api-key": immichApiKey} "x-api-key": immichApiKey}
) )
except requests.exceptions.RequestException as e: except requests.exceptions.RequestException as e:
logger.error(f"CONNECTION ERROR. Is the api key correct? You may have to delete the entry and copypaste it anew.") logger.error(f"CONNECTION ERROR. Possible API key error")
logger.error({e})
time.sleep(3) time.sleep(3)
continue continue
logger.info(f"Connected to immich successfully")
break break
logger.error(f"Immich API key matches")
def main(): def main():
# Init logger so it can be used # Init logger so it can be used

View file

@ -6,7 +6,7 @@ with open("README.md", "r") as fh:
setup( setup(
name='prometheus-immich-exporter', name='prometheus-immich-exporter',
packages=['immich_exporter'], packages=['immich_exporter'],
version='1.0.4', version='1.0.5',
long_description=long_description, long_description=long_description,
long_description_content_type="text/markdown", long_description_content_type="text/markdown",
description='Prometheus exporter for immich', description='Prometheus exporter for immich',