diff --git a/client/src/Hooks/useStatusPageForm.ts b/client/src/Hooks/useStatusPageForm.ts
index a079095cc..0011ea761 100644
--- a/client/src/Hooks/useStatusPageForm.ts
+++ b/client/src/Hooks/useStatusPageForm.ts
@@ -27,12 +27,14 @@ export const useStatusPageForm = ({
companyName: data?.companyName || "",
url: data?.url || generateDefaultUrl(),
timezone: data?.timezone || Intl.DateTimeFormat().resolvedOptions().timeZone,
+ type: data?.type || ["uptime"],
color: data?.color || "#4169E1",
monitors: data?.monitors || [],
isPublished: data?.isPublished ?? false,
showCharts: data?.showCharts ?? true,
showUptimePercentage: data?.showUptimePercentage ?? true,
showAdminLoginLink: data?.showAdminLoginLink ?? false,
+ showInfrastructure: data?.showInfrastructure ?? false,
customCSS: data?.customCSS || "",
logo: transformLogo(data?.logo),
};
diff --git a/client/src/Pages/CreateMonitor/index.tsx b/client/src/Pages/CreateMonitor/index.tsx
index b80cddaaa..15b76eab3 100644
--- a/client/src/Pages/CreateMonitor/index.tsx
+++ b/client/src/Pages/CreateMonitor/index.tsx
@@ -302,49 +302,49 @@ const CreateMonitorPage = () => {
>
{
// Fetch existing status page data when configuring
const { data: statusPageData, isLoading: isLoadingStatusPage } =
- useGet(isCreate ? null : `/status-page/${url}?type=uptime`);
+ useGet(
+ isCreate ? null : `/status-page/${url}?type=uptime&type=infrastructure`
+ );
const { data: monitorsResponse } = useGet(
- "/monitors/team?type=http&type=ping&type=port&type=docker"
+ "/monitors/team?type=http&type=ping&type=port&type=docker&type=hardware"
);
const monitors = monitorsResponse ?? [];
@@ -81,6 +83,27 @@ const CreateStatusPage = () => {
reset(defaults);
}, [defaults, reset]);
+ const watchedMonitorIds: string[] = form.watch("monitors") ?? [];
+ useEffect(() => {
+ const selectedMonitors = (watchedMonitorIds ?? [])
+ .map((id) => monitors.find((m) => m.id === id))
+ .filter((m): m is Monitor => m !== undefined);
+
+ const typesSet: Set = new Set();
+ selectedMonitors.forEach((m) => {
+ if (m.type === "hardware") {
+ typesSet.add("infrastructure");
+ } else {
+ typesSet.add("uptime");
+ }
+ });
+
+ const computedTypes: MonitorDisplayType[] = typesSet.size
+ ? Array.from(typesSet)
+ : ["uptime"];
+ form.setValue("type", computedTypes);
+ }, [watchedMonitorIds, monitors, form]);
+
const onError = (errors: any) => {
logger.debug("Status page validation errors", errors);
};
@@ -103,7 +126,6 @@ const CreateStatusPage = () => {
const onSubmit = async (data: StatusPageFormData) => {
const fd = new FormData();
- fd.append("type", "uptime");
fd.append("isPublished", String(data.isPublished));
if (data.companyName) fd.append("companyName", data.companyName);
if (data.url) fd.append("url", data.url);
@@ -112,11 +134,16 @@ const CreateStatusPage = () => {
fd.append("showCharts", String(data.showCharts));
fd.append("showUptimePercentage", String(data.showUptimePercentage));
fd.append("showAdminLoginLink", String(data.showAdminLoginLink));
+ fd.append("showInfrastructure", String(data.showInfrastructure));
data.monitors.forEach((monitorId) => {
fd.append("monitors[]", monitorId);
});
+ data.type.forEach((type) => {
+ fd.append("type[]", type);
+ });
+
// Handle logo upload
if (data.logo === null) {
// Signal to remove the logo
@@ -303,7 +330,9 @@ const CreateStatusPage = () => {
}}
>
- {monitor.name}
+ {`${monitor.name} (${t(`pages.common.monitors.monitorTypes.option${monitor?.type.charAt(0).toUpperCase() + monitor?.type.slice(1)}`)})`}
{
@@ -425,6 +454,23 @@ const CreateStatusPage = () => {
/>
)}
/>
+ (
+
+ }
+ label={t(
+ "pages.statusPages.form.features.option.showInfrastructure.label"
+ )}
+ />
+ )}
+ />
{/* {
+ const theme = useTheme();
+ return (
+
+
+ {label}
+
+ {value}
+
+ );
+};
+
+interface MetricItemProps {
+ label: string;
+ progress: number;
+ details?: MetricDetailRowProps[];
+}
+
+const MetricItem = ({ label, progress, details }: MetricItemProps) => {
+ const theme = useTheme();
+ const isSmall = useMediaQuery(theme.breakpoints.down("md"));
+ return (
+
+
+
+ {label}
+
+ {details && details.length > 0 && (
+
+ {details.map((detail) => (
+
+ ))}
+
+ )}
+
+ );
+};
+
+export const InfrastructureMetrics = ({ monitor }: { monitor: StatusPageMonitor }) => {
+ const theme = useTheme();
+ const { t } = useTranslation();
+
+ const latestCheck = monitor.recentChecks?.[0] ?? monitor.checks?.[0];
+
+ if (!latestCheck) {
+ return (
+
+ {t("pages.statusPages.monitorsList.noData")}
+
+ );
+ }
+
+ const metrics = [
+ {
+ key: t("pages.statusPages.monitorsList.infrastructure.cpu"),
+ labelKey: t("pages.statusPages.monitorsList.infrastructure.cpu"),
+ hasData: latestCheck.cpu && typeof latestCheck.cpu.usage_percent === "number",
+ progress: latestCheck.cpu?.usage_percent ? latestCheck.cpu.usage_percent * 100 : 0,
+ details: [
+ {
+ label: t("pages.statusPages.monitorsList.infrastructure.usage"),
+ value: `${((latestCheck.cpu?.usage_percent || 0) * 100).toFixed(2)}%`,
+ },
+ ],
+ },
+ {
+ key: t("pages.statusPages.monitorsList.infrastructure.memoryText"),
+ labelKey: t("pages.statusPages.monitorsList.infrastructure.memory"),
+ hasData:
+ latestCheck.memory &&
+ typeof latestCheck.memory.usage_percent === "number" &&
+ typeof latestCheck.memory.used_bytes === "number" &&
+ typeof latestCheck.memory.total_bytes === "number",
+ progress: latestCheck.memory?.usage_percent
+ ? latestCheck.memory.usage_percent * 100
+ : 0,
+ details: [
+ {
+ label: t("pages.statusPages.monitorsList.infrastructure.used"),
+ value: prettyBytes(latestCheck.memory?.used_bytes || 0),
+ },
+ {
+ label: t("pages.statusPages.monitorsList.infrastructure.total"),
+ value: prettyBytes(latestCheck.memory?.total_bytes || 0),
+ },
+ ],
+ },
+ {
+ key: t("pages.statusPages.monitorsList.infrastructure.disk"),
+ labelKey: t("pages.statusPages.monitorsList.infrastructure.disk"),
+ hasData: latestCheck.disk && latestCheck.disk.length > 0,
+ progress: latestCheck.disk
+ ? (latestCheck.disk.reduce((acc, disk) => acc + (disk?.usage_percent || 0), 0) /
+ latestCheck.disk.length) *
+ 100
+ : 0,
+ details: [
+ {
+ label: t("pages.statusPages.monitorsList.infrastructure.used"),
+ value: prettyBytes(
+ latestCheck?.disk?.reduce((acc, disk) => acc + (disk?.used_bytes || 0), 0) ??
+ 0
+ ),
+ },
+ {
+ label: t("pages.statusPages.monitorsList.infrastructure.total"),
+ value: prettyBytes(
+ latestCheck?.disk?.reduce((acc, disk) => acc + (disk?.total_bytes || 0), 0) ??
+ 0
+ ),
+ },
+ ],
+ },
+ ];
+
+ return (
+
+ {metrics.map(
+ ({ key, labelKey, hasData, progress, details }) =>
+ hasData && (
+
+ )
+ )}
+
+ );
+};
diff --git a/client/src/Pages/StatusPage/Status/Components/MonitorsList.tsx b/client/src/Pages/StatusPage/Status/Components/MonitorsList.tsx
index b94b20a80..c9212f0c4 100644
--- a/client/src/Pages/StatusPage/Status/Components/MonitorsList.tsx
+++ b/client/src/Pages/StatusPage/Status/Components/MonitorsList.tsx
@@ -5,13 +5,15 @@ import Typography from "@mui/material/Typography";
import { HistogramResponseTime, HeatmapResponseTime } from "@/Components/common";
import { StatusLabel, BaseBox } from "@/Components/design-elements";
import { SwitchComponent } from "@/Components/inputs";
+import { InfrastructureMetrics } from "@/Pages/StatusPage/Status/Components/InfrastructureMetrics";
-import { useTheme } from "@mui/material/styles";
+import { useTheme, type Theme } from "@mui/material/styles";
import { useSelector } from "react-redux";
import { useState } from "react";
import type { Monitor } from "@/Types/Monitor";
import type { StatusPage } from "@/Types/StatusPage";
import type { RootState } from "@/Types/state";
+import { LAYOUT, SPACING } from "@/Utils/Theme/constants";
interface StatusPageMonitor extends Monitor {
checks?: Monitor["recentChecks"];
@@ -22,6 +24,87 @@ interface MonitorsListProps {
monitors: StatusPageMonitor[];
}
+const getMonitorBadgeStyles = (monitorType: string, theme: Theme) => {
+ // for future: specific badge styles can be defined here based on monitor type
+ const badgeConfig: Record = {
+ hardware: {
+ color: theme.palette.background.paper,
+ bg: theme.palette.info.light,
+ },
+ http: {
+ color: theme.palette.background.paper,
+ bg: theme.palette.success.light,
+ },
+ ping: {
+ color: theme.palette.background.paper,
+ bg: theme.palette.success.light,
+ },
+ port: {
+ color: theme.palette.background.paper,
+ bg: theme.palette.success.light,
+ },
+ docker: {
+ color: theme.palette.background.paper,
+ bg: theme.palette.success.light,
+ },
+ pagespeed: {
+ color: theme.palette.background.paper,
+ bg: theme.palette.success.light,
+ },
+ game: {
+ color: theme.palette.background.paper,
+ bg: theme.palette.success.light,
+ },
+ };
+
+ const config = badgeConfig[monitorType] ?? badgeConfig.http;
+ return {
+ backgroundColor: config.bg,
+ color: config.color,
+ padding: `${theme.spacing(SPACING.SM)} ${theme.spacing(SPACING.LG)}`,
+ borderRadius: theme.shape.borderRadius,
+ };
+};
+
+// Extracted component for monitor content below the header row
+const MonitorContent = ({
+ monitor,
+ statusPage,
+ chartType,
+}: {
+ monitor: Monitor & { checks?: Monitor["recentChecks"] };
+ statusPage: StatusPage;
+ chartType: string;
+}) => {
+ const theme = useTheme();
+ const isInfrastructureMonitor = monitor?.type === "hardware";
+
+ if (isInfrastructureMonitor) {
+ if (statusPage.showInfrastructure === false) {
+ return null;
+ }
+ return ;
+ }
+
+ if (statusPage.showCharts === false) {
+ return null;
+ }
+
+ return (
+
+ {chartType === "histogram" ? (
+
+ ) : (
+
+ )}
+
+ );
+};
+
export const MonitorsList = ({ statusPage, monitors }: MonitorsListProps) => {
const theme = useTheme();
const { t } = useTranslation();
@@ -31,11 +114,12 @@ export const MonitorsList = ({ statusPage, monitors }: MonitorsListProps) => {
const [chartType, setChartType] = useState<"histogram" | "heatmap">("histogram");
return (
-
- {statusPage.showCharts !== false && (
+
+ {statusPage.showCharts && (
{t("pages.statusPages.monitorsList.chartTypeHeatmap")}
{
return (
-
- {monitor.name}
-
- {showURL && (
+
+ {monitor.name}
+
+
+ {t(
+ `pages.common.monitors.monitorTypes.option${monitor?.type.charAt(0).toUpperCase() + monitor?.type.slice(1)}`
+ )}
+
+
+ {showURL && monitor?.url && (
{monitor.url}
)}
-
+
- {statusPage.showCharts !== false && (
-
- {chartType === "histogram" ? (
-
- ) : (
-
- )}
-
- )}
+
);
})}
diff --git a/client/src/Pages/StatusPage/Status/index.tsx b/client/src/Pages/StatusPage/Status/index.tsx
index 0ca629581..77aa0892a 100644
--- a/client/src/Pages/StatusPage/Status/index.tsx
+++ b/client/src/Pages/StatusPage/Status/index.tsx
@@ -23,16 +23,17 @@ const StatusPageView = () => {
const isSmall = useMediaQuery(theme.breakpoints.down("md"));
const isPublic = location.pathname.startsWith("/status/public");
- const apiUrl = url ? `/status-page/${url}?type=uptime` : null;
+ const apiUrl = url ? `/status-page/${url}?type=uptime&type=infrastructure` : null;
const { data, isLoading, error } = useGet(apiUrl);
const statusPage = data?.statusPage;
const monitors = data?.monitors ?? [];
+ const infrastructureMonitors = data?.infrastructureMonitors ?? [];
if (!statusPage) return null;
- if (monitors?.length === 0) {
+ if (monitors?.length === 0 && infrastructureMonitors?.length === 0) {
return (
row.type,
+ render: (row) => row.type.join(", "),
},
{
id: "status",
diff --git a/client/src/Types/StatusPage.ts b/client/src/Types/StatusPage.ts
index 900373f3d..370cc23b5 100644
--- a/client/src/Types/StatusPage.ts
+++ b/client/src/Types/StatusPage.ts
@@ -1,10 +1,11 @@
import type { Monitor } from "@/Types/Monitor";
+export type MonitorDisplayType = "uptime" | "infrastructure";
export interface StatusPage {
id: string;
userId: string;
teamId: string;
- type: string;
+ type: MonitorDisplayType[];
companyName: string;
url: string;
timezone?: string;
@@ -20,6 +21,7 @@ export interface StatusPage {
showCharts: boolean;
showUptimePercentage: boolean;
showAdminLoginLink: boolean;
+ showInfrastructure: boolean;
customCSS: string;
createdAt: string;
updatedAt: string;
@@ -28,4 +30,5 @@ export interface StatusPage {
export interface StatusPageResponse {
statusPage: StatusPage;
monitors: Monitor[];
+ infrastructureMonitors: Monitor[];
}
diff --git a/client/src/Validation/statusPage.ts b/client/src/Validation/statusPage.ts
index fbe6a0690..43d7198f0 100644
--- a/client/src/Validation/statusPage.ts
+++ b/client/src/Validation/statusPage.ts
@@ -14,12 +14,16 @@ export const statusPageSchema = z.object({
"URL can only contain lowercase letters, numbers, and hyphens"
),
timezone: z.string().optional(),
+ type: z
+ .array(z.enum(["uptime", "infrastructure"]))
+ .min(1, "At least one type is required"),
color: z.string().min(1, "Color is required"),
monitors: z.array(z.string()).min(1, "At least one monitor is required"),
isPublished: z.boolean(),
showCharts: z.boolean(),
showUptimePercentage: z.boolean(),
showAdminLoginLink: z.boolean(),
+ showInfrastructure: z.boolean(),
customCSS: z.string().optional(),
logo: z
.object({
diff --git a/client/src/Validation/validation.js b/client/src/Validation/validation.js
index fa92f2e99..c11543cad 100644
--- a/client/src/Validation/validation.js
+++ b/client/src/Validation/validation.js
@@ -288,7 +288,13 @@ const logoImageValidation = joi
.optional(); // Make entire object optional
const statusPageValidation = joi.object({
- type: joi.string().valid("uptime").required(),
+ type: joi
+ .alternatives()
+ .try(
+ joi.string().valid("uptime", "infrastructure"),
+ joi.array().items(joi.string().valid("uptime", "infrastructure"))
+ )
+ .required(),
isPublished: joi.bool(),
companyName: joi
.string()
@@ -317,6 +323,7 @@ const statusPageValidation = joi.object({
showUptimePercentage: joi.boolean(),
showCharts: joi.boolean(),
showAdminLoginLink: joi.boolean(),
+ showInfrastructure: joi.boolean(),
});
const settingsValidation = joi.object({
diff --git a/client/src/locales/en.json b/client/src/locales/en.json
index 04e18e3dc..dbe037447 100644
--- a/client/src/locales/en.json
+++ b/client/src/locales/en.json
@@ -407,6 +407,17 @@
"paused": "paused",
"total": "total",
"up": "up"
+ },
+ "monitorTypes": {
+ "optionDocker": "Docker",
+ "optionGame": "Game",
+ "optionHttp": "HTTP(S)",
+ "optionPing": "Ping",
+ "optionPort": "Port",
+ "optionPagespeed": "PageSpeed",
+ "optionHardware": "Infrastructure",
+ "optionGrpc": "gRPC",
+ "optionWebSocket": "WebSocket"
}
}
},
@@ -534,21 +545,13 @@
},
"type": {
"description": "Select the type of check to perform",
- "optionDocker": "Docker",
"optionDockerDescription": "Use Docker to monitor if a container is running.",
- "optionGame": "Game",
"optionGameDescription": "Monitor if a specific game server is online.",
- "optionGrpc": "gRPC",
"optionGrpcDescription": "Monitor gRPC services using the standard Health Checking Protocol.",
- "optionWebSocket": "WebSocket",
"optionWebSocketDescription": "Monitor WebSocket endpoints for connection health and response time.",
- "optionHttp": "HTTP(S)",
"optionHttpDescription": "Use HTTP(S) to monitor your website or API endpoint.",
- "optionPing": "Ping",
"optionPingDescription": "Use ICMP Ping to monitor if a server is online.",
- "optionPort": "Port",
- "optionPortDescription": "Monitor if a specific port on a server is open.",
- "title": "Type"
+ "optionPortDescription": "Monitor if a specific port on a server is open."
},
"thresholds": {
"title": "Alert thresholds",
@@ -1178,7 +1181,22 @@
},
"monitorsList": {
"chartTypeHeatmap": "Heatmap",
- "chartTypeHistogram": "Histogram"
+ "chartTypeHistogram": "Histogram",
+ "noData": "No data available",
+ "infrastructure": {
+ "title": "Infrastructure",
+ "cpu": "CPU",
+ "memory": "RAM",
+ "memoryText": "Memory",
+ "disk": "Disk",
+ "usage": "Usage",
+ "used": "Used",
+ "total": "Total"
+ },
+ "uptime": {
+ "title": "Uptime",
+ "responseTime": "Response time"
+ }
},
"statusBar": {
"allDown": "All systems are down",
@@ -1270,6 +1288,9 @@
},
"showAdminLoginLink": {
"label": "Show admin login link"
+ },
+ "showInfrastructure": {
+ "label": "Show infrastructure metrics"
}
}
}