Compare commits

..
Author SHA1 Message Date
gorkem-bwl 35ee4d3bcb revert: Remove PageSpeed stats fix (already fixed on develop)
The PageSpeed stats fix has been implemented differently on develop branch
by Alex Holliday in commit 6447c315c. Reverting this change to avoid
conflicts and keep the incidents fixes.
2026-01-16 21:53:48 -05:00
gorkem-bwl 162b081858 Fix formatting 2026-01-16 15:26:34 -05:00
gorkem-bwl 6c0aea46a7 Fix PageSpeed stats and incidents page issues
## Changes
- Fix PageSpeed "checks since" and "last check" always showing "0s ago"
  by calculating durations from the checks array timestamps
- Fix incidents "Avg. Resolution Time" displaying decimal hours (e.g., "0.86 hours")
  by adding formatResolutionTime() to show proper format (e.g., "52m" or "2h 15m")
- Fix incidents monitor filter dropdown not working when selecting a specific monitor
  by resolving race condition between page reset and data fetch
2026-01-16 15:25:05 -05:00
42 changed files with 114 additions and 1189 deletions

No files matched your search

@@ -154,10 +154,7 @@ export const InfrastructureTooltip = ({
yKey,
yIdx = -1,
yLabel,
yKey2,
yLabel2,
dotColor,
dotColor2,
dateRange,
formatter = getFormattedPercentage,
}) => {
@@ -219,37 +216,7 @@ export const InfrastructureTooltip = ({
</Typography>
</Stack>
</Box>
{yKey2 && yLabel2 && (
<Box mt={theme.spacing(1)}>
<Box
display="inline-block"
width={theme.spacing(4)}
height={theme.spacing(4)}
backgroundColor={dotColor2 || dotColor}
sx={{ borderRadius: "50%" }}
/>
<Stack
display="inline-flex"
direction="row"
justifyContent="space-between"
ml={theme.spacing(3)}
sx={{
"& span": {
color: theme.palette.primary.contrastTextTertiary,
fontSize: 11,
fontWeight: 500,
},
}}
>
<Typography
component="span"
sx={{ opacity: 0.8 }}
>
{`${yLabel2} ${formatter(payload[0].payload[yKey2])}`}
</Typography>
</Stack>
</Box>
)}
{/* Display original value */}
</Box>
);
}
@@ -267,10 +234,7 @@ InfrastructureTooltip.propTypes = {
yKey: PropTypes.string,
yIdx: PropTypes.number,
yLabel: PropTypes.string,
yKey2: PropTypes.string,
yLabel2: PropTypes.string,
dotColor: PropTypes.string,
dotColor2: PropTypes.string,
dateRange: PropTypes.string,
};
+2 -5
View File
@@ -243,7 +243,6 @@ export const useFetchPageSpeedMonitorById = ({ monitorId, dateRange, updateTrigg
const [isLoading, setIsLoading] = useState(true);
const [networkError, setNetworkError] = useState(false);
const [monitor, setMonitor] = useState(undefined);
const [monitorStats, setMonitorStats] = useState(undefined);
useEffect(() => {
const fetchMonitor = async () => {
@@ -255,8 +254,7 @@ export const useFetchPageSpeedMonitorById = ({ monitorId, dateRange, updateTrigg
monitorId: monitorId,
dateRange: dateRange,
});
setMonitor(response.data.data.monitor);
setMonitorStats(response.data.data.monitorStats);
setMonitor(response.data.data);
} catch (error) {
setNetworkError(true);
} finally {
@@ -265,7 +263,7 @@ export const useFetchPageSpeedMonitorById = ({ monitorId, dateRange, updateTrigg
};
fetchMonitor();
}, [monitorId, dateRange, updateTrigger]);
return [monitor, monitorStats, isLoading, networkError];
return [monitor, isLoading, networkError];
};
export const useFetchUptimeMonitorById = ({ monitorId, dateRange, trigger }) => {
@@ -386,7 +384,6 @@ export const useUpdateMonitor = () => {
thresholds: monitor.thresholds,
secret: monitor.secret,
selectedDisks: monitor.selectedDisks,
enableProxmoxContainers: monitor.enableProxmoxContainers,
}),
};
await networkService.updateMonitor({
@@ -26,6 +26,18 @@ import SummaryCard from "../SummaryCard/index.jsx";
* @param {boolean} props.isLoading - Loading state
* @param {Object} props.error - Error object if any
*/
const formatResolutionTime = (hours) => {
if (!hours || hours === 0) return "0m";
const totalMinutes = Math.round(hours * 60);
const h = Math.floor(totalMinutes / 60);
const m = totalMinutes % 60;
if (h === 0) return `${m}m`;
if (m === 0) return `${h}h`;
return `${h}h ${m}m`;
};
const StatisticsPanel = ({ isLoading = false, error = null, summary = {} }) => {
const theme = useTheme();
const { t } = useTranslation();
@@ -150,7 +162,7 @@ const StatisticsPanel = ({ isLoading = false, error = null, summary = {} }) => {
>
{t("incidentsPage.avgResolutionTime")}:{" "}
{summary.total > 0
? `${summary.avgResolutionTimeHours || 0} ${t("incidentsPage.hours")}`
? formatResolutionTime(summary.avgResolutionTimeHours)
: "N/A"}
</Typography>
</Stack>
+22 -5
View File
@@ -8,7 +8,7 @@ import IncidentsSummaryPanel from "./Components/IncidentsSummaryPanel/index.jsx"
//Utils
import { useTheme } from "@emotion/react";
import { useState, useEffect } from "react";
import { useState, useEffect, useRef } from "react";
import NetworkError from "@/Components/v1/GenericFallback/NetworkError.jsx";
import { useTranslation } from "react-i18next";
@@ -53,16 +53,33 @@ const Incidents2 = () => {
const theme = useTheme();
useEffect(() => {
setPage(0);
}, [selectedMonitor, filter, dateRange]);
// Track previous filter values to detect changes and reset page
const prevFiltersRef = useRef({ selectedMonitor, filter, dateRange });
useEffect(() => {
const prevFilters = prevFiltersRef.current;
const filtersChanged =
prevFilters.selectedMonitor !== selectedMonitor ||
prevFilters.filter !== filter ||
prevFilters.dateRange !== dateRange;
// Determine the effective page - reset to 0 if filters changed
const effectivePage = filtersChanged ? 0 : page;
// Update the ref for next comparison
if (filtersChanged) {
prevFiltersRef.current = { selectedMonitor, filter, dateRange };
// Also update the page state (for pagination component)
if (page !== 0) {
setPage(0);
}
}
const config = {
monitorId: selectedMonitor !== "0" ? selectedMonitor : undefined,
sortOrder: "desc",
dateRange,
page,
page: effectivePage,
rowsPerPage,
};
@@ -18,7 +18,6 @@ const useInfrastructureMonitorForm = () => {
usage_temperature: "",
secret: "",
selectedDisks: [],
enableProxmoxContainers: false,
});
const onChangeForm = (name, value) => {
@@ -51,7 +50,6 @@ const useInfrastructureMonitorForm = () => {
usage_temperature: gt.temperature !== undefined ? gt.temperature.toString() : "",
secret: "",
selectedDisks: [],
enableProxmoxContainers: false,
}));
}, []);
@@ -86,7 +84,6 @@ const useInfrastructureMonitorForm = () => {
: "",
secret: monitor.secret || "",
selectedDisks: monitor.selectedDisks || [],
enableProxmoxContainers: monitor.enableProxmoxContainers ?? false,
}));
}, []);
return {
@@ -31,7 +31,6 @@ const useInfrastructureSubmit = () => {
: {}),
secret: infrastructureMonitor.secret,
selectedDisks: infrastructureMonitor.selectedDisks,
enableProxmoxContainers: infrastructureMonitor.enableProxmoxContainers,
};
return form;
};
@@ -51,7 +50,6 @@ const useInfrastructureSubmit = () => {
temperature,
usage_temperature,
selectedDisks,
enableProxmoxContainers,
...rest
} = form;
@@ -69,7 +67,6 @@ const useInfrastructureSubmit = () => {
type: "hardware",
notifications: infrastructureMonitor.notifications,
selectedDisks,
enableProxmoxContainers,
thresholds,
};
// Handle create or update
@@ -5,7 +5,7 @@ import FieldWrapper from "@/Components/v1/Inputs/FieldWrapper/index.jsx";
import Link from "@/Components/v1/Link/index.jsx";
import Select from "@/Components/v1/Inputs/Select/index.jsx";
import TextInput from "@/Components/v1/Inputs/TextInput/index.jsx";
import { Box, Stack, Typography, Button, ButtonGroup, Switch, FormControlLabel } from "@mui/material";
import { Box, Stack, Typography, Button, ButtonGroup } from "@mui/material";
import { HttpAdornment } from "@/Components/v1/Inputs/TextInput/Adornments/index.jsx";
import MonitorStatusHeader from "./Components/MonitorStatusHeader.jsx";
import MonitorActionButtons from "./Components/MonitorActionButtons.jsx";
@@ -368,34 +368,6 @@ const CreateInfrastructureMonitor = () => {
/>
)}
<ConfigBox>
<Box>
<Typography
component="h2"
variant="h2"
>
{t("proxmoxContainerMonitoring")}
</Typography>
<Typography component="p">
{t("proxmoxContainerMonitoringDescription")}
</Typography>
</Box>
<Stack>
<FormControlLabel
sx={{ marginLeft: theme.spacing(0) }}
control={
<Switch
name="enableProxmoxContainers"
checked={infrastructureMonitor.enableProxmoxContainers}
onChange={handleCheckboxChange}
sx={{ mr: theme.spacing(2) }}
/>
}
label={t("enableProxmoxContainers")}
/>
</Stack>
</ConfigBox>
<ConfigBox>
<Box>
<Typography
@@ -1,141 +0,0 @@
import PropTypes from "prop-types";
import { Stack, Typography } from "@mui/material";
import InfraAreaChart from "../AreaChartBoxes/InfraAreaChart.jsx";
import {
TzTick,
InfrastructureTooltip,
NetworkTick,
PercentTick,
} from "@/Components/v1/Charts/Utils/chartUtils.jsx";
import { useTheme } from "@emotion/react";
import { useTranslation } from "react-i18next";
import { useHardwareUtils } from "../../Hooks/useHardwareUtils.jsx";
const ContainerCharts = ({ containerData, dateRange }) => {
const theme = useTheme();
const { t } = useTranslation();
const { formatBytesPerSecondString } = useHardwareUtils();
if (!containerData?.length) {
return <Typography>{t("noContainerStatsAvailable")}</Typography>;
}
const formatPercentage = (value) => `${(value * 100).toFixed(1)}%`;
const configs = [
{
type: "container-cpu",
data: containerData,
dataKeys: ["cpuUsage"],
heading: t("cpuUsage"),
strokeColor: theme.palette.success.main,
gradientStartColor: theme.palette.success.main,
yLabel: t("usage"),
xTick: <TzTick dateRange={dateRange} />,
yTick: <PercentTick />,
toolTip: (
<InfrastructureTooltip
dotColor={theme.palette.success.main}
yKey={"cpuUsage"}
yLabel={t("cpuUsage") + ": "}
dateRange={dateRange}
formatter={formatPercentage}
/>
),
},
{
type: "container-memory",
data: containerData,
dataKeys: ["memoryUsage"],
heading: t("memoryUsage"),
strokeColor: theme.palette.accent.main,
gradientStartColor: theme.palette.accent.main,
yLabel: t("usage"),
xTick: <TzTick dateRange={dateRange} />,
yTick: <PercentTick />,
toolTip: (
<InfrastructureTooltip
dotColor={theme.palette.accent.main}
yKey={"memoryUsage"}
yLabel={t("memoryUsage") + ": "}
dateRange={dateRange}
formatter={formatPercentage}
/>
),
},
{
type: "container-disk-io",
data: containerData,
dataKeys: ["diskRead", "diskWrite"],
heading: t("diskIO"),
// Don't pass strokeColor - let chart use distinct colors from palette
yLabel: t("rate"),
xTick: <TzTick dateRange={dateRange} />,
yTick: <NetworkTick formatter={formatBytesPerSecondString} />,
toolTip: (
<InfrastructureTooltip
dotColor={"#3182bd"}
yKey={"diskRead"}
yLabel={t("diskRead") + ": "}
dotColor2={"#6baed6"}
yKey2={"diskWrite"}
yLabel2={t("diskWrite") + ": "}
dateRange={dateRange}
formatter={formatBytesPerSecondString}
/>
),
},
{
type: "container-network-io",
data: containerData,
dataKeys: ["netIn", "netOut"],
heading: t("networkIO"),
// Don't pass strokeColor - let chart use distinct colors from palette
yLabel: t("rate"),
xTick: <TzTick dateRange={dateRange} />,
yTick: <NetworkTick formatter={formatBytesPerSecondString} />,
toolTip: (
<InfrastructureTooltip
dotColor={"#3182bd"}
yKey={"netIn"}
yLabel={t("networkIn") + ": "}
dotColor2={"#6baed6"}
yKey2={"netOut"}
yLabel2={t("networkOut") + ": "}
dateRange={dateRange}
formatter={formatBytesPerSecondString}
/>
),
},
];
return (
<Stack
direction={"row"}
gap={theme.spacing(8)}
flexWrap="wrap"
sx={{
"& > *": {
flexBasis: `calc(50% - ${theme.spacing(8)})`,
maxWidth: `calc(50% - ${theme.spacing(8)})`,
},
}}
>
{configs.map((config) => (
<InfraAreaChart
key={config.type}
config={config}
/>
))}
</Stack>
);
};
ContainerCharts.propTypes = {
containerData: PropTypes.array.isRequired,
dateRange: PropTypes.string.isRequired,
};
export default ContainerCharts;
@@ -1,130 +0,0 @@
import PropTypes from "prop-types";
import StatusBoxes from "@/Components/v1/StatusBoxes/index.jsx";
import StatBox from "@/Components/v1/StatBox/index.jsx";
import { Typography } from "@mui/material";
import { useTranslation } from "react-i18next";
import { useHardwareUtils } from "../../Hooks/useHardwareUtils.jsx";
const formatUptime = (seconds) => {
if (!seconds || seconds === 0) return "0s";
const days = Math.floor(seconds / 86400);
const hours = Math.floor((seconds % 86400) / 3600);
const minutes = Math.floor((seconds % 3600) / 60);
if (days > 0) {
return `${days}d ${hours}h`;
} else if (hours > 0) {
return `${hours}h ${minutes}m`;
} else if (minutes > 0) {
return `${minutes}m`;
}
return `${Math.floor(seconds)}s`;
};
const formatPercentage = (value) => {
if (value === undefined || value === null) return "0%";
return `${(value * 100).toFixed(1)}%`;
};
// Map container status to Checkmate monitor status for theming
const containerStatusToMonitorStatus = (status) => {
if (status === "running") return "up";
if (status === "stopped") return "down";
return "pending";
};
const ContainerStatBoxes = ({ shouldRender, container }) => {
const { t } = useTranslation();
const { formatBytes } = useHardwareUtils();
if (!container) {
return <Typography>{t("noContainerSelected")}</Typography>;
}
const monitorStatus = containerStatusToMonitorStatus(container.status);
return (
<StatusBoxes
shouldRender={shouldRender}
flexWrap="wrap"
>
<StatBox
gradient={true}
status={monitorStatus}
heading={t("status")}
subHeading={container.status || "unknown"}
/>
<StatBox
heading={t("type")}
subHeading={
<Typography component="span">
{(container.type || "lxc").toUpperCase()}
</Typography>
}
/>
<StatBox
heading={t("uptime")}
subHeading={formatUptime(container.uptime)}
/>
<StatBox
heading={t("cpuUsage")}
subHeading={
<>
{formatPercentage(container.cpu_usage)}
<Typography component="span">
({container.cpu_cores || 0} {t("cores")})
</Typography>
</>
}
/>
<StatBox
heading={t("memoryUsage")}
subHeading={
<>
{formatBytes(container.memory_used)}
<Typography component="span"> / </Typography>
{formatBytes(container.memory_total)}
</>
}
/>
<StatBox
heading={t("diskUsage")}
subHeading={
<>
{formatBytes(container.disk_used)}
<Typography component="span"> / </Typography>
{formatBytes(container.disk_total)}
</>
}
/>
</StatusBoxes>
);
};
ContainerStatBoxes.propTypes = {
shouldRender: PropTypes.bool.isRequired,
container: PropTypes.shape({
vmid: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
name: PropTypes.string,
node: PropTypes.string,
status: PropTypes.string,
type: PropTypes.string,
uptime: PropTypes.number,
cpu_cores: PropTypes.number,
cpu_usage: PropTypes.number,
memory_used: PropTypes.number,
memory_total: PropTypes.number,
memory_usage: PropTypes.number,
swap_used: PropTypes.number,
swap_total: PropTypes.number,
disk_used: PropTypes.number,
disk_total: PropTypes.number,
disk_read: PropTypes.number,
disk_write: PropTypes.number,
network_in: PropTypes.number,
network_out: PropTypes.number,
}),
};
export default ContainerStatBoxes;
@@ -1,125 +0,0 @@
import PropTypes from "prop-types";
import { useState, useEffect } from "react";
import { Box, Typography } from "@mui/material";
import { useTranslation } from "react-i18next";
import { useTheme } from "@emotion/react";
import Select from "@/Components/v1/Inputs/Select/index.jsx";
import ContainerStatBoxes from "./ContainerStatBoxes.jsx";
import ContainerCharts from "./ContainerCharts.jsx";
import MonitorTimeFrameHeader from "@/Components/v1/MonitorTimeFrameHeader/index.jsx";
const getAvailableContainers = (containers) => {
return (containers || [])
.filter((c) => c.vmid && c.name)
.map((c) => ({
vmid: String(c.vmid),
name: c.name,
node: c.node,
status: c.status,
type: c.type,
}));
};
const getContainerData = (checks, vmid) => {
if (!vmid) return [];
return (checks || [])
.map((check) => {
const container = (check.containers || []).find(
(c) => String(c.vmid) === String(vmid)
);
if (!container) return null;
return {
_id: check._id,
cpuUsage: container.avgCpuUsage ?? 0,
memoryUsage: container.avgMemoryUsage ?? 0,
diskRead: container.deltaDiskRead ?? 0,
diskWrite: container.deltaDiskWrite ?? 0,
netIn: container.deltaNetIn ?? 0,
netOut: container.deltaNetOut ?? 0,
};
})
.filter(Boolean);
};
const ContainerStats = ({ containers, checks, isLoading, dateRange, setDateRange }) => {
const { t } = useTranslation();
const theme = useTheme();
const availableContainers = getAvailableContainers(containers);
const [selectedContainer, setSelectedContainer] = useState("");
useEffect(() => {
if (availableContainers.length > 0 && !selectedContainer) {
setSelectedContainer(availableContainers[0].vmid);
}
}, [availableContainers, selectedContainer]);
const containerData = getContainerData(checks, selectedContainer);
const currentContainer = containers?.find(
(c) => String(c.vmid) === String(selectedContainer)
);
if (!containers?.length) {
return (
<Box
display="flex"
justifyContent="center"
alignItems="center"
minHeight={200}
>
<Typography color={theme.palette.primary.contrastTextTertiary}>
{t("noContainersAvailable")}
</Typography>
</Box>
);
}
return (
<>
<ContainerStatBoxes
shouldRender={!isLoading}
container={currentContainer}
/>
<Box
display="flex"
justifyContent="space-between"
alignItems="flex-end"
gap={theme.spacing(4)}
>
{availableContainers.length > 0 && (
<Select
name="container"
label={t("container")}
value={selectedContainer}
onChange={(e) => setSelectedContainer(e.target.value)}
items={availableContainers.map((c) => ({
_id: c.vmid,
name: `${c.name} (${c.vmid}) - ${c.node}`,
}))}
sx={{ minWidth: 250 }}
/>
)}
<MonitorTimeFrameHeader
isLoading={isLoading}
dateRange={dateRange}
setDateRange={setDateRange}
/>
</Box>
<ContainerCharts
containerData={containerData}
dateRange={dateRange}
/>
</>
);
};
ContainerStats.propTypes = {
containers: PropTypes.array,
checks: PropTypes.array,
isLoading: PropTypes.bool.isRequired,
dateRange: PropTypes.string.isRequired,
setDateRange: PropTypes.func.isRequired,
};
export default ContainerStats;
@@ -8,7 +8,6 @@ import GaugeBoxes from "./Components/GaugeBoxes/index.jsx";
import AreaChartBoxes from "./Components/AreaChartBoxes/index.jsx";
import GenericFallback from "@/Components/v1/GenericFallback/index.jsx";
import NetworkStats from "./Components/NetworkStats/index.jsx";
import ContainerStats from "./Components/ContainerStats/index.jsx";
import CustomTabList from "@/Components/v1/Tab/index.jsx";
import TabContext from "@mui/lab/TabContext";
@@ -103,12 +102,6 @@ const InfrastructureDetails = () => {
label={t("network")}
value="network"
/>
{monitor?.enableProxmoxContainers && (
<Tab
label={t("containers")}
value="containers"
/>
)}
</CustomTabList>
{tab === "details" && (
<>
@@ -141,15 +134,6 @@ const InfrastructureDetails = () => {
setDateRange={setDateRange}
/>
)}
{tab === "containers" && monitor?.enableProxmoxContainers && (
<ContainerStats
containers={monitor?.stats?.aggregateData?.latestCheck?.containers || []}
isLoading={isLoading}
checks={monitor?.stats?.checks}
dateRange={dateRange}
setDateRange={setDateRange}
/>
)}
</TabContext>
</Stack>
);
+2 -2
View File
@@ -35,7 +35,7 @@ const PageSpeedDetails = () => {
});
const [trigger, setTrigger] = useState(false);
// Network
const [monitor, monitorStats, isLoading, networkError] = useFetchPageSpeedMonitorById({
const [monitor, isLoading, networkError] = useFetchPageSpeedMonitorById({
monitorId,
dateRange: "day",
updateTrigger: trigger,
@@ -95,7 +95,7 @@ const PageSpeedDetails = () => {
/>
<PageSpeedStatusBoxes
shouldRender={!isLoading}
monitorStats={monitorStats}
monitor={monitor}
/>
<MonitorTimeFrameHeader
shouldRender={!isLoading}
@@ -18,10 +18,7 @@ const UptimeStatusBoxes = ({
// Determine time since last failure
const timeOfLastFailure = monitorStats?.timeOfLastFailure;
const timeSinceLastFailure =
timeOfLastFailure > 0
? Date.now() - timeOfLastFailure
: Date.now() - new Date(monitorStats?.createdAt);
const timeSinceLastFailure = timeOfLastFailure > 0 ? Date.now() - timeOfLastFailure : 0;
// Determine time since last check
const timeOfLastCheck = monitorStats?.lastCheckTimestamp;
-1
View File
@@ -450,7 +450,6 @@ const infrastructureMonitorValidation = joi.object({
}),
notifications: joi.array().items(joi.string()),
selectedDisks: joi.array().items(joi.string()).optional(),
enableProxmoxContainers: joi.boolean(),
});
const notificationValidation = joi.object({
+7 -33
View File
@@ -85,9 +85,7 @@
"networkError": "",
"fallback": {
"title": "",
"checks": [
""
],
"checks": [""],
"actionButton": ""
},
"createButton": "",
@@ -932,9 +930,7 @@
"generalSettings": "",
"contents": "",
"fallback": {
"checks": [
""
],
"checks": [""],
"title": "",
"actionButton": ""
}
@@ -989,36 +985,28 @@
},
"infrastructureMonitor": {
"fallback": {
"checks": [
""
],
"checks": [""],
"title": "",
"actionButton": ""
}
},
"maintenanceWindow": {
"fallback": {
"checks": [
""
],
"checks": [""],
"title": "",
"actionButton": ""
}
},
"pageSpeed": {
"fallback": {
"checks": [
""
],
"checks": [""],
"title": "",
"actionButton": ""
}
},
"uptimeMonitor": {
"fallback": {
"checks": [
""
],
"checks": [""],
"title": "",
"actionButton": ""
}
@@ -1116,19 +1104,5 @@
"packetsReceivedRate": "",
"packetsSent": "",
"rate": "",
"selectInterface": "",
"proxmoxContainerMonitoring": "Proxmox container monitoring",
"proxmoxContainerMonitoringDescription": "Enable monitoring of Proxmox LXC containers on this infrastructure node. Requires Capture agent to be configured with Proxmox API credentials.",
"enableProxmoxContainers": "Enable container monitoring",
"noContainersAvailable": "No containers available.",
"noContainerSelected": "No container selected.",
"noContainerStatsAvailable": "No container stats available.",
"container": "Container",
"containers": "Containers",
"diskIO": "Disk I/O",
"networkIO": "Network I/O",
"diskRead": "Disk read",
"diskWrite": "Disk write",
"networkIn": "Network in",
"networkOut": "Network out"
"selectInterface": ""
}
+7 -33
View File
@@ -85,9 +85,7 @@
"networkError": "",
"fallback": {
"title": "",
"checks": [
""
],
"checks": [""],
"actionButton": ""
},
"createButton": "",
@@ -932,9 +930,7 @@
"generalSettings": "",
"contents": "",
"fallback": {
"checks": [
""
],
"checks": [""],
"title": "",
"actionButton": ""
}
@@ -989,36 +985,28 @@
},
"infrastructureMonitor": {
"fallback": {
"checks": [
""
],
"checks": [""],
"title": "",
"actionButton": ""
}
},
"maintenanceWindow": {
"fallback": {
"checks": [
""
],
"checks": [""],
"title": "",
"actionButton": ""
}
},
"pageSpeed": {
"fallback": {
"checks": [
""
],
"checks": [""],
"title": "",
"actionButton": ""
}
},
"uptimeMonitor": {
"fallback": {
"checks": [
""
],
"checks": [""],
"title": "",
"actionButton": ""
}
@@ -1116,19 +1104,5 @@
"packetsReceivedRate": "",
"packetsSent": "",
"rate": "",
"selectInterface": "",
"proxmoxContainerMonitoring": "Proxmox container monitoring",
"proxmoxContainerMonitoringDescription": "Enable monitoring of Proxmox LXC containers on this infrastructure node. Requires Capture agent to be configured with Proxmox API credentials.",
"enableProxmoxContainers": "Enable container monitoring",
"noContainersAvailable": "No containers available.",
"noContainerSelected": "No container selected.",
"noContainerStatsAvailable": "No container stats available.",
"container": "Container",
"containers": "Containers",
"diskIO": "Disk I/O",
"networkIO": "Network I/O",
"diskRead": "Disk read",
"diskWrite": "Disk write",
"networkIn": "Network in",
"networkOut": "Network out"
"selectInterface": ""
}
+1 -15
View File
@@ -1136,19 +1136,5 @@
"disk_selection_info": "Momentan wurde keine Festplatte erkannt.",
"disk_selection_description": "Wählen Sie die spezifischen Festplatten aus, die Sie überwachen möchten."
}
},
"proxmoxContainerMonitoring": "Proxmox container monitoring",
"proxmoxContainerMonitoringDescription": "Enable monitoring of Proxmox LXC containers on this infrastructure node. Requires Capture agent to be configured with Proxmox API credentials.",
"enableProxmoxContainers": "Enable container monitoring",
"noContainersAvailable": "No containers available.",
"noContainerSelected": "No container selected.",
"noContainerStatsAvailable": "No container stats available.",
"container": "Container",
"containers": "Containers",
"diskIO": "Disk I/O",
"networkIO": "Network I/O",
"diskRead": "Disk read",
"diskWrite": "Disk write",
"networkIn": "Network in",
"networkOut": "Network out"
}
}
+3 -17
View File
@@ -181,9 +181,6 @@
"infrastructureServerUrlLabel": "Server URL",
"infrastructureDisplayNameLabel": "Display name",
"infrastructureAuthorizationSecretLabel": "Authorization secret",
"proxmoxContainerMonitoring": "Proxmox container monitoring",
"proxmoxContainerMonitoringDescription": "Enable monitoring of Proxmox LXC containers on this infrastructure node. Requires Capture agent to be configured with Proxmox API credentials.",
"enableProxmoxContainers": "Enable container monitoring",
"gb": "GB",
"mb": "MB",
"mem": "Mem",
@@ -486,7 +483,7 @@
"newPassword": "New password",
"enterNewPassword": "Enter your new password",
"confirmNewPassword": "Confirm new password",
"passwordRequirements": "New password must contain at least 8 characters and must have at least one uppercase letter, one lowercase letter, one number and one special character (!?@#$%^&*()-_=+[]{}|;:'\",./\\~`).",
"passwordRequirements": "New password must contain at least 8 characters and must have at least one uppercase letter, one lowercase letter, one number and one special character.",
"saving": "Saving..."
},
"emailSent": "Email sent successfully",
@@ -545,7 +542,7 @@
},
"special": {
"beginning": "Must contain at least",
"highlighted": "one special character (!?@#$%^&*()-_=+[]{}|;:'\",./\\~`)"
"highlighted": "one special character"
},
"number": {
"beginning": "Must contain at least",
@@ -570,7 +567,7 @@
"uppercase": "Password must contain at least 1 uppercase letter",
"lowercase": "Password must contain at least 1 lowercase letter",
"number": "Password must contain at least 1 number",
"special": "Password must contain at least 1 special character (!?@#$%^&*()-_=+[]{}|;:'\",./\\~`)",
"special": "Password must contain at least 1 special character",
"incorrect": "The password you provided does not match our records"
}
},
@@ -1138,7 +1135,6 @@
"dataRate": "Data Rate",
"dataReceived": "Data Received",
"dataSent": "Data Sent",
"containers": "Containers",
"details": "Details",
"drops": "Drops",
"errors": "Errors",
@@ -1151,16 +1147,6 @@
"networkErrors": "Network Errors",
"networkInterface": "Network Interface",
"noNetworkStatsAvailable": "No network stats available.",
"noContainersAvailable": "No containers available.",
"noContainerSelected": "No container selected.",
"noContainerStatsAvailable": "No container stats available.",
"container": "Container",
"diskIO": "Disk I/O",
"networkIO": "Network I/O",
"diskRead": "Disk read",
"diskWrite": "Disk write",
"networkIn": "Network in",
"networkOut": "Network out",
"packetsPerSecond": "Packets per second",
"packetsReceived": "Packets Received",
"packetsReceivedRate": "Packets Received Rate",
+7 -33
View File
@@ -85,9 +85,7 @@
"networkError": "",
"fallback": {
"title": "",
"checks": [
""
],
"checks": [""],
"actionButton": ""
},
"createButton": "",
@@ -932,9 +930,7 @@
"generalSettings": "",
"contents": "",
"fallback": {
"checks": [
""
],
"checks": [""],
"title": "",
"actionButton": ""
}
@@ -989,36 +985,28 @@
},
"infrastructureMonitor": {
"fallback": {
"checks": [
""
],
"checks": [""],
"title": "",
"actionButton": ""
}
},
"maintenanceWindow": {
"fallback": {
"checks": [
""
],
"checks": [""],
"title": "",
"actionButton": ""
}
},
"pageSpeed": {
"fallback": {
"checks": [
""
],
"checks": [""],
"title": "",
"actionButton": ""
}
},
"uptimeMonitor": {
"fallback": {
"checks": [
""
],
"checks": [""],
"title": "",
"actionButton": ""
}
@@ -1116,19 +1104,5 @@
"packetsReceivedRate": "",
"packetsSent": "",
"rate": "",
"selectInterface": "",
"proxmoxContainerMonitoring": "Proxmox container monitoring",
"proxmoxContainerMonitoringDescription": "Enable monitoring of Proxmox LXC containers on this infrastructure node. Requires Capture agent to be configured with Proxmox API credentials.",
"enableProxmoxContainers": "Enable container monitoring",
"noContainersAvailable": "No containers available.",
"noContainerSelected": "No container selected.",
"noContainerStatsAvailable": "No container stats available.",
"container": "Container",
"containers": "Containers",
"diskIO": "Disk I/O",
"networkIO": "Network I/O",
"diskRead": "Disk read",
"diskWrite": "Disk write",
"networkIn": "Network in",
"networkOut": "Network out"
"selectInterface": ""
}
+7 -33
View File
@@ -85,9 +85,7 @@
"networkError": "",
"fallback": {
"title": "",
"checks": [
""
],
"checks": [""],
"actionButton": ""
},
"createButton": "",
@@ -932,9 +930,7 @@
"generalSettings": "",
"contents": "",
"fallback": {
"checks": [
""
],
"checks": [""],
"title": "",
"actionButton": ""
}
@@ -989,36 +985,28 @@
},
"infrastructureMonitor": {
"fallback": {
"checks": [
""
],
"checks": [""],
"title": "",
"actionButton": ""
}
},
"maintenanceWindow": {
"fallback": {
"checks": [
""
],
"checks": [""],
"title": "",
"actionButton": ""
}
},
"pageSpeed": {
"fallback": {
"checks": [
""
],
"checks": [""],
"title": "",
"actionButton": ""
}
},
"uptimeMonitor": {
"fallback": {
"checks": [
""
],
"checks": [""],
"title": "",
"actionButton": ""
}
@@ -1116,19 +1104,5 @@
"packetsReceivedRate": "",
"packetsSent": "",
"rate": "",
"selectInterface": "",
"proxmoxContainerMonitoring": "Proxmox container monitoring",
"proxmoxContainerMonitoringDescription": "Enable monitoring of Proxmox LXC containers on this infrastructure node. Requires Capture agent to be configured with Proxmox API credentials.",
"enableProxmoxContainers": "Enable container monitoring",
"noContainersAvailable": "No containers available.",
"noContainerSelected": "No container selected.",
"noContainerStatsAvailable": "No container stats available.",
"container": "Container",
"containers": "Containers",
"diskIO": "Disk I/O",
"networkIO": "Network I/O",
"diskRead": "Disk read",
"diskWrite": "Disk write",
"networkIn": "Network in",
"networkOut": "Network out"
"selectInterface": ""
}
+1 -15
View File
@@ -1136,19 +1136,5 @@
"disk_selection_info": "Aucun disque détecté pour le moment.",
"disk_selection_description": "Sélectionnez les disques spécifiques que vous souhaitez surveiller."
}
},
"proxmoxContainerMonitoring": "Proxmox container monitoring",
"proxmoxContainerMonitoringDescription": "Enable monitoring of Proxmox LXC containers on this infrastructure node. Requires Capture agent to be configured with Proxmox API credentials.",
"enableProxmoxContainers": "Enable container monitoring",
"noContainersAvailable": "No containers available.",
"noContainerSelected": "No container selected.",
"noContainerStatsAvailable": "No container stats available.",
"container": "Container",
"containers": "Containers",
"diskIO": "Disk I/O",
"networkIO": "Network I/O",
"diskRead": "Disk read",
"diskWrite": "Disk write",
"networkIn": "Network in",
"networkOut": "Network out"
}
}
+6 -30
View File
@@ -934,9 +934,7 @@
"generalSettings": "一般設定",
"contents": "コンテンツ",
"fallback": {
"checks": [
""
],
"checks": [""],
"title": "",
"actionButton": ""
}
@@ -991,36 +989,28 @@
},
"infrastructureMonitor": {
"fallback": {
"checks": [
""
],
"checks": [""],
"title": "",
"actionButton": ""
}
},
"maintenanceWindow": {
"fallback": {
"checks": [
""
],
"checks": [""],
"title": "",
"actionButton": ""
}
},
"pageSpeed": {
"fallback": {
"checks": [
""
],
"checks": [""],
"title": "",
"actionButton": ""
}
},
"uptimeMonitor": {
"fallback": {
"checks": [
""
],
"checks": [""],
"title": "",
"actionButton": ""
}
@@ -1125,19 +1115,5 @@
"disk_selection_info": "現在ディスクが検出されていません。",
"disk_selection_description": "監視したい特定のディスクを選択してください。"
}
},
"proxmoxContainerMonitoring": "Proxmox container monitoring",
"proxmoxContainerMonitoringDescription": "Enable monitoring of Proxmox LXC containers on this infrastructure node. Requires Capture agent to be configured with Proxmox API credentials.",
"enableProxmoxContainers": "Enable container monitoring",
"noContainersAvailable": "No containers available.",
"noContainerSelected": "No container selected.",
"noContainerStatsAvailable": "No container stats available.",
"container": "Container",
"containers": "Containers",
"diskIO": "Disk I/O",
"networkIO": "Network I/O",
"diskRead": "Disk read",
"diskWrite": "Disk write",
"networkIn": "Network in",
"networkOut": "Network out"
}
}
+1 -15
View File
@@ -1136,19 +1136,5 @@
"disk_selection_info": "Nenhum disco detectado no momento.",
"disk_selection_description": "Selecione os discos específicos que você deseja monitorar."
}
},
"proxmoxContainerMonitoring": "Proxmox container monitoring",
"proxmoxContainerMonitoringDescription": "Enable monitoring of Proxmox LXC containers on this infrastructure node. Requires Capture agent to be configured with Proxmox API credentials.",
"enableProxmoxContainers": "Enable container monitoring",
"noContainersAvailable": "No containers available.",
"noContainerSelected": "No container selected.",
"noContainerStatsAvailable": "No container stats available.",
"container": "Container",
"containers": "Containers",
"diskIO": "Disk I/O",
"networkIO": "Network I/O",
"diskRead": "Disk read",
"diskWrite": "Disk write",
"networkIn": "Network in",
"networkOut": "Network out"
}
}
+1 -15
View File
@@ -1136,19 +1136,5 @@
"disk_selection_info": "На данный момент диск не обнаружен.",
"disk_selection_description": "Выберите конкретные диски, которые вы хотите отслеживать."
}
},
"proxmoxContainerMonitoring": "Proxmox container monitoring",
"proxmoxContainerMonitoringDescription": "Enable monitoring of Proxmox LXC containers on this infrastructure node. Requires Capture agent to be configured with Proxmox API credentials.",
"enableProxmoxContainers": "Enable container monitoring",
"noContainersAvailable": "No containers available.",
"noContainerSelected": "No container selected.",
"noContainerStatsAvailable": "No container stats available.",
"container": "Container",
"containers": "Containers",
"diskIO": "Disk I/O",
"networkIO": "Network I/O",
"diskRead": "Disk read",
"diskWrite": "Disk write",
"networkIn": "Network in",
"networkOut": "Network out"
}
}
+1 -15
View File
@@ -1136,19 +1136,5 @@
"disk_selection_info": "ไม่พบดิสก์ในขณะนี้",
"disk_selection_description": "เลือกดิสก์ที่คุณต้องการตรวจสอบ"
}
},
"proxmoxContainerMonitoring": "Proxmox container monitoring",
"proxmoxContainerMonitoringDescription": "Enable monitoring of Proxmox LXC containers on this infrastructure node. Requires Capture agent to be configured with Proxmox API credentials.",
"enableProxmoxContainers": "Enable container monitoring",
"noContainersAvailable": "No containers available.",
"noContainerSelected": "No container selected.",
"noContainerStatsAvailable": "No container stats available.",
"container": "Container",
"containers": "Containers",
"diskIO": "Disk I/O",
"networkIO": "Network I/O",
"diskRead": "Disk read",
"diskWrite": "Disk write",
"networkIn": "Network in",
"networkOut": "Network out"
}
}
+7 -33
View File
@@ -85,9 +85,7 @@
"networkError": "Ağ hatası oluştu",
"fallback": {
"title": "",
"checks": [
""
],
"checks": [""],
"actionButton": ""
},
"createButton": "Bildirim kanalı oluştur",
@@ -932,9 +930,7 @@
"generalSettings": "Genel ayarlar",
"contents": "İçerikler",
"fallback": {
"checks": [
""
],
"checks": [""],
"title": "",
"actionButton": ""
}
@@ -989,36 +985,28 @@
},
"infrastructureMonitor": {
"fallback": {
"checks": [
""
],
"checks": [""],
"title": "",
"actionButton": ""
}
},
"maintenanceWindow": {
"fallback": {
"checks": [
""
],
"checks": [""],
"title": "",
"actionButton": ""
}
},
"pageSpeed": {
"fallback": {
"checks": [
""
],
"checks": [""],
"title": "",
"actionButton": ""
}
},
"uptimeMonitor": {
"fallback": {
"checks": [
""
],
"checks": [""],
"title": "",
"actionButton": ""
}
@@ -1116,19 +1104,5 @@
"packetsReceivedRate": "",
"packetsSent": "",
"rate": "",
"selectInterface": "",
"proxmoxContainerMonitoring": "Proxmox container monitoring",
"proxmoxContainerMonitoringDescription": "Enable monitoring of Proxmox LXC containers on this infrastructure node. Requires Capture agent to be configured with Proxmox API credentials.",
"enableProxmoxContainers": "Enable container monitoring",
"noContainersAvailable": "No containers available.",
"noContainerSelected": "No container selected.",
"noContainerStatsAvailable": "No container stats available.",
"container": "Container",
"containers": "Containers",
"diskIO": "Disk I/O",
"networkIO": "Network I/O",
"diskRead": "Disk read",
"diskWrite": "Disk write",
"networkIn": "Network in",
"networkOut": "Network out"
"selectInterface": ""
}
+2 -18
View File
@@ -86,9 +86,7 @@
"networkError": "",
"fallback": {
"title": "",
"checks": [
""
]
"checks": [""]
},
"createButton": "",
"createTitle": "",
@@ -836,19 +834,5 @@
"selectEnabled": "",
"title": ""
}
},
"proxmoxContainerMonitoring": "Proxmox container monitoring",
"proxmoxContainerMonitoringDescription": "Enable monitoring of Proxmox LXC containers on this infrastructure node. Requires Capture agent to be configured with Proxmox API credentials.",
"enableProxmoxContainers": "Enable container monitoring",
"noContainersAvailable": "No containers available.",
"noContainerSelected": "No container selected.",
"noContainerStatsAvailable": "No container stats available.",
"container": "Container",
"containers": "Containers",
"diskIO": "Disk I/O",
"networkIO": "Network I/O",
"diskRead": "Disk read",
"diskWrite": "Disk write",
"networkIn": "Network in",
"networkOut": "Network out"
}
}
+2 -18
View File
@@ -86,9 +86,7 @@
"networkError": "",
"fallback": {
"title": "",
"checks": [
""
]
"checks": [""]
},
"createButton": "",
"createTitle": "",
@@ -836,19 +834,5 @@
"selectEnabled": "",
"title": ""
}
},
"proxmoxContainerMonitoring": "Proxmox container monitoring",
"proxmoxContainerMonitoringDescription": "Enable monitoring of Proxmox LXC containers on this infrastructure node. Requires Capture agent to be configured with Proxmox API credentials.",
"enableProxmoxContainers": "Enable container monitoring",
"noContainersAvailable": "No containers available.",
"noContainerSelected": "No container selected.",
"noContainerStatsAvailable": "No container stats available.",
"container": "Container",
"containers": "Containers",
"diskIO": "Disk I/O",
"networkIO": "Network I/O",
"diskRead": "Disk read",
"diskWrite": "Disk write",
"networkIn": "Network in",
"networkOut": "Network out"
}
}
+3 -25
View File
@@ -1004,22 +1004,14 @@
},
"maintenanceWindow": {
"fallback": {
"checks": [
"标记维护时段",
"消除所有误解",
"停止在维护窗口内发送警报"
],
"checks": ["标记维护时段", "消除所有误解", "停止在维护窗口内发送警报"],
"title": "维护时段用于:",
"actionButton": "让我们创建您的第一个维护时段!"
}
},
"pageSpeed": {
"fallback": {
"checks": [
"报告页面的用户体验",
"帮助分析网页速度",
"就如何改进页面提出建议"
],
"checks": ["报告页面的用户体验", "帮助分析网页速度", "就如何改进页面提出建议"],
"title": "PageSpeed 监视器用于:",
"actionButton": "让我们创建您的第一个 PageSpeed 监视器!"
}
@@ -1136,19 +1128,5 @@
"disk_selection_info": "目前没有检测到磁盘。",
"disk_selection_description": "选择您要监控的特定磁盘。"
}
},
"proxmoxContainerMonitoring": "Proxmox container monitoring",
"proxmoxContainerMonitoringDescription": "Enable monitoring of Proxmox LXC containers on this infrastructure node. Requires Capture agent to be configured with Proxmox API credentials.",
"enableProxmoxContainers": "Enable container monitoring",
"noContainersAvailable": "No containers available.",
"noContainerSelected": "No container selected.",
"noContainerStatsAvailable": "No container stats available.",
"container": "Container",
"containers": "Containers",
"diskIO": "Disk I/O",
"networkIO": "Network I/O",
"diskRead": "Disk read",
"diskWrite": "Disk write",
"networkIn": "Network in",
"networkOut": "Network out"
}
}
+6 -34
View File
@@ -934,9 +934,7 @@
"generalSettings": "",
"contents": "內容",
"fallback": {
"checks": [
""
],
"checks": [""],
"title": "",
"actionButton": "讓我們建立您的第一個狀態頁面!"
}
@@ -991,40 +989,28 @@
},
"infrastructureMonitor": {
"fallback": {
"checks": [
"追蹤伺服器的效能",
"識別瓶頸並優化資源使用",
"透過即時監控確保可靠性"
],
"checks": ["追蹤伺服器的效能", "識別瓶頸並優化資源使用", "透過即時監控確保可靠性"],
"title": "",
"actionButton": "讓我們建立您的第一個基礎設施監視器!"
}
},
"maintenanceWindow": {
"fallback": {
"checks": [
"標記您的維護期間",
"消除任何誤解",
"在維護時段停止發送警報"
],
"checks": ["標記您的維護期間", "消除任何誤解", "在維護時段停止發送警報"],
"title": "",
"actionButton": "讓我們建立您的第一個維護時段!"
}
},
"pageSpeed": {
"fallback": {
"checks": [
""
],
"checks": [""],
"title": "",
"actionButton": "讓我們建立您的第一個 PageSpeed 監視器!"
}
},
"uptimeMonitor": {
"fallback": {
"checks": [
""
],
"checks": [""],
"title": "",
"actionButton": "讓我們建立您的第一個正常運行時間監視器!"
}
@@ -1122,19 +1108,5 @@
"packetsReceivedRate": "",
"packetsSent": "",
"rate": "",
"selectInterface": "",
"proxmoxContainerMonitoring": "Proxmox container monitoring",
"proxmoxContainerMonitoringDescription": "Enable monitoring of Proxmox LXC containers on this infrastructure node. Requires Capture agent to be configured with Proxmox API credentials.",
"enableProxmoxContainers": "Enable container monitoring",
"noContainersAvailable": "No containers available.",
"noContainerSelected": "No container selected.",
"noContainerStatsAvailable": "No container stats available.",
"container": "Container",
"containers": "Containers",
"diskIO": "Disk I/O",
"networkIO": "Network I/O",
"diskRead": "Disk read",
"diskWrite": "Disk write",
"networkIn": "Network in",
"networkOut": "Network out"
"selectInterface": ""
}
+2 -2
View File
@@ -124,7 +124,7 @@ class MonitorController {
const dateRange = requireString(req?.query?.dateRange, "dateRange");
const teamId = requireTeamId(req?.user?.teamId);
const data = await this.monitorService.getPageSpeedDetailsById({
const monitor = await this.monitorService.getPageSpeedDetailsById({
teamId,
monitorId,
dateRange,
@@ -133,7 +133,7 @@ class MonitorController {
return res.status(200).json({
success: true,
msg: "Page speed details retrieved successfully",
data,
data: monitor,
});
} catch (error) {
next(error);
-30
View File
@@ -4,7 +4,6 @@ import type {
Check,
CheckAudits,
CheckCaptureInfo,
CheckContainerInfo,
CheckCpuInfo,
CheckDiskInfo,
CheckErrorInfo,
@@ -144,31 +143,6 @@ const networkInterfaceSchema = new Schema<CheckNetworkInterfaceInfo>(
{ _id: false }
);
const containerSchema = new Schema<CheckContainerInfo>(
{
vmid: { type: String, default: "" },
name: { type: String, default: "" },
node: { type: String, default: "" },
status: { type: String, default: "" },
type: { type: String, default: "lxc" },
uptime: { type: Number, default: 0 },
cpu_cores: { type: Number, default: 0 },
cpu_usage: { type: Number, default: 0 },
memory_used: { type: Number, default: 0 },
memory_total: { type: Number, default: 0 },
memory_usage: { type: Number, default: 0 },
swap_used: { type: Number, default: 0 },
swap_total: { type: Number, default: 0 },
disk_used: { type: Number, default: 0 },
disk_total: { type: Number, default: 0 },
disk_read: { type: Number, default: 0 },
disk_write: { type: Number, default: 0 },
network_in: { type: Number, default: 0 },
network_out: { type: Number, default: 0 },
},
{ _id: false }
);
const lighthouseAuditSchema = new Schema<ILighthouseAudit>(
{
id: { type: String },
@@ -282,10 +256,6 @@ const CheckSchema = new Schema<CheckDocument>(
type: [networkInterfaceSchema],
default: () => [],
},
containers: {
type: [containerSchema],
default: () => [],
},
accessibility: {
type: Number,
},
-4
View File
@@ -80,10 +80,6 @@ const MonitorSchema = new Schema<MonitorDocument>(
type: Boolean,
default: false,
},
enableProxmoxContainers: {
type: Boolean,
default: false,
},
jsonPath: {
type: String,
},
@@ -3,7 +3,6 @@ import type {
Check,
CheckAudits,
CheckCaptureInfo,
CheckContainerInfo,
CheckCpuInfo,
CheckDiskInfo,
CheckErrorInfo,
@@ -138,29 +137,6 @@ class MongoChecksRepository implements IChecksRepository {
fifo_out: iface?.fifo_out ?? 0,
}));
const mapContainers = (containers?: CheckContainerInfo[]): CheckContainerInfo[] =>
(containers ?? []).map((container) => ({
vmid: container?.vmid ?? "",
name: container?.name ?? "",
node: container?.node ?? "",
status: container?.status ?? "",
type: container?.type ?? "lxc",
uptime: container?.uptime ?? 0,
cpu_cores: container?.cpu_cores ?? 0,
cpu_usage: container?.cpu_usage ?? 0,
memory_used: container?.memory_used ?? 0,
memory_total: container?.memory_total ?? 0,
memory_usage: container?.memory_usage ?? 0,
swap_used: container?.swap_used ?? 0,
swap_total: container?.swap_total ?? 0,
disk_used: container?.disk_used ?? 0,
disk_total: container?.disk_total ?? 0,
disk_read: container?.disk_read ?? 0,
disk_write: container?.disk_write ?? 0,
network_in: container?.network_in ?? 0,
network_out: container?.network_out ?? 0,
}));
const mapAudits = (audits?: CheckAudits): CheckAudits | undefined => {
if (!audits) {
return undefined;
@@ -198,7 +174,6 @@ class MongoChecksRepository implements IChecksRepository {
errors: mapErrors(doc.errors),
capture: mapCapture(doc.capture),
net: mapNet(doc.net),
containers: mapContainers(doc.containers),
accessibility: doc.accessibility,
bestPractices: doc.bestPractices,
seo: doc.seo,
@@ -399,24 +374,6 @@ class MongoChecksRepository implements IChecksRepository {
deltaFifoIn: iface?.deltaFifoIn ?? 0,
deltaFifoOut: iface?.deltaFifoOut ?? 0,
})),
containers: (metric.containers ?? []).map((container: { [key: string]: number | string | undefined }) => ({
vmid: container?.vmid ?? "",
name: container?.name ?? "",
node: container?.node ?? "",
status: container?.status ?? "",
type: container?.type ?? "",
cpu_cores: container?.cpu_cores ?? 0,
avgCpuUsage: container?.avgCpuUsage ?? 0,
avgMemoryUsage: container?.avgMemoryUsage ?? 0,
memoryTotal: container?.memoryTotal ?? 0,
swapTotal: container?.swapTotal ?? 0,
diskTotal: container?.diskTotal ?? 0,
diskUsed: container?.diskUsed ?? 0,
deltaDiskRead: container?.deltaDiskRead ?? 0,
deltaDiskWrite: container?.deltaDiskWrite ?? 0,
deltaNetIn: container?.deltaNetIn ?? 0,
deltaNetOut: container?.deltaNetOut ?? 0,
})),
}));
return {
@@ -494,7 +451,6 @@ class MongoChecksRepository implements IChecksRepository {
avgTemperatures: { $push: { $ifNull: ["$cpu.temperature", [0]] } },
disks: { $push: "$disk" },
net: { $push: "$net" },
containers: { $push: "$containers" },
updatedAts: { $push: "$updatedAt" },
sampleDoc: { $first: "$$ROOT" },
},
@@ -614,66 +570,6 @@ class MongoChecksRepository implements IChecksRepository {
},
},
},
containers: {
$map: {
input: { $range: [0, { $size: { $ifNull: ["$sampleDoc.containers", []] } }] },
as: "cIdx",
in: {
vmid: { $arrayElemAt: ["$sampleDoc.containers.vmid", "$$cIdx"] },
name: { $arrayElemAt: ["$sampleDoc.containers.name", "$$cIdx"] },
node: { $arrayElemAt: ["$sampleDoc.containers.node", "$$cIdx"] },
status: { $arrayElemAt: ["$sampleDoc.containers.status", "$$cIdx"] },
type: { $arrayElemAt: ["$sampleDoc.containers.type", "$$cIdx"] },
cpu_cores: { $arrayElemAt: ["$sampleDoc.containers.cpu_cores", "$$cIdx"] },
avgCpuUsage: { $avg: { $map: { input: "$containers", as: "cA", in: { $arrayElemAt: ["$$cA.cpu_usage", "$$cIdx"] } } } },
avgMemoryUsage: { $avg: { $map: { input: "$containers", as: "cA", in: { $arrayElemAt: ["$$cA.memory_usage", "$$cIdx"] } } } },
memoryTotal: { $arrayElemAt: ["$sampleDoc.containers.memory_total", "$$cIdx"] },
swapTotal: { $arrayElemAt: ["$sampleDoc.containers.swap_total", "$$cIdx"] },
diskTotal: { $arrayElemAt: ["$sampleDoc.containers.disk_total", "$$cIdx"] },
diskUsed: { $avg: { $map: { input: "$containers", as: "cA", in: { $arrayElemAt: ["$$cA.disk_used", "$$cIdx"] } } } },
deltaDiskRead: {
$let: {
vars: {
tDiff: { $divide: [{ $subtract: [{ $last: "$updatedAts" }, { $first: "$updatedAts" }] }, 1000] },
f: { $arrayElemAt: [{ $map: { input: { $first: "$containers" }, as: "c", in: "$$c.disk_read" } }, "$$cIdx"] },
l: { $arrayElemAt: [{ $map: { input: { $last: "$containers" }, as: "c", in: "$$c.disk_read" } }, "$$cIdx"] },
},
in: { $cond: [{ $gt: ["$$tDiff", 0] }, { $divide: [{ $subtract: ["$$l", "$$f"] }, "$$tDiff"] }, 0] },
},
},
deltaDiskWrite: {
$let: {
vars: {
tDiff: { $divide: [{ $subtract: [{ $last: "$updatedAts" }, { $first: "$updatedAts" }] }, 1000] },
f: { $arrayElemAt: [{ $map: { input: { $first: "$containers" }, as: "c", in: "$$c.disk_write" } }, "$$cIdx"] },
l: { $arrayElemAt: [{ $map: { input: { $last: "$containers" }, as: "c", in: "$$c.disk_write" } }, "$$cIdx"] },
},
in: { $cond: [{ $gt: ["$$tDiff", 0] }, { $divide: [{ $subtract: ["$$l", "$$f"] }, "$$tDiff"] }, 0] },
},
},
deltaNetIn: {
$let: {
vars: {
tDiff: { $divide: [{ $subtract: [{ $last: "$updatedAts" }, { $first: "$updatedAts" }] }, 1000] },
f: { $arrayElemAt: [{ $map: { input: { $first: "$containers" }, as: "c", in: "$$c.network_in" } }, "$$cIdx"] },
l: { $arrayElemAt: [{ $map: { input: { $last: "$containers" }, as: "c", in: "$$c.network_in" } }, "$$cIdx"] },
},
in: { $cond: [{ $gt: ["$$tDiff", 0] }, { $divide: [{ $subtract: ["$$l", "$$f"] }, "$$tDiff"] }, 0] },
},
},
deltaNetOut: {
$let: {
vars: {
tDiff: { $divide: [{ $subtract: [{ $last: "$updatedAts" }, { $first: "$updatedAts" }] }, 1000] },
f: { $arrayElemAt: [{ $map: { input: { $first: "$containers" }, as: "c", in: "$$c.network_out" } }, "$$cIdx"] },
l: { $arrayElemAt: [{ $map: { input: { $last: "$containers" }, as: "c", in: "$$c.network_out" } }, "$$cIdx"] },
},
in: { $cond: [{ $gt: ["$$tDiff", 0] }, { $divide: [{ $subtract: ["$$l", "$$f"] }, "$$tDiff"] }, 0] },
},
},
},
},
},
},
},
{ $sort: { _id: 1 } },
@@ -225,7 +225,6 @@ class MongoMonitorsRepository implements IMonitorsRepository {
statusWindowThreshold: doc.statusWindowThreshold,
type: doc.type,
ignoreTlsErrors: doc.ignoreTlsErrors,
enableProxmoxContainers: doc.enableProxmoxContainers,
jsonPath: doc.jsonPath ?? undefined,
expectedValue: doc.expectedValue ?? undefined,
matchMethod: doc.matchMethod ?? undefined,
+1 -2
View File
@@ -105,7 +105,7 @@ class CheckService {
if (type === "hardware") {
const hardwarePayload = payload as HardwareStatusPayload | undefined;
const { cpu, memory, disk, host, net, containers } = hardwarePayload?.data ?? {};
const { cpu, memory, disk, host, net } = hardwarePayload?.data ?? {};
const errorsSource = Array.isArray(hardwarePayload?.errors)
? hardwarePayload?.errors
: (hardwarePayload?.errors as { errors?: CheckErrorInfo[] } | undefined)?.errors;
@@ -116,7 +116,6 @@ class CheckService {
check.errors = errorsSource;
check.capture = hardwarePayload?.capture;
check.net = net;
check.containers = containers;
}
return check;
};
@@ -330,15 +330,9 @@ export class MonitorService implements IMonitorService {
if (checksData.monitorType !== "pagespeed") {
throw new AppError({ message: "Unable to load pagespeed stats for this monitor", status: 500 });
}
const monitorStats = await this.monitorStatsRepository.findByMonitorId(monitor.id);
return {
monitor: {
...monitor,
checks: checksData.checks,
},
monitorStats,
...monitor,
checks: checksData.checks,
};
};
getMonitorById = async ({ teamId, monitorId }: { teamId: string; monitorId: string }): Promise<any> => {
@@ -388,7 +382,7 @@ export class MonitorService implements IMonitorService {
});
const monitorsList = (monitors ?? []) as Monitor[];
const snapshotTypes: MonitorType[] = ["hardware"];
const snapshotTypes: MonitorType[] = ["hardware", "pagespeed"];
const requestedTypes = Array.isArray(type) ? type : type ? [type] : [];
const snapshotOnlyRequest =
requestedTypes.length > 0 && requestedTypes.every((requestedType) => snapshotTypes.includes(requestedType as MonitorType));
@@ -304,8 +304,7 @@ class NetworkService implements INetworkService {
Object.assign(httpResponse, {
code: response.statusCode,
// 207 Multi-Status is used by Capture when some metrics fail - still a success
status: response.ok || response.statusCode === 207,
status: response.ok,
message: response.statusMessage ?? "",
responseTime: response.timings.phases.total || 0,
payload,
@@ -425,112 +424,7 @@ class NetworkService implements INetworkService {
private async requestHardware(monitor: Monitor): Promise<MonitorStatusResponse> {
try {
// Fetch main metrics
this.logger.info({
message: "Fetching hardware metrics",
service: this.SERVICE_NAME,
method: "requestHardware",
details: { url: monitor.url },
});
const mainResponse = await this.requestHttp(monitor);
// If main request failed, return early
if (!mainResponse.status) {
this.logger.warn({
message: "Main metrics request failed",
service: this.SERVICE_NAME,
method: "requestHardware",
details: { url: monitor.url, code: mainResponse.code, msg: mainResponse.message },
});
return mainResponse;
}
// Only fetch Proxmox metrics if enabled for this monitor
if (monitor?.enableProxmoxContainers === true) {
try {
const proxmoxUrl = this.buildProxmoxUrl(monitor.url);
this.logger.info({
message: "Attempting to fetch Proxmox metrics",
service: this.SERVICE_NAME,
method: "requestHardware",
details: { proxmoxUrl },
});
if (proxmoxUrl) {
const proxmoxResponse = await this.requestHttp({
...monitor,
url: proxmoxUrl,
});
// Proxmox response structure: { data: [...], errors: [...] | null, capture: {...} }
const proxmoxPayload = proxmoxResponse.payload as {
data?: unknown[] | null;
errors?: Array<{ metric: string[]; err: string }> | null;
};
const mainPayload = mainResponse.payload as {
data?: Record<string, unknown>;
errors?: Array<{ metric: string[]; err: string }>;
};
// Handle based on Capture's response scenarios:
// 1. Not configured: data=[], errors=null -> log and skip
// 2. Connection failed: data=null, errors=[...] -> merge errors
// 3. Partial failure: data=[...], errors=[...] -> merge both
// 4. Success: data=[...], errors=null -> merge data
if (proxmoxResponse.status && mainPayload?.data && typeof mainPayload.data === "object") {
// Merge container data if available
if (proxmoxPayload?.data && Array.isArray(proxmoxPayload.data)) {
if (proxmoxPayload.data.length > 0) {
(mainPayload.data as Record<string, unknown>).containers = proxmoxPayload.data;
this.logger.info({
message: "Successfully merged Proxmox container data",
service: this.SERVICE_NAME,
method: "requestHardware",
details: { containerCount: proxmoxPayload.data.length },
});
} else {
this.logger.debug({
message: "Proxmox returned empty container list (not configured or no containers running)",
service: this.SERVICE_NAME,
method: "requestHardware",
});
}
}
// Merge Proxmox errors into main errors array
if (proxmoxPayload?.errors && Array.isArray(proxmoxPayload.errors) && proxmoxPayload.errors.length > 0) {
if (!mainPayload.errors) {
mainPayload.errors = [];
}
mainPayload.errors.push(...proxmoxPayload.errors);
this.logger.warn({
message: "Proxmox returned errors",
service: this.SERVICE_NAME,
method: "requestHardware",
details: { errors: proxmoxPayload.errors },
});
}
} else if (!proxmoxResponse.status) {
this.logger.warn({
message: "Proxmox request failed",
service: this.SERVICE_NAME,
method: "requestHardware",
details: { status: proxmoxResponse.status, code: proxmoxResponse.code },
});
}
}
} catch (proxmoxErr: any) {
// Log but don't fail - Proxmox is optional
this.logger.warn({
message: "Proxmox fetch error (optional)",
service: this.SERVICE_NAME,
method: "requestHardware",
details: { error: proxmoxErr.message },
});
}
}
return mainResponse;
return await this.requestHttp(monitor);
} catch (err: any) {
err.service = this.SERVICE_NAME;
err.method = "requestHardware";
@@ -538,22 +432,6 @@ class NetworkService implements INetworkService {
}
}
/**
* Builds the Proxmox metrics URL from the main metrics URL
* e.g., http://localhost:59232/api/v1/metrics -> http://localhost:59232/api/v1/metrics/proxmox
*/
private buildProxmoxUrl(baseUrl: string | undefined): string | null {
if (!baseUrl) return null;
try {
const url = new URL(baseUrl);
// Append /proxmox to the path
url.pathname = url.pathname.replace(/\/?$/, "/proxmox");
return url.toString();
} catch {
return null;
}
}
private async requestDocker(monitor: Monitor): Promise<MonitorStatusResponse> {
try {
if (!monitor.url) {
-23
View File
@@ -64,28 +64,6 @@ export interface CheckNetworkInterfaceInfo {
fifo_out: number;
}
export interface CheckContainerInfo {
vmid: string;
name: string;
node: string;
status: string;
type: string;
uptime: number;
cpu_cores: number;
cpu_usage: number;
memory_used: number;
memory_total: number;
memory_usage: number;
swap_used: number;
swap_total: number;
disk_used: number;
disk_total: number;
disk_read: number;
disk_write: number;
network_in: number;
network_out: number;
}
export interface CheckAudits {
cls?: ILighthouseAudit;
si?: ILighthouseAudit;
@@ -121,7 +99,6 @@ export interface Check {
errors?: CheckErrorInfo[];
capture?: CheckCaptureInfo;
net?: CheckNetworkInterfaceInfo[];
containers?: CheckContainerInfo[];
accessibility?: number;
bestPractices?: number;
seo?: number;
-1
View File
@@ -22,7 +22,6 @@ export interface Monitor {
statusWindowThreshold: number;
type: MonitorType;
ignoreTlsErrors: boolean;
enableProxmoxContainers: boolean;
jsonPath?: string;
expectedValue?: string;
matchMethod?: MonitorMatchMethod;
-2
View File
@@ -1,6 +1,5 @@
import type {
CheckCaptureInfo,
CheckContainerInfo,
CheckCpuInfo,
CheckDiskInfo,
CheckErrorInfo,
@@ -76,7 +75,6 @@ export interface HardwareStatusMetrics {
disk?: CheckDiskInfo[];
host?: CheckHostInfo;
net?: CheckNetworkInterfaceInfo[];
containers?: CheckContainerInfo[];
}
export interface HardwareStatusPayload {
+2 -3
View File
@@ -17,7 +17,8 @@ const roleValidatior = (role) => (value, helpers) => {
// Auth
//****************************************
const passwordPattern = /^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!?@#$%^&*()\-_=+[\]{};:'",.~`|\\/])[A-Za-z0-9!?@#$%^&*()\-_=+[\]{};:'",.~`|\\/]+$/;
const passwordPattern =
/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!?@#$%^&*()\-_=+[\]{};:'",.<>~`|\\/])[A-Za-z0-9!?@#$%^&*()\-_=+[\]{};:'",.<>~`|\\/]+$/;
const loginValidation = joi.object({
email: joi.string().email().required().lowercase(),
@@ -158,7 +159,6 @@ const createMonitorBodyValidation = joi.object({
statusWindowThreshold: joi.number().min(1).max(100).default(60),
url: joi.string().required(),
ignoreTlsErrors: joi.boolean().default(false),
enableProxmoxContainers: joi.boolean().default(false),
port: joi.number(),
isActive: joi.boolean(),
interval: joi.number(),
@@ -194,7 +194,6 @@ const editMonitorBodyValidation = joi.object({
notifications: joi.array().items(joi.string()),
secret: joi.string(),
ignoreTlsErrors: joi.boolean(),
enableProxmoxContainers: joi.boolean(),
jsonPath: joi.string().allow(""),
expectedValue: joi.string().allow(""),
matchMethod: joi.string().allow(null, ""),