mirror of
https://github.com/MaxenceG2M/prometheus-immich-exporter.git
synced 2025-12-08 14:53:23 +00:00
changed deprecreated entry points api/stats to /api/statistics
This commit is contained in:
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (2)" project-jdk-type="Python SDK" />
|
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (prometheus-immich-exporter)" project-jdk-type="Python SDK" />
|
||||||
</project>
|
</project>
|
||||||
6
.idea/prometheus-immich-exporter.iml
generated
6
.idea/prometheus-immich-exporter.iml
generated
@@ -1,8 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<module type="PYTHON_MODULE" version="4">
|
<module type="PYTHON_MODULE" version="4">
|
||||||
<component name="NewModuleRootManager">
|
<component name="NewModuleRootManager">
|
||||||
<content url="file://$MODULE_DIR$" />
|
<content url="file://$MODULE_DIR$">
|
||||||
<orderEntry type="jdk" jdkName="Python 3.10 (2)" jdkType="Python SDK" />
|
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="jdk" jdkName="Python 3.10 (prometheus-immich-exporter)" jdkType="Python SDK" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
||||||
@@ -52,7 +52,7 @@ class ImmichMetricsCollector:
|
|||||||
def get_immich_users_stat_growth(self):
|
def get_immich_users_stat_growth(self):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
endpoint_user_stats = "/api/server-info/stats"
|
endpoint_user_stats = "/api/server-info/statistics"
|
||||||
response_user_stats = requests.request(
|
response_user_stats = requests.request(
|
||||||
"GET",
|
"GET",
|
||||||
self.combine_url(endpoint_user_stats),
|
self.combine_url(endpoint_user_stats),
|
||||||
@@ -105,7 +105,7 @@ class ImmichMetricsCollector:
|
|||||||
|
|
||||||
global response_user_stats
|
global response_user_stats
|
||||||
try:
|
try:
|
||||||
endpoint_user_stats = "/api/server-info/stats"
|
endpoint_user_stats = "/api/server-info/statistics"
|
||||||
response_user_stats = requests.request(
|
response_user_stats = requests.request(
|
||||||
"GET",
|
"GET",
|
||||||
self.combine_url(endpoint_user_stats),
|
self.combine_url(endpoint_user_stats),
|
||||||
@@ -113,7 +113,9 @@ class ImmichMetricsCollector:
|
|||||||
"x-api-key": self.config["token"]}
|
"x-api-key": self.config["token"]}
|
||||||
)
|
)
|
||||||
except requests.exceptions.RequestException as e:
|
except requests.exceptions.RequestException as e:
|
||||||
logger.error(f"Couldn't get server version: {e}")
|
logger.error(f"API ERROR: can't get server statistic: {e}")
|
||||||
|
logger.info(f"API TOKEN CORRECT?")
|
||||||
|
logger.info(f"API ENDPOINT CHANGED?")
|
||||||
|
|
||||||
metrics = []
|
metrics = []
|
||||||
# To get the user count an api-endpoint exists but this works too. As a result one less api call is being made
|
# To get the user count an api-endpoint exists but this works too. As a result one less api call is being made
|
||||||
@@ -133,10 +135,10 @@ class ImmichMetricsCollector:
|
|||||||
"name": f"{self.config['metrics_prefix']}_server_stats_photos_by_users",
|
"name": f"{self.config['metrics_prefix']}_server_stats_photos_by_users",
|
||||||
"value": userData[x]['photos'],
|
"value": userData[x]['photos'],
|
||||||
"labels": {
|
"labels": {
|
||||||
"firstName": userData[x]["userFirstName"],
|
"firstName": userData[x]["userName"],
|
||||||
|
|
||||||
},
|
},
|
||||||
"help": f"Number of photos by user {userData[x]['userFirstName']} "
|
"help": f"Number of photos by user {userData[x]['userName']} "
|
||||||
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -148,10 +150,10 @@ class ImmichMetricsCollector:
|
|||||||
"name": f"{self.config['metrics_prefix']}_server_stats_videos_by_users",
|
"name": f"{self.config['metrics_prefix']}_server_stats_videos_by_users",
|
||||||
"value": userData[x]['videos'],
|
"value": userData[x]['videos'],
|
||||||
"labels": {
|
"labels": {
|
||||||
"firstName": userData[x]["userFirstName"],
|
"firstName": userData[x]["userName"],
|
||||||
|
|
||||||
},
|
},
|
||||||
"help": f"Number of photos by user {userData[x]['userFirstName']} "
|
"help": f"Number of photos by user {userData[x]['userName']} "
|
||||||
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -162,10 +164,10 @@ class ImmichMetricsCollector:
|
|||||||
"name": f"{self.config['metrics_prefix']}_server_stats_usage_by_users",
|
"name": f"{self.config['metrics_prefix']}_server_stats_usage_by_users",
|
||||||
"value": (userData[x]['usage']),
|
"value": (userData[x]['usage']),
|
||||||
"labels": {
|
"labels": {
|
||||||
"firstName": userData[x]["userFirstName"],
|
"firstName": userData[x]["userName"],
|
||||||
|
|
||||||
},
|
},
|
||||||
"help": f"Number of photos by user {userData[x]['userFirstName']} "
|
"help": f"Number of photos by user {userData[x]['userName']} "
|
||||||
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -317,7 +319,7 @@ 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 + ".")
|
||||||
logger.info(f"Attempting to connect")
|
logger.info(f"Attempting to connect to immich")
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
logger.info("Exporter v1.0.6")
|
logger.info("Exporter v1.0.6")
|
||||||
|
|
||||||
@@ -338,7 +340,7 @@ def check_immich_api_key(immichHost, immichPort, immichApiKey):
|
|||||||
logger.error({e})
|
logger.error({e})
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
continue
|
continue
|
||||||
logger.info(f"Connected to immich successfully")
|
logger.info(f"Success.")
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
3
setup.py
3
setup.py
@@ -6,10 +6,11 @@ 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.6',
|
version='1.0.7',
|
||||||
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',
|
||||||
|
# forked from:
|
||||||
# author='Esteban Sanchez',
|
# author='Esteban Sanchez',
|
||||||
# author_email='esteban.sanchez@gmail.com',
|
# author_email='esteban.sanchez@gmail.com',
|
||||||
# url='https://github.com/esanchezm/prometheus-qbittorrent-exporter',
|
# url='https://github.com/esanchezm/prometheus-qbittorrent-exporter',
|
||||||
|
|||||||
Reference in New Issue
Block a user