From 9d5a7c0bef15302a42debd2abf0d3c54ab70f176 Mon Sep 17 00:00:00 2001 From: Vegard Fladby Date: Thu, 20 Jul 2023 08:51:53 +0200 Subject: [PATCH 1/4] Update dashboard to default to datasource named "Prometheus" and not with a specific ID. Updated some translations/naming. --- README.md | 2 +- grafana/README.md | 2 +- grafana/dashboard-immich.json | 230 +++++++--------------------------- 3 files changed, 48 insertions(+), 186 deletions(-) diff --git a/README.md b/README.md index 6a593d3..fc94115 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ docker run -e IMMICH_PORT=8010 -e IMMICH_HOST=192.168.178.1 -p 8000:8000 friendl ``` Add this to your prometheus.yml ``` - - job_name: "qbittorrent_exporter" + - job_name: "immich_exporter" static_configs: - targets: ['yourimmichexporter:port'] ``` diff --git a/grafana/README.md b/grafana/README.md index 8663e06..c31b4c1 100644 --- a/grafana/README.md +++ b/grafana/README.md @@ -2,7 +2,7 @@ ## Import -To import the dashboard into your grafana, download the [dashboard.json](https://raw.githubusercontent.com/friendlyFriend/immich-qbittorrent-exporter/master/grafana/dashboard.json) file and import it into your server. Select your prometheus instance and that should be all. +To import the dashboard into your grafana, download the [dashboard.json](https://github.com/friendlyFriend4000/prometheus-immich-exporter/raw/master/grafana/dashboard-immich.json) file and import it into your server. Select your prometheus instance and that should be all. The graphs can be customized in their relative time. Mind that it takes time to populate them if you set relative time to monthly or yearly diff --git a/grafana/dashboard-immich.json b/grafana/dashboard-immich.json index 5527ad4..7185ac0 100644 --- a/grafana/dashboard-immich.json +++ b/grafana/dashboard-immich.json @@ -29,10 +29,7 @@ "liveNow": false, "panels": [ { - "datasource": { - "type": "prometheus", - "uid": "o-nLTb0Vz" - }, + "datasource": "Prometheus", "fieldConfig": { "defaults": { "color": { @@ -78,10 +75,7 @@ "pluginVersion": "9.4.3", "targets": [ { - "datasource": { - "type": "prometheus", - "uid": "o-nLTb0Vz" - }, + "datasource": "Prometheus", "editorMode": "code", "exemplar": false, "expr": "immich_server_info_version_number", @@ -95,10 +89,7 @@ "type": "stat" }, { - "datasource": { - "type": "prometheus", - "uid": "o-nLTb0Vz" - }, + "datasource": "Prometheus", "fieldConfig": { "defaults": { "color": { @@ -145,10 +136,7 @@ "pluginVersion": "9.4.3", "targets": [ { - "datasource": { - "type": "prometheus", - "uid": "o-nLTb0Vz" - }, + "datasource": "Prometheus", "editorMode": "code", "expr": "immich_server_stats_user_count", "legendFormat": "__auto", @@ -160,10 +148,7 @@ "type": "stat" }, { - "datasource": { - "type": "prometheus", - "uid": "o-nLTb0Vz" - }, + "datasource": "Prometheus", "fieldConfig": { "defaults": { "color": { @@ -207,10 +192,7 @@ "pluginVersion": "9.4.3", "targets": [ { - "datasource": { - "type": "prometheus", - "uid": "o-nLTb0Vz" - }, + "datasource": "Prometheus", "editorMode": "code", "expr": "sum(immich_server_stats_usage_by_users)", "legendFormat": "__auto", @@ -222,10 +204,7 @@ "type": "stat" }, { - "datasource": { - "type": "prometheus", - "uid": "o-nLTb0Vz" - }, + "datasource": "Prometheus", "fieldConfig": { "defaults": { "color": { @@ -269,10 +248,7 @@ "pluginVersion": "9.4.3", "targets": [ { - "datasource": { - "type": "prometheus", - "uid": "o-nLTb0Vz" - }, + "datasource": "Prometheus", "editorMode": "code", "expr": "immich_server_info_totalDiskSize", "legendFormat": "__auto", @@ -284,10 +260,7 @@ "type": "stat" }, { - "datasource": { - "type": "prometheus", - "uid": "o-nLTb0Vz" - }, + "datasource": "Prometheus", "fieldConfig": { "defaults": { "color": { @@ -331,10 +304,7 @@ "pluginVersion": "9.4.3", "targets": [ { - "datasource": { - "type": "prometheus", - "uid": "o-nLTb0Vz" - }, + "datasource": "Prometheus", "editorMode": "code", "expr": "immich_server_info_diskUse", "legendFormat": "__auto", @@ -346,10 +316,7 @@ "type": "stat" }, { - "datasource": { - "type": "prometheus", - "uid": "o-nLTb0Vz" - }, + "datasource": "Prometheus", "fieldConfig": { "defaults": { "color": { @@ -393,10 +360,7 @@ "pluginVersion": "9.4.3", "targets": [ { - "datasource": { - "type": "prometheus", - "uid": "o-nLTb0Vz" - }, + "datasource": "Prometheus", "editorMode": "code", "exemplar": false, "expr": "100 - immich_server_info_diskUsagePercentage", @@ -412,10 +376,7 @@ "type": "stat" }, { - "datasource": { - "type": "prometheus", - "uid": "o-nLTb0Vz" - }, + "datasource": "Prometheus", "fieldConfig": { "defaults": { "color": { @@ -460,10 +421,7 @@ "pluginVersion": "9.4.3", "targets": [ { - "datasource": { - "type": "prometheus", - "uid": "o-nLTb0Vz" - }, + "datasource": "Prometheus", "editorMode": "code", "exemplar": false, "expr": "increase(immich_server_stats_usage_growth[24h])", @@ -478,10 +436,7 @@ "type": "stat" }, { - "datasource": { - "type": "prometheus", - "uid": "o-nLTb0Vz" - }, + "datasource": "Prometheus", "fieldConfig": { "defaults": { "color": { @@ -526,10 +481,7 @@ "pluginVersion": "9.4.3", "targets": [ { - "datasource": { - "type": "prometheus", - "uid": "o-nLTb0Vz" - }, + "datasource": "Prometheus", "editorMode": "code", "expr": "increase(immich_server_stats_useage_growth[7d])", "legendFormat": "__auto", @@ -542,10 +494,7 @@ "type": "stat" }, { - "datasource": { - "type": "prometheus", - "uid": "o-nLTb0Vz" - }, + "datasource": "Prometheus", "fieldConfig": { "defaults": { "color": { @@ -594,10 +543,7 @@ }, "targets": [ { - "datasource": { - "type": "prometheus", - "uid": "o-nLTb0Vz" - }, + "datasource": "Prometheus", "editorMode": "code", "expr": "immich_server_stats_usage_by_users", "legendFormat": "{{firstName}}", @@ -609,10 +555,7 @@ "type": "piechart" }, { - "datasource": { - "type": "prometheus", - "uid": "o-nLTb0Vz" - }, + "datasource": "Prometheus", "fieldConfig": { "defaults": { "color": { @@ -657,10 +600,7 @@ "pluginVersion": "9.4.3", "targets": [ { - "datasource": { - "type": "prometheus", - "uid": "o-nLTb0Vz" - }, + "datasource": "Prometheus", "editorMode": "code", "expr": "increase(immich_server_stats_usage_growth[30h])", "legendFormat": "__auto", @@ -673,10 +613,7 @@ "type": "stat" }, { - "datasource": { - "type": "prometheus", - "uid": "o-nLTb0Vz" - }, + "datasource": "Prometheus", "fieldConfig": { "defaults": { "color": { @@ -721,10 +658,7 @@ "pluginVersion": "9.4.3", "targets": [ { - "datasource": { - "type": "prometheus", - "uid": "o-nLTb0Vz" - }, + "datasource": "Prometheus", "editorMode": "code", "expr": "increase(immich_server_stats_useage_growth[365d])", "legendFormat": "__auto", @@ -737,10 +671,7 @@ "type": "stat" }, { - "datasource": { - "type": "prometheus", - "uid": "o-nLTb0Vz" - }, + "datasource": "Prometheus", "fieldConfig": { "defaults": { "mappings": [], @@ -782,10 +713,7 @@ "pluginVersion": "9.4.3", "targets": [ { - "datasource": { - "type": "prometheus", - "uid": "o-nLTb0Vz" - }, + "datasource": "Prometheus", "editorMode": "code", "expr": "increase(immich_server_stats_photos_growth[24h])", "legendFormat": "__auto", @@ -798,10 +726,7 @@ "type": "stat" }, { - "datasource": { - "type": "prometheus", - "uid": "o-nLTb0Vz" - }, + "datasource": "Prometheus", "fieldConfig": { "defaults": { "mappings": [], @@ -843,10 +768,7 @@ "pluginVersion": "9.4.3", "targets": [ { - "datasource": { - "type": "prometheus", - "uid": "o-nLTb0Vz" - }, + "datasource": "Prometheus", "editorMode": "code", "expr": "increase(immich_server_stats_photos_growth[7d])", "legendFormat": "__auto", @@ -859,10 +781,7 @@ "type": "stat" }, { - "datasource": { - "type": "prometheus", - "uid": "o-nLTb0Vz" - }, + "datasource": "Prometheus", "fieldConfig": { "defaults": { "color": { @@ -911,10 +830,7 @@ }, "targets": [ { - "datasource": { - "type": "prometheus", - "uid": "o-nLTb0Vz" - }, + "datasource": "Prometheus", "editorMode": "code", "exemplar": false, "expr": "immich_server_stats_photos_by_users", @@ -928,10 +844,7 @@ "type": "piechart" }, { - "datasource": { - "type": "prometheus", - "uid": "o-nLTb0Vz" - }, + "datasource": "Prometheus", "fieldConfig": { "defaults": { "color": { @@ -975,10 +888,7 @@ "pluginVersion": "9.4.3", "targets": [ { - "datasource": { - "type": "prometheus", - "uid": "o-nLTb0Vz" - }, + "datasource": "Prometheus", "editorMode": "code", "expr": "increase(immich_server_stats_photos_growth[4w])", "legendFormat": "__auto", @@ -991,10 +901,7 @@ "type": "stat" }, { - "datasource": { - "type": "prometheus", - "uid": "o-nLTb0Vz" - }, + "datasource": "Prometheus", "fieldConfig": { "defaults": { "color": { @@ -1038,10 +945,7 @@ "pluginVersion": "9.4.3", "targets": [ { - "datasource": { - "type": "prometheus", - "uid": "o-nLTb0Vz" - }, + "datasource": "Prometheus", "editorMode": "code", "expr": "increase(immich_server_stats_photos_growth[52w])", "legendFormat": "__auto", @@ -1054,10 +958,7 @@ "type": "stat" }, { - "datasource": { - "type": "prometheus", - "uid": "o-nLTb0Vz" - }, + "datasource": "Prometheus", "description": "amount of photos over time", "fieldConfig": { "defaults": { @@ -1133,10 +1034,7 @@ }, "targets": [ { - "datasource": { - "type": "prometheus", - "uid": "o-nLTb0Vz" - }, + "datasource": "Prometheus", "editorMode": "code", "expr": "immich_server_stats_photos_by_users", "legendFormat": "{{firstName}}", @@ -1149,10 +1047,7 @@ "type": "timeseries" }, { - "datasource": { - "type": "prometheus", - "uid": "o-nLTb0Vz" - }, + "datasource": "Prometheus", "fieldConfig": { "defaults": { "color": { @@ -1196,10 +1091,7 @@ "pluginVersion": "9.4.3", "targets": [ { - "datasource": { - "type": "prometheus", - "uid": "o-nLTb0Vz" - }, + "datasource": "Prometheus", "editorMode": "code", "expr": "increase(immich_server_stats_videos_growth[1d])", "legendFormat": "__auto", @@ -1212,10 +1104,7 @@ "type": "stat" }, { - "datasource": { - "type": "prometheus", - "uid": "o-nLTb0Vz" - }, + "datasource": "Prometheus", "fieldConfig": { "defaults": { "color": { @@ -1259,10 +1148,7 @@ "pluginVersion": "9.4.3", "targets": [ { - "datasource": { - "type": "prometheus", - "uid": "o-nLTb0Vz" - }, + "datasource": "Prometheus", "editorMode": "code", "expr": "increase(immich_server_stats_videos_growth[1w])", "legendFormat": "__auto", @@ -1275,10 +1161,7 @@ "type": "stat" }, { - "datasource": { - "type": "prometheus", - "uid": "o-nLTb0Vz" - }, + "datasource": "Prometheus", "fieldConfig": { "defaults": { "color": { @@ -1327,10 +1210,7 @@ }, "targets": [ { - "datasource": { - "type": "prometheus", - "uid": "o-nLTb0Vz" - }, + "datasource": "Prometheus", "editorMode": "code", "expr": "immich_server_stats_videos_by_users", "legendFormat": "{{firstName}}", @@ -1342,10 +1222,7 @@ "type": "piechart" }, { - "datasource": { - "type": "prometheus", - "uid": "o-nLTb0Vz" - }, + "datasource": "Prometheus", "fieldConfig": { "defaults": { "color": { @@ -1389,10 +1266,7 @@ "pluginVersion": "9.4.3", "targets": [ { - "datasource": { - "type": "prometheus", - "uid": "o-nLTb0Vz" - }, + "datasource": "Prometheus", "editorMode": "code", "expr": "increase(immich_server_stats_videos_growth[4w])\r\n", "legendFormat": "__auto", @@ -1405,10 +1279,7 @@ "type": "stat" }, { - "datasource": { - "type": "prometheus", - "uid": "o-nLTb0Vz" - }, + "datasource": "Prometheus", "fieldConfig": { "defaults": { "color": { @@ -1452,10 +1323,7 @@ "pluginVersion": "9.4.3", "targets": [ { - "datasource": { - "type": "prometheus", - "uid": "o-nLTb0Vz" - }, + "datasource": "Prometheus", "editorMode": "code", "expr": "increase(immich_server_stats_videos_growth[52w])\r\n", "legendFormat": "__auto", @@ -1468,10 +1336,7 @@ "type": "stat" }, { - "datasource": { - "type": "prometheus", - "uid": "o-nLTb0Vz" - }, + "datasource": "Prometheus", "description": "amount of videos over time", "fieldConfig": { "defaults": { @@ -1545,10 +1410,7 @@ }, "targets": [ { - "datasource": { - "type": "prometheus", - "uid": "o-nLTb0Vz" - }, + "datasource": "Prometheus", "editorMode": "code", "expr": "immich_server_stats_videos_by_users", "legendFormat": "{{firstName}}", From fb668bf3e2d20f941fcc2de81a6653a4b0b7559b Mon Sep 17 00:00:00 2001 From: Vegard Fladby Date: Thu, 20 Jul 2023 18:00:32 +0200 Subject: [PATCH 2/4] Allow change of datasource/select datasource at import. --- grafana/dashboard-immich.json | 318 ++++++++++++++++++++++++++-------- 1 file changed, 248 insertions(+), 70 deletions(-) diff --git a/grafana/dashboard-immich.json b/grafana/dashboard-immich.json index 7185ac0..cc95ea5 100644 --- a/grafana/dashboard-immich.json +++ b/grafana/dashboard-immich.json @@ -1,4 +1,47 @@ { + "__inputs": [ + { + "name": "DS_PROMETHEUS", + "label": "Prometheus", + "description": "", + "type": "datasource", + "pluginId": "prometheus", + "pluginName": "Prometheus" + } + ], + "__elements": {}, + "__requires": [ + { + "type": "grafana", + "id": "grafana", + "name": "Grafana", + "version": "10.0.2" + }, + { + "type": "panel", + "id": "piechart", + "name": "Pie chart", + "version": "" + }, + { + "type": "datasource", + "id": "prometheus", + "name": "Prometheus", + "version": "1.0.0" + }, + { + "type": "panel", + "id": "stat", + "name": "Stat", + "version": "" + }, + { + "type": "panel", + "id": "timeseries", + "name": "Time series", + "version": "" + } + ], "annotations": { "list": [ { @@ -24,12 +67,15 @@ "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 0, - "id": 11, + "id": null, "links": [], "liveNow": false, "panels": [ { - "datasource": "Prometheus", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, "fieldConfig": { "defaults": { "color": { @@ -72,10 +118,13 @@ }, "textMode": "name" }, - "pluginVersion": "9.4.3", + "pluginVersion": "10.0.2", "targets": [ { - "datasource": "Prometheus", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, "editorMode": "code", "exemplar": false, "expr": "immich_server_info_version_number", @@ -89,7 +138,10 @@ "type": "stat" }, { - "datasource": "Prometheus", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, "fieldConfig": { "defaults": { "color": { @@ -133,10 +185,13 @@ }, "textMode": "auto" }, - "pluginVersion": "9.4.3", + "pluginVersion": "10.0.2", "targets": [ { - "datasource": "Prometheus", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, "editorMode": "code", "expr": "immich_server_stats_user_count", "legendFormat": "__auto", @@ -148,7 +203,10 @@ "type": "stat" }, { - "datasource": "Prometheus", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, "fieldConfig": { "defaults": { "color": { @@ -189,10 +247,13 @@ }, "textMode": "auto" }, - "pluginVersion": "9.4.3", + "pluginVersion": "10.0.2", "targets": [ { - "datasource": "Prometheus", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, "editorMode": "code", "expr": "sum(immich_server_stats_usage_by_users)", "legendFormat": "__auto", @@ -204,7 +265,10 @@ "type": "stat" }, { - "datasource": "Prometheus", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, "fieldConfig": { "defaults": { "color": { @@ -245,10 +309,13 @@ }, "textMode": "auto" }, - "pluginVersion": "9.4.3", + "pluginVersion": "10.0.2", "targets": [ { - "datasource": "Prometheus", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, "editorMode": "code", "expr": "immich_server_info_totalDiskSize", "legendFormat": "__auto", @@ -260,7 +327,10 @@ "type": "stat" }, { - "datasource": "Prometheus", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, "fieldConfig": { "defaults": { "color": { @@ -301,10 +371,13 @@ }, "textMode": "auto" }, - "pluginVersion": "9.4.3", + "pluginVersion": "10.0.2", "targets": [ { - "datasource": "Prometheus", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, "editorMode": "code", "expr": "immich_server_info_diskUse", "legendFormat": "__auto", @@ -316,7 +389,10 @@ "type": "stat" }, { - "datasource": "Prometheus", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, "fieldConfig": { "defaults": { "color": { @@ -357,10 +433,13 @@ }, "textMode": "auto" }, - "pluginVersion": "9.4.3", + "pluginVersion": "10.0.2", "targets": [ { - "datasource": "Prometheus", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, "editorMode": "code", "exemplar": false, "expr": "100 - immich_server_info_diskUsagePercentage", @@ -376,7 +455,10 @@ "type": "stat" }, { - "datasource": "Prometheus", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, "fieldConfig": { "defaults": { "color": { @@ -418,10 +500,13 @@ }, "textMode": "auto" }, - "pluginVersion": "9.4.3", + "pluginVersion": "10.0.2", "targets": [ { - "datasource": "Prometheus", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, "editorMode": "code", "exemplar": false, "expr": "increase(immich_server_stats_usage_growth[24h])", @@ -436,7 +521,10 @@ "type": "stat" }, { - "datasource": "Prometheus", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, "fieldConfig": { "defaults": { "color": { @@ -478,10 +566,13 @@ }, "textMode": "auto" }, - "pluginVersion": "9.4.3", + "pluginVersion": "10.0.2", "targets": [ { - "datasource": "Prometheus", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, "editorMode": "code", "expr": "increase(immich_server_stats_useage_growth[7d])", "legendFormat": "__auto", @@ -494,7 +585,10 @@ "type": "stat" }, { - "datasource": "Prometheus", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, "fieldConfig": { "defaults": { "color": { @@ -543,7 +637,10 @@ }, "targets": [ { - "datasource": "Prometheus", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, "editorMode": "code", "expr": "immich_server_stats_usage_by_users", "legendFormat": "{{firstName}}", @@ -555,7 +652,10 @@ "type": "piechart" }, { - "datasource": "Prometheus", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, "fieldConfig": { "defaults": { "color": { @@ -597,10 +697,13 @@ }, "textMode": "auto" }, - "pluginVersion": "9.4.3", + "pluginVersion": "10.0.2", "targets": [ { - "datasource": "Prometheus", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, "editorMode": "code", "expr": "increase(immich_server_stats_usage_growth[30h])", "legendFormat": "__auto", @@ -613,7 +716,10 @@ "type": "stat" }, { - "datasource": "Prometheus", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, "fieldConfig": { "defaults": { "color": { @@ -655,10 +761,13 @@ }, "textMode": "auto" }, - "pluginVersion": "9.4.3", + "pluginVersion": "10.0.2", "targets": [ { - "datasource": "Prometheus", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, "editorMode": "code", "expr": "increase(immich_server_stats_useage_growth[365d])", "legendFormat": "__auto", @@ -671,7 +780,10 @@ "type": "stat" }, { - "datasource": "Prometheus", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, "fieldConfig": { "defaults": { "mappings": [], @@ -710,10 +822,13 @@ }, "textMode": "auto" }, - "pluginVersion": "9.4.3", + "pluginVersion": "10.0.2", "targets": [ { - "datasource": "Prometheus", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, "editorMode": "code", "expr": "increase(immich_server_stats_photos_growth[24h])", "legendFormat": "__auto", @@ -726,7 +841,10 @@ "type": "stat" }, { - "datasource": "Prometheus", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, "fieldConfig": { "defaults": { "mappings": [], @@ -765,10 +883,13 @@ }, "textMode": "auto" }, - "pluginVersion": "9.4.3", + "pluginVersion": "10.0.2", "targets": [ { - "datasource": "Prometheus", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, "editorMode": "code", "expr": "increase(immich_server_stats_photos_growth[7d])", "legendFormat": "__auto", @@ -781,7 +902,10 @@ "type": "stat" }, { - "datasource": "Prometheus", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, "fieldConfig": { "defaults": { "color": { @@ -830,7 +954,10 @@ }, "targets": [ { - "datasource": "Prometheus", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, "editorMode": "code", "exemplar": false, "expr": "immich_server_stats_photos_by_users", @@ -844,7 +971,10 @@ "type": "piechart" }, { - "datasource": "Prometheus", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, "fieldConfig": { "defaults": { "color": { @@ -885,10 +1015,13 @@ }, "textMode": "auto" }, - "pluginVersion": "9.4.3", + "pluginVersion": "10.0.2", "targets": [ { - "datasource": "Prometheus", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, "editorMode": "code", "expr": "increase(immich_server_stats_photos_growth[4w])", "legendFormat": "__auto", @@ -901,7 +1034,10 @@ "type": "stat" }, { - "datasource": "Prometheus", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, "fieldConfig": { "defaults": { "color": { @@ -942,10 +1078,13 @@ }, "textMode": "auto" }, - "pluginVersion": "9.4.3", + "pluginVersion": "10.0.2", "targets": [ { - "datasource": "Prometheus", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, "editorMode": "code", "expr": "increase(immich_server_stats_photos_growth[52w])", "legendFormat": "__auto", @@ -958,7 +1097,10 @@ "type": "stat" }, { - "datasource": "Prometheus", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, "description": "amount of photos over time", "fieldConfig": { "defaults": { @@ -1034,7 +1176,10 @@ }, "targets": [ { - "datasource": "Prometheus", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, "editorMode": "code", "expr": "immich_server_stats_photos_by_users", "legendFormat": "{{firstName}}", @@ -1047,7 +1192,10 @@ "type": "timeseries" }, { - "datasource": "Prometheus", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, "fieldConfig": { "defaults": { "color": { @@ -1088,10 +1236,13 @@ }, "textMode": "auto" }, - "pluginVersion": "9.4.3", + "pluginVersion": "10.0.2", "targets": [ { - "datasource": "Prometheus", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, "editorMode": "code", "expr": "increase(immich_server_stats_videos_growth[1d])", "legendFormat": "__auto", @@ -1104,7 +1255,10 @@ "type": "stat" }, { - "datasource": "Prometheus", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, "fieldConfig": { "defaults": { "color": { @@ -1145,10 +1299,13 @@ }, "textMode": "auto" }, - "pluginVersion": "9.4.3", + "pluginVersion": "10.0.2", "targets": [ { - "datasource": "Prometheus", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, "editorMode": "code", "expr": "increase(immich_server_stats_videos_growth[1w])", "legendFormat": "__auto", @@ -1161,7 +1318,10 @@ "type": "stat" }, { - "datasource": "Prometheus", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, "fieldConfig": { "defaults": { "color": { @@ -1210,7 +1370,10 @@ }, "targets": [ { - "datasource": "Prometheus", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, "editorMode": "code", "expr": "immich_server_stats_videos_by_users", "legendFormat": "{{firstName}}", @@ -1222,7 +1385,10 @@ "type": "piechart" }, { - "datasource": "Prometheus", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, "fieldConfig": { "defaults": { "color": { @@ -1233,8 +1399,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" } ] } @@ -1266,7 +1431,10 @@ "pluginVersion": "9.4.3", "targets": [ { - "datasource": "Prometheus", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, "editorMode": "code", "expr": "increase(immich_server_stats_videos_growth[4w])\r\n", "legendFormat": "__auto", @@ -1279,7 +1447,10 @@ "type": "stat" }, { - "datasource": "Prometheus", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, "fieldConfig": { "defaults": { "color": { @@ -1290,8 +1461,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" } ] } @@ -1323,7 +1493,10 @@ "pluginVersion": "9.4.3", "targets": [ { - "datasource": "Prometheus", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, "editorMode": "code", "expr": "increase(immich_server_stats_videos_growth[52w])\r\n", "legendFormat": "__auto", @@ -1336,7 +1509,10 @@ "type": "stat" }, { - "datasource": "Prometheus", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, "description": "amount of videos over time", "fieldConfig": { "defaults": { @@ -1381,8 +1557,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" } ] } @@ -1410,7 +1585,10 @@ }, "targets": [ { - "datasource": "Prometheus", + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, "editorMode": "code", "expr": "immich_server_stats_videos_by_users", "legendFormat": "{{firstName}}", @@ -1439,6 +1617,6 @@ "timezone": "", "title": "immich", "uid": "ZWWp3aa4k", - "version": 9, + "version": 1, "weekStart": "" } \ No newline at end of file From 513856beffcad781e733d039221d0c57e762c9c1 Mon Sep 17 00:00:00 2001 From: Vegard Fladby Date: Thu, 20 Jul 2023 18:15:05 +0200 Subject: [PATCH 3/4] Further edit of readme - Added better description on UnRaid template - Added Immich_api_token to readme - Populated default Immich_port 8080 in Dockerfile - Clarified that it's the Immich Proxy that you need to connect to, not Immich Server --- Dockerfile | 2 +- README.md | 23 ++++++----------------- unraid/prometheus-immich-exporter.xml | 6 +++--- 3 files changed, 10 insertions(+), 21 deletions(-) diff --git a/Dockerfile b/Dockerfile index a2c1b72..f58eb14 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,7 +14,7 @@ RUN pip3 install . ENV IMMICH_API_TOKEN="" ENV IMMICH_HOST="" -ENV IMMICH_PORT="" +ENV IMMICH_PORT="8080" #has to be EXPORT_PORT 8000 or else it does not work, same applies to the env file ENV EXPORTER_PORT="8000" ENV EXPORTER_LOG_LEVEL="INFO" diff --git a/README.md b/README.md index fc94115..1639c24 100644 --- a/README.md +++ b/README.md @@ -5,26 +5,14 @@ A prometheus exporter for Immich. Get metrics from a server and offers them in a ## How to use it -You can install this exporter with the following command: - -```bash -pip3 install prometheus-qbittorrent-exporter -``` - -Then you can run it with +Here is an example docker run command ``` -immich-exporter -``` - -Another option is to run it in a docker container. Here is an example docker run command - -``` -docker run -e IMMICH_PORT=8010 -e IMMICH_HOST=192.168.178.1 -p 8000:8000 friendlyfriend/prometheus-immich-exporter +docker run -e IMMICH_PORT=8080 -e IMMICH_HOST=192.168.178.1 -e IMMICH_API_TOKEN=TOKEN -p 8000:8000 friendlyfriend/prometheus-immich-exporter ``` Add this to your prometheus.yml ``` - - job_name: "immich_exporter" + - job_name: "Immich_exporter" static_configs: - targets: ['yourimmichexporter:port'] ``` @@ -32,8 +20,9 @@ The application reads configuration using environment variables: | Environment variable | Default | Description | |----------------------|----------|----------------------------------------------------| -| `IMMICH_HOST` | | immich server hostname | -| `IMMICH_PORT` | | immich server port | +| `IMMICH_HOST` | | Immich proxy url | +| `IMMICH_PORT` | `8080` | Immich proxy port | +| `IMMICH_API_TOKEN` | | Immich API token, created from Immich dashboard | | `EXPORTER_PORT` | `8000` | Exporter listening port | | `EXPORTER_LOG_LEVEL` | `INFO` | Log level. One of: `DEBUG`, `INFO`, `WARNING`, `ERROR`, `CRITICAL` | | `METRICS_PREFIX` | `immich` | Prefix to add to all the metrics | diff --git a/unraid/prometheus-immich-exporter.xml b/unraid/prometheus-immich-exporter.xml index 41bc295..6953cb7 100644 --- a/unraid/prometheus-immich-exporter.xml +++ b/unraid/prometheus-immich-exporter.xml @@ -21,8 +21,8 @@ If I made your day a little bit brighter, consider donating. https://www.paypal.com/donate/?hosted_button_id=DPDKED3T3BFV8 - 8028 + 8000 - - + + \ No newline at end of file From 99c9b84f40ab21f314099e02765188c61f94f7d7 Mon Sep 17 00:00:00 2001 From: Vegard Fladby Date: Thu, 20 Jul 2023 20:14:28 +0200 Subject: [PATCH 4/4] Further optimization of Dashboard: - Formated text to make it consistent - Changed hours/days/month/year to use 1d/1w/4w/1y - Changed Weekly data growth to use 1w to show the last 7 days. - Changed Monthly data growth to use 4w to show the last 4 weeks. - Changed Yearly data growth to use 1y to show the last 1y. - Added Photos growth last year visual - Added Videos growth last year visual - Corrected some spelling errors in 'expr' so that the values are now calculated correctly --- grafana/dashboard-immich.json | 285 ++++++++++++++++++++++++++++------ 1 file changed, 235 insertions(+), 50 deletions(-) diff --git a/grafana/dashboard-immich.json b/grafana/dashboard-immich.json index cc95ea5..a780227 100644 --- a/grafana/dashboard-immich.json +++ b/grafana/dashboard-immich.json @@ -199,7 +199,7 @@ "refId": "A" } ], - "title": "user count", + "title": "User count", "type": "stat" }, { @@ -261,7 +261,7 @@ "refId": "A" } ], - "title": "disk space used by Immich", + "title": "Disk space used by Immich", "type": "stat" }, { @@ -323,7 +323,7 @@ "refId": "A" } ], - "title": "total disk size", + "title": "Total disk size", "type": "stat" }, { @@ -385,7 +385,7 @@ "refId": "A" } ], - "title": "total disk size usage", + "title": "Total disk size usage", "type": "stat" }, { @@ -451,7 +451,7 @@ "refId": "A" } ], - "title": "remaining disk size", + "title": "Remaining disk size", "type": "stat" }, { @@ -484,7 +484,7 @@ "x": 0, "y": 3 }, - "hideTimeOverride": true, + "hideTimeOverride": false, "id": 24, "options": { "colorMode": "background", @@ -509,7 +509,7 @@ }, "editorMode": "code", "exemplar": false, - "expr": "increase(immich_server_stats_usage_growth[24h])", + "expr": "increase(immich_server_stats_usage_growth[1d])", "instant": false, "legendFormat": "__auto", "range": true, @@ -550,7 +550,7 @@ "x": 6, "y": 3 }, - "hideTimeOverride": true, + "hideTimeOverride": false, "id": 26, "options": { "colorMode": "background", @@ -574,13 +574,13 @@ "uid": "${DS_PROMETHEUS}" }, "editorMode": "code", - "expr": "increase(immich_server_stats_useage_growth[7d])", + "expr": "increase(immich_server_stats_usage_growth[1w])", "legendFormat": "__auto", "range": true, "refId": "A" } ], - "timeFrom": "now/w", + "timeFrom": "1w", "title": "Weekly data growth", "type": "stat" }, @@ -648,7 +648,7 @@ "refId": "A" } ], - "title": "disk usage by user", + "title": "Disk usage by user", "type": "piechart" }, { @@ -681,7 +681,7 @@ "x": 0, "y": 7 }, - "hideTimeOverride": true, + "hideTimeOverride": false, "id": 28, "options": { "colorMode": "background", @@ -705,13 +705,13 @@ "uid": "${DS_PROMETHEUS}" }, "editorMode": "code", - "expr": "increase(immich_server_stats_usage_growth[30h])", + "expr": "increase(immich_server_stats_usage_growth[4w])", "legendFormat": "__auto", "range": true, "refId": "A" } ], - "timeFrom": "now/M", + "timeFrom": "1M", "title": "Monthly data growth", "type": "stat" }, @@ -745,7 +745,7 @@ "x": 6, "y": 7 }, - "hideTimeOverride": true, + "hideTimeOverride": false, "id": 30, "options": { "colorMode": "background", @@ -769,14 +769,14 @@ "uid": "${DS_PROMETHEUS}" }, "editorMode": "code", - "expr": "increase(immich_server_stats_useage_growth[365d])", + "expr": "increase(immich_server_stats_usage_growth[1y])", "legendFormat": "__auto", "range": true, "refId": "A" } ], - "timeFrom": "now/y", - "title": "Yealy data growth", + "timeFrom": "1y", + "title": "Yearly data growth", "type": "stat" }, { @@ -837,7 +837,7 @@ } ], "timeFrom": "now/d", - "title": "daily photos growth", + "title": "Daily photos growth", "type": "stat" }, { @@ -897,8 +897,8 @@ "refId": "A" } ], - "timeFrom": "now/w", - "title": "weekly photos growth", + "timeFrom": "1w", + "title": "Weekly photos growth", "type": "stat" }, { @@ -1029,7 +1029,7 @@ "refId": "A" } ], - "timeFrom": "now/M", + "timeFrom": "1M", "title": "Monthly photos growth", "type": "stat" }, @@ -1086,14 +1086,14 @@ "uid": "${DS_PROMETHEUS}" }, "editorMode": "code", - "expr": "increase(immich_server_stats_photos_growth[52w])", + "expr": "increase(immich_server_stats_photos_growth[1y])", "legendFormat": "__auto", "range": true, "refId": "A" } ], - "timeFrom": "now/y", - "title": "yearly photos growth", + "timeFrom": "1y", + "title": "Yearly photos growth", "type": "stat" }, { @@ -1160,7 +1160,7 @@ "x": 0, "y": 19 }, - "hideTimeOverride": true, + "hideTimeOverride": false, "id": 22, "options": { "legend": { @@ -1187,8 +1187,103 @@ "refId": "A" } ], - "timeFrom": "now/M", - "title": "Monthly Photos Growth", + "timeFrom": "1M", + "title": "Photos Growth", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "description": "amount of photos over time", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "right", + "axisSoftMin": 9000, + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 30, + "gradientMode": "opacity", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineStyle": { + "fill": "solid" + }, + "lineWidth": 1, + "pointSize": 1, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": true, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 24, + "x": 0, + "y": 26 + }, + "hideTimeOverride": false, + "id": 47, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "immich_server_stats_photos_by_users", + "legendFormat": "{{firstName}}", + "range": true, + "refId": "A" + } + ], + "timeFrom": "1y", + "title": "Photos Growth", "type": "timeseries" }, { @@ -1206,8 +1301,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" } ] } @@ -1218,7 +1312,7 @@ "h": 4, "w": 6, "x": 0, - "y": 26 + "y": 33 }, "hideTimeOverride": true, "id": 42, @@ -1251,7 +1345,7 @@ } ], "timeFrom": "now/d", - "title": "daily video growth", + "title": "Daily video growth", "type": "stat" }, { @@ -1269,8 +1363,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" } ] } @@ -1281,7 +1374,7 @@ "h": 4, "w": 6, "x": 6, - "y": 26 + "y": 33 }, "hideTimeOverride": true, "id": 40, @@ -1313,8 +1406,8 @@ "refId": "A" } ], - "timeFrom": "now/w", - "title": "weekly videos growth", + "timeFrom": "1w", + "title": "Weekly videos growth", "type": "stat" }, { @@ -1342,7 +1435,7 @@ "h": 8, "w": 12, "x": 12, - "y": 26 + "y": 33 }, "id": 6, "options": { @@ -1381,7 +1474,7 @@ "refId": "A" } ], - "title": "videos", + "title": "Videos", "type": "piechart" }, { @@ -1410,7 +1503,7 @@ "h": 4, "w": 6, "x": 0, - "y": 30 + "y": 37 }, "hideTimeOverride": true, "id": 44, @@ -1428,7 +1521,7 @@ }, "textMode": "auto" }, - "pluginVersion": "9.4.3", + "pluginVersion": "10.0.2", "targets": [ { "datasource": { @@ -1442,7 +1535,7 @@ "refId": "A" } ], - "timeFrom": "now/M", + "timeFrom": "1M", "title": "Monthly videos growth", "type": "stat" }, @@ -1472,7 +1565,7 @@ "h": 4, "w": 6, "x": 6, - "y": 30 + "y": 37 }, "hideTimeOverride": true, "id": 46, @@ -1490,7 +1583,7 @@ }, "textMode": "auto" }, - "pluginVersion": "9.4.3", + "pluginVersion": "10.0.2", "targets": [ { "datasource": { @@ -1498,14 +1591,14 @@ "uid": "${DS_PROMETHEUS}" }, "editorMode": "code", - "expr": "increase(immich_server_stats_videos_growth[52w])\r\n", + "expr": "increase(immich_server_stats_videos_growth[1y])\r\n", "legendFormat": "__auto", "range": true, "refId": "A" } ], - "timeFrom": "now/y", - "title": "Panel Title", + "timeFrom": "1y", + "title": "Yearly video growth", "type": "stat" }, { @@ -1568,7 +1661,7 @@ "h": 8, "w": 24, "x": 0, - "y": 34 + "y": 41 }, "id": 20, "options": { @@ -1596,7 +1689,99 @@ "refId": "A" } ], - "timeFrom": "now/M", + "timeFrom": "1M", + "title": "Videos growth", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "description": "amount of videos over time", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "right", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 30, + "gradientMode": "opacity", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "linear", + "lineStyle": { + "fill": "solid" + }, + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": true, + "stacking": { + "group": "A", + "mode": "normal" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 24, + "x": 0, + "y": 49 + }, + "id": 48, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "editorMode": "code", + "expr": "immich_server_stats_videos_by_users", + "legendFormat": "{{firstName}}", + "range": true, + "refId": "A" + } + ], + "timeFrom": "1y", "title": "Videos growth", "type": "timeseries" } @@ -1617,6 +1802,6 @@ "timezone": "", "title": "immich", "uid": "ZWWp3aa4k", - "version": 1, + "version": 9, "weekStart": "" } \ No newline at end of file