diff --git a/public/locales/en/common.json b/public/locales/en/common.json
index 6bb3377e6..5b3608b69 100755
--- a/public/locales/en/common.json
+++ b/public/locales/en/common.json
@@ -521,5 +521,10 @@
"pterodactyl": {
"servers": "Servers",
"nodes": "Nodes"
+ },
+ "prometheus": {
+ "targets_up": "Targets Up",
+ "targets_down": "Targets Down",
+ "targets_total": "Total Targets"
}
}
diff --git a/src/widgets/components.js b/src/widgets/components.js
index 28a70755c..f8d766ce0 100644
--- a/src/widgets/components.js
+++ b/src/widgets/components.js
@@ -75,6 +75,7 @@ const components = {
xteve: dynamic(() => import("./xteve/component")),
immich: dynamic(() => import("./immich/component")),
uptimekuma: dynamic(() => import("./uptimekuma/component")),
+ prometheus: dynamic(() => import("./prometheus/component")),
};
export default components;
diff --git a/src/widgets/prometheus/component.jsx b/src/widgets/prometheus/component.jsx
new file mode 100644
index 000000000..f8cea560c
--- /dev/null
+++ b/src/widgets/prometheus/component.jsx
@@ -0,0 +1,38 @@
+import { useTranslation } from "next-i18next";
+
+import Container from "components/services/widget/container";
+import Block from "components/services/widget/block";
+import useWidgetAPI from "utils/proxy/use-widget-api";
+
+export default function Component({ service }) {
+ const { t } = useTranslation();
+
+ const { widget } = service;
+ const { data: targetsData, error: targetsError } = useWidgetAPI(widget, "targets");
+
+ if (targetsError) {
+ return ;
+ }
+
+ if (!targetsData) {
+ return (
+
+
+
+
+
+ );
+ }
+
+ const upCount = targetsData.data.activeTargets.filter(a => a.health === "up").length;
+ const downCount = targetsData.data.activeTargets.filter(a => a.health === "down").length;
+ const totalCount = targetsData.data.activeTargets.length;
+
+ return (
+
+
+
+
+
+ );
+}
diff --git a/src/widgets/prometheus/widget.js b/src/widgets/prometheus/widget.js
new file mode 100644
index 000000000..40754477f
--- /dev/null
+++ b/src/widgets/prometheus/widget.js
@@ -0,0 +1,17 @@
+import genericProxyHandler from "utils/proxy/handlers/generic";
+
+const widget = {
+ api: "{url}/api/v1/{endpoint}",
+ proxyHandler: genericProxyHandler,
+
+ mappings: {
+ targets: {
+ endpoint: "targets",
+ validate: [
+ "data"
+ ]
+ },
+ },
+};
+
+export default widget;
\ No newline at end of file
diff --git a/src/widgets/widgets.js b/src/widgets/widgets.js
index 5d4b74a23..716257737 100644
--- a/src/widgets/widgets.js
+++ b/src/widgets/widgets.js
@@ -69,6 +69,7 @@ import xteve from "./xteve/widget";
import immich from "./immich/widget";
import uptimekuma from "./uptimekuma/widget";
import unmanic from "./unmanic/widget";
+import prometheus from "./prometheus/widget";
const widgets = {
adguard,
@@ -144,6 +145,7 @@ const widgets = {
xteve,
immich,
uptimekuma,
+ prometheus
};
export default widgets;