Merge pull request #3079 from Antoplt/feat/choose-disks-monitor
feature requested #2840: improve disk device and mountpoint display with hover tooltips
This commit is contained in:
23 files changed
+459
-62
No files matched your search
@@ -91,6 +91,7 @@ Feel free to ask questions or share your ideas - we'd love to hear from you!
|
|||||||
- Website monitoring
|
- Website monitoring
|
||||||
- Page speed monitoring
|
- Page speed monitoring
|
||||||
- Infrastructure monitoring (memory, disk usage, CPU performance, network etc) - requires [Capture](https://github.com/bluewave-labs/capture) agent
|
- Infrastructure monitoring (memory, disk usage, CPU performance, network etc) - requires [Capture](https://github.com/bluewave-labs/capture) agent
|
||||||
|
- Selective disk monitoring with mountpoint selection
|
||||||
- Docker monitoring
|
- Docker monitoring
|
||||||
- Ping monitoring
|
- Ping monitoring
|
||||||
- SSL monitoring
|
- SSL monitoring
|
||||||
|
|||||||
@@ -387,6 +387,7 @@ const useUpdateMonitor = () => {
|
|||||||
...(monitor.type === "hardware" && {
|
...(monitor.type === "hardware" && {
|
||||||
thresholds: monitor.thresholds,
|
thresholds: monitor.thresholds,
|
||||||
secret: monitor.secret,
|
secret: monitor.secret,
|
||||||
|
selectedDisks: monitor.selectedDisks,
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
await networkService.updateMonitor({
|
await networkService.updateMonitor({
|
||||||
|
|||||||
@@ -0,0 +1,87 @@
|
|||||||
|
import React from "react";
|
||||||
|
import ConfigBox from "@/Components/v1/ConfigBox/index.jsx";
|
||||||
|
import { Box, Stack, Typography } from "@mui/material";
|
||||||
|
import Checkbox from "@/Components/v1/Inputs/Checkbox/index.jsx";
|
||||||
|
import { useTheme } from "@emotion/react";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import PropTypes from "prop-types";
|
||||||
|
|
||||||
|
const DiskSelection = ({ availableDisks, selectedDisks, onChange }) => {
|
||||||
|
const theme = useTheme();
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
const handleDiskChange = (event, mountpoint) => {
|
||||||
|
const isChecked = event.target.checked;
|
||||||
|
let newSelectedDisks = [];
|
||||||
|
|
||||||
|
if (isChecked) {
|
||||||
|
newSelectedDisks = [...selectedDisks, mountpoint];
|
||||||
|
} else {
|
||||||
|
newSelectedDisks = selectedDisks.filter((disk) => disk !== mountpoint);
|
||||||
|
}
|
||||||
|
|
||||||
|
onChange(newSelectedDisks);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<ConfigBox>
|
||||||
|
<Box>
|
||||||
|
<Typography component="h2" variant="h2">
|
||||||
|
{t("v1.infrastructure.disk_selection_title")}
|
||||||
|
</Typography>
|
||||||
|
<Typography component="p">
|
||||||
|
{t("v1.infrastructure.disk_selection_description")}
|
||||||
|
</Typography>
|
||||||
|
</Box>
|
||||||
|
|
||||||
|
<Stack gap={theme.spacing(6)}>
|
||||||
|
{(!availableDisks || availableDisks.length === 0) ? (
|
||||||
|
<Typography
|
||||||
|
variant="body2"
|
||||||
|
sx={{ fontStyle: 'italic', opacity: 0.8 }}
|
||||||
|
>
|
||||||
|
{t("v1.infrastructure.disk_selection_info")}
|
||||||
|
</Typography>
|
||||||
|
) : (
|
||||||
|
availableDisks.map((disk) => {
|
||||||
|
const identifier = disk.mountpoint || disk.device;
|
||||||
|
return (
|
||||||
|
<Stack
|
||||||
|
key={identifier}
|
||||||
|
direction={{ sm: "column", md: "row" }}
|
||||||
|
spacing={theme.spacing(2)}
|
||||||
|
>
|
||||||
|
<Box
|
||||||
|
sx={{
|
||||||
|
width: "100%",
|
||||||
|
}}
|
||||||
|
justifyContent="flex-start"
|
||||||
|
>
|
||||||
|
<Checkbox
|
||||||
|
id={`disk-${identifier}`}
|
||||||
|
name={identifier}
|
||||||
|
label={identifier}
|
||||||
|
isChecked={selectedDisks.includes(identifier)}
|
||||||
|
onChange={(e) => handleDiskChange(e, identifier)}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
|
</Stack>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
)}
|
||||||
|
</Stack>
|
||||||
|
</ConfigBox>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
DiskSelection.propTypes = {
|
||||||
|
availableDisks: PropTypes.arrayOf(
|
||||||
|
PropTypes.shape({
|
||||||
|
mountpoint: PropTypes.string.isRequired,
|
||||||
|
})
|
||||||
|
),
|
||||||
|
selectedDisks: PropTypes.arrayOf(PropTypes.string).isRequired,
|
||||||
|
onChange: PropTypes.func.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default DiskSelection;
|
||||||
@@ -17,6 +17,7 @@ const useInfrastructureMonitorForm = () => {
|
|||||||
temperature: false,
|
temperature: false,
|
||||||
usage_temperature: "",
|
usage_temperature: "",
|
||||||
secret: "",
|
secret: "",
|
||||||
|
selectedDisks: [],
|
||||||
});
|
});
|
||||||
|
|
||||||
const onChangeForm = (name, value) => {
|
const onChangeForm = (name, value) => {
|
||||||
@@ -48,6 +49,7 @@ const useInfrastructureMonitorForm = () => {
|
|||||||
temperature: gt.temperature !== undefined,
|
temperature: gt.temperature !== undefined,
|
||||||
usage_temperature: gt.temperature !== undefined ? gt.temperature.toString() : "",
|
usage_temperature: gt.temperature !== undefined ? gt.temperature.toString() : "",
|
||||||
secret: "",
|
secret: "",
|
||||||
|
selectedDisks: [],
|
||||||
}));
|
}));
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
@@ -81,6 +83,7 @@ const useInfrastructureMonitorForm = () => {
|
|||||||
? (thresholds.usage_temperature * 100).toString()
|
? (thresholds.usage_temperature * 100).toString()
|
||||||
: "",
|
: "",
|
||||||
secret: monitor.secret || "",
|
secret: monitor.secret || "",
|
||||||
|
selectedDisks: monitor.selectedDisks || [],
|
||||||
}));
|
}));
|
||||||
}, []);
|
}, []);
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -29,11 +29,11 @@ const useInfrastructureSubmit = () => {
|
|||||||
...(infrastructureMonitor.disk
|
...(infrastructureMonitor.disk
|
||||||
? { usage_disk: infrastructureMonitor.usage_disk }
|
? { usage_disk: infrastructureMonitor.usage_disk }
|
||||||
: {}),
|
: {}),
|
||||||
temperature: infrastructureMonitor.temperature,
|
|
||||||
...(infrastructureMonitor.temperature
|
...(infrastructureMonitor.temperature
|
||||||
? { usage_temperature: infrastructureMonitor.usage_temperature }
|
? { usage_temperature: infrastructureMonitor.usage_temperature }
|
||||||
: {}),
|
: {}),
|
||||||
secret: infrastructureMonitor.secret,
|
secret: infrastructureMonitor.secret,
|
||||||
|
selectedDisks: infrastructureMonitor.selectedDisks,
|
||||||
};
|
};
|
||||||
return form;
|
return form;
|
||||||
};
|
};
|
||||||
@@ -52,6 +52,7 @@ const useInfrastructureSubmit = () => {
|
|||||||
usage_disk,
|
usage_disk,
|
||||||
temperature,
|
temperature,
|
||||||
usage_temperature,
|
usage_temperature,
|
||||||
|
selectedDisks,
|
||||||
...rest
|
...rest
|
||||||
} = form;
|
} = form;
|
||||||
|
|
||||||
@@ -68,6 +69,7 @@ const useInfrastructureSubmit = () => {
|
|||||||
description: form.name,
|
description: form.name,
|
||||||
type: "hardware",
|
type: "hardware",
|
||||||
notifications: infrastructureMonitor.notifications,
|
notifications: infrastructureMonitor.notifications,
|
||||||
|
selectedDisks,
|
||||||
thresholds,
|
thresholds,
|
||||||
};
|
};
|
||||||
// Handle create or update
|
// Handle create or update
|
||||||
|
|||||||
@@ -10,9 +10,11 @@ import { HttpAdornment } from "@/Components/v1/Inputs/TextInput/Adornments/index
|
|||||||
import MonitorStatusHeader from "./Components/MonitorStatusHeader.jsx";
|
import MonitorStatusHeader from "./Components/MonitorStatusHeader.jsx";
|
||||||
import MonitorActionButtons from "./Components/MonitorActionButtons.jsx";
|
import MonitorActionButtons from "./Components/MonitorActionButtons.jsx";
|
||||||
import CustomAlertsSection from "./Components/CustomAlertsSection.jsx";
|
import CustomAlertsSection from "./Components/CustomAlertsSection.jsx";
|
||||||
|
import DiskSelection from "./Components/DiskSelection.jsx";
|
||||||
// Utils
|
// Utils
|
||||||
import NotificationsConfig from "@/Components/v1/NotificationConfig/index.jsx";
|
import NotificationsConfig from "@/Components/v1/NotificationConfig/index.jsx";
|
||||||
import { useGetNotificationsByTeamId } from "../../../../Hooks/v1/useNotifications.js";
|
import { useGetNotificationsByTeamId } from "../../../../Hooks/v1/useNotifications.js";
|
||||||
|
import { networkService } from "../../../../Utils/NetworkService";
|
||||||
import { useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import { useTheme } from "@emotion/react";
|
import { useTheme } from "@emotion/react";
|
||||||
@@ -37,6 +39,7 @@ const CreateInfrastructureMonitor = () => {
|
|||||||
// State
|
// State
|
||||||
const [https, setHttps] = useState(false);
|
const [https, setHttps] = useState(false);
|
||||||
const [updateTrigger, setUpdateTrigger] = useState(false);
|
const [updateTrigger, setUpdateTrigger] = useState(false);
|
||||||
|
const [availableDisks, setAvailableDisks] = useState([]);
|
||||||
|
|
||||||
// Fetch monitor details if editing
|
// Fetch monitor details if editing
|
||||||
const [monitor, isLoading] = useFetchHardwareMonitorById({
|
const [monitor, isLoading] = useFetchHardwareMonitorById({
|
||||||
@@ -72,9 +75,9 @@ const CreateInfrastructureMonitor = () => {
|
|||||||
...(isCreate
|
...(isCreate
|
||||||
? [{ name: "Create", path: "/infrastructure/create" }]
|
? [{ name: "Create", path: "/infrastructure/create" }]
|
||||||
: [
|
: [
|
||||||
{ name: "Details", path: `/infrastructure/${monitorId}` },
|
{ name: "Details", path: `/infrastructure/${monitorId}` },
|
||||||
{ name: "Configure", path: `/infrastructure/configure/${monitorId}` },
|
{ name: "Configure", path: `/infrastructure/configure/${monitorId}` },
|
||||||
]),
|
]),
|
||||||
];
|
];
|
||||||
// Populate form fields if editing
|
// Populate form fields if editing
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -85,6 +88,31 @@ const CreateInfrastructureMonitor = () => {
|
|||||||
} else if (monitor) {
|
} else if (monitor) {
|
||||||
setHttps(monitor.url.startsWith("https"));
|
setHttps(monitor.url.startsWith("https"));
|
||||||
initializeInfrastructureMonitorForUpdate(monitor);
|
initializeInfrastructureMonitorForUpdate(monitor);
|
||||||
|
const fetchLastCheck = async () => {
|
||||||
|
try {
|
||||||
|
const { stats } = monitor ?? {};
|
||||||
|
let latestCheck = stats?.aggregateData?.latestCheck;
|
||||||
|
let disks = latestCheck?.disk || [];
|
||||||
|
|
||||||
|
if (disks.length > 0) {
|
||||||
|
setAvailableDisks(disks);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const response = await networkService.getChecksByMonitor({
|
||||||
|
monitorId,
|
||||||
|
dateRange: "all",
|
||||||
|
rowsPerPage: 1,
|
||||||
|
sortOrder: "desc",
|
||||||
|
});
|
||||||
|
disks = response?.data?.data?.checks?.[0]?.disk || [];
|
||||||
|
setAvailableDisks(disks);
|
||||||
|
} catch (error) {
|
||||||
|
setAvailableDisks([]);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
fetchLastCheck();
|
||||||
}
|
}
|
||||||
}, [
|
}, [
|
||||||
isCreate,
|
isCreate,
|
||||||
@@ -133,6 +161,8 @@ const CreateInfrastructureMonitor = () => {
|
|||||||
isPausing ||
|
isPausing ||
|
||||||
notificationsAreLoading;
|
notificationsAreLoading;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box className="create-infrastructure-monitor">
|
<Box className="create-infrastructure-monitor">
|
||||||
<Breadcrumbs list={CRUMBS} />
|
<Breadcrumbs list={CRUMBS} />
|
||||||
@@ -327,6 +357,17 @@ const CreateInfrastructureMonitor = () => {
|
|||||||
infrastructureMonitor={infrastructureMonitor}
|
infrastructureMonitor={infrastructureMonitor}
|
||||||
handleCheckboxChange={handleCheckboxChange}
|
handleCheckboxChange={handleCheckboxChange}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
{monitorId && (
|
||||||
|
<DiskSelection
|
||||||
|
availableDisks={availableDisks}
|
||||||
|
selectedDisks={infrastructureMonitor.selectedDisks}
|
||||||
|
onChange={(newSelectedDisks) =>
|
||||||
|
onChangeForm("selectedDisks", newSelectedDisks)
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
<ConfigBox>
|
<ConfigBox>
|
||||||
<Box>
|
<Box>
|
||||||
<Typography
|
<Typography
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ import { Stack, Typography, Box } from "@mui/material";
|
|||||||
import { useTheme } from "@emotion/react";
|
import { useTheme } from "@emotion/react";
|
||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
|
|
||||||
const Gauge = ({ value, heading, metricOne, valueOne, metricTwo, valueTwo }) => {
|
const Gauge = ({ value, heading, metricOne, valueOne, metricTwo, valueTwo,
|
||||||
|
metricThree, valueThree, metricFour, valueFour }) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
|
||||||
const valueStyle = {
|
const valueStyle = {
|
||||||
@@ -70,6 +71,24 @@ const Gauge = ({ value, heading, metricOne, valueOne, metricTwo, valueTwo }) =>
|
|||||||
<Typography>{metricTwo}</Typography>
|
<Typography>{metricTwo}</Typography>
|
||||||
<Typography sx={valueStyle}>{valueTwo}</Typography>
|
<Typography sx={valueStyle}>{valueTwo}</Typography>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
<Stack
|
||||||
|
justifyContent={"space-between"}
|
||||||
|
direction="row"
|
||||||
|
alignItems="center"
|
||||||
|
gap={theme.spacing(2)}
|
||||||
|
>
|
||||||
|
<Typography>{metricThree}</Typography>
|
||||||
|
<Typography sx={valueStyle}>{valueThree}</Typography>
|
||||||
|
</Stack>
|
||||||
|
<Stack
|
||||||
|
justifyContent={"space-between"}
|
||||||
|
direction="row"
|
||||||
|
alignItems="center"
|
||||||
|
gap={theme.spacing(2)}
|
||||||
|
>
|
||||||
|
<Typography>{metricFour}</Typography>
|
||||||
|
<Typography sx={valueStyle}>{valueFour}</Typography>
|
||||||
|
</Stack>
|
||||||
</Box>
|
</Box>
|
||||||
</Stack>
|
</Stack>
|
||||||
</BaseContainer>
|
</BaseContainer>
|
||||||
@@ -83,6 +102,10 @@ Gauge.propTypes = {
|
|||||||
valueOne: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
valueOne: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
||||||
metricTwo: PropTypes.string,
|
metricTwo: PropTypes.string,
|
||||||
valueTwo: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
valueTwo: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
||||||
|
metricThree: PropTypes.string,
|
||||||
|
valueThree: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
||||||
|
metricFour: PropTypes.string,
|
||||||
|
valueFour: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Gauge;
|
export default Gauge;
|
||||||
@@ -10,7 +10,7 @@ import { useTheme } from "@emotion/react";
|
|||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
const Gauges = ({ isLoading = false, monitor }) => {
|
const Gauges = ({ isLoading = false, monitor }) => {
|
||||||
const { decimalToPercentage, formatBytes } = useHardwareUtils();
|
const { decimalToPercentage, formatBytes, formatDeviceName, formatMountpoint } = useHardwareUtils();
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
@@ -46,16 +46,27 @@ const Gauges = ({ isLoading = false, monitor }) => {
|
|||||||
metricTwo: t("frequency"),
|
metricTwo: t("frequency"),
|
||||||
valueTwo: `${(cpuFrequency / 1000).toFixed(2)} Ghz`,
|
valueTwo: `${(cpuFrequency / 1000).toFixed(2)} Ghz`,
|
||||||
},
|
},
|
||||||
...(latestCheck?.disk ?? []).map((disk, idx) => ({
|
...(latestCheck?.disk ?? [])
|
||||||
type: "disk",
|
.filter((disk) => {
|
||||||
diskIndex: idx,
|
if (!monitor?.selectedDisks || monitor.selectedDisks.length === 0) {
|
||||||
value: decimalToPercentage(disk.usage_percent),
|
return true;
|
||||||
heading: `Disk${idx} usage`,
|
}
|
||||||
metricOne: t("used"),
|
return monitor.selectedDisks.includes(disk.mountpoint || disk.device);
|
||||||
valueOne: formatBytes(disk.total_bytes - disk.free_bytes, true),
|
})
|
||||||
metricTwo: t("total"),
|
.map((disk, idx) => ({
|
||||||
valueTwo: formatBytes(disk.total_bytes, true),
|
type: "disk",
|
||||||
})),
|
diskIndex: idx,
|
||||||
|
value: decimalToPercentage(disk.usage_percent),
|
||||||
|
heading: `Disk${idx} usage`,
|
||||||
|
metricOne: t("used"),
|
||||||
|
valueOne: formatBytes(disk.total_bytes - disk.free_bytes, true),
|
||||||
|
metricTwo: t("total"),
|
||||||
|
valueTwo: formatBytes(disk.total_bytes, true),
|
||||||
|
metricThree: t("device"),
|
||||||
|
valueThree: formatDeviceName(disk.device),
|
||||||
|
metricFour: t("mountpoint"),
|
||||||
|
valueFour: formatMountpoint(disk.mountpoint),
|
||||||
|
})),
|
||||||
];
|
];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -74,6 +85,10 @@ const Gauges = ({ isLoading = false, monitor }) => {
|
|||||||
valueOne={gauge.valueOne}
|
valueOne={gauge.valueOne}
|
||||||
metricTwo={gauge.metricTwo}
|
metricTwo={gauge.metricTwo}
|
||||||
valueTwo={gauge.valueTwo}
|
valueTwo={gauge.valueTwo}
|
||||||
|
metricThree={gauge.metricThree}
|
||||||
|
valueThree={gauge.valueThree}
|
||||||
|
metricFour={gauge.metricFour}
|
||||||
|
valueFour={gauge.valueFour}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Typography } from "@mui/material";
|
import { Typography, Tooltip } from "@mui/material";
|
||||||
import { useTheme } from "@emotion/react";
|
import { useTheme } from "@emotion/react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
@@ -120,6 +120,87 @@ const useHardwareUtils = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const formatDeviceName = (device) => {
|
||||||
|
const deviceStr = String(device || '');
|
||||||
|
|
||||||
|
// Extract the last part of the path (after last '/')
|
||||||
|
const parts = deviceStr.split('/');
|
||||||
|
const lastPart = parts[parts.length - 1];
|
||||||
|
|
||||||
|
// If there's more than one part, show with "..." prefix
|
||||||
|
const displayText = parts.length > 1 ? `.../${lastPart}` : deviceStr;
|
||||||
|
|
||||||
|
// Always show tooltip with full device path
|
||||||
|
return (
|
||||||
|
<Tooltip title={deviceStr} arrow placement="top">
|
||||||
|
<Typography
|
||||||
|
component="span"
|
||||||
|
sx={{
|
||||||
|
cursor: 'default',
|
||||||
|
display: 'inline-block',
|
||||||
|
userSelect: 'none',
|
||||||
|
whiteSpace: 'nowrap',
|
||||||
|
overflow: 'hidden',
|
||||||
|
textOverflow: 'ellipsis',
|
||||||
|
maxWidth: '100%'
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{displayText}
|
||||||
|
</Typography>
|
||||||
|
</Tooltip>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const formatMountpoint = (mountpoint) => {
|
||||||
|
const mountpointStr = String(mountpoint || '');
|
||||||
|
|
||||||
|
if (!mountpointStr) {
|
||||||
|
return (
|
||||||
|
<Tooltip title="No mountpoint available" arrow placement="top">
|
||||||
|
<Typography
|
||||||
|
component="span"
|
||||||
|
sx={{
|
||||||
|
cursor: 'default',
|
||||||
|
display: 'inline-block',
|
||||||
|
userSelect: 'none',
|
||||||
|
color: 'text.secondary',
|
||||||
|
fontStyle: 'italic'
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
N/A
|
||||||
|
</Typography>
|
||||||
|
</Tooltip>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Extract the last part of the path (after last '/')
|
||||||
|
const parts = mountpointStr.split('/');
|
||||||
|
const lastPart = parts[parts.length - 1];
|
||||||
|
|
||||||
|
// If there's more than one part, show with "..." prefix
|
||||||
|
const displayText = parts.length > 1 ? `.../${lastPart}` : mountpointStr;
|
||||||
|
|
||||||
|
// Always show tooltip with full mountpoint path
|
||||||
|
return (
|
||||||
|
<Tooltip title={mountpointStr} arrow placement="top">
|
||||||
|
<Typography
|
||||||
|
component="span"
|
||||||
|
sx={{
|
||||||
|
cursor: 'default',
|
||||||
|
display: 'inline-block',
|
||||||
|
userSelect: 'none',
|
||||||
|
whiteSpace: 'nowrap',
|
||||||
|
overflow: 'hidden',
|
||||||
|
textOverflow: 'ellipsis',
|
||||||
|
maxWidth: '100%'
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{displayText}
|
||||||
|
</Typography>
|
||||||
|
</Tooltip>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a decimal value to a percentage
|
* Converts a decimal value to a percentage
|
||||||
*
|
*
|
||||||
@@ -178,6 +259,8 @@ const useHardwareUtils = () => {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
formatBytes,
|
formatBytes,
|
||||||
|
formatDeviceName,
|
||||||
|
formatMountpoint,
|
||||||
decimalToPercentage,
|
decimalToPercentage,
|
||||||
buildTemps,
|
buildTemps,
|
||||||
getDimensions,
|
getDimensions,
|
||||||
|
|||||||
@@ -144,44 +144,44 @@ const monitorValidation = joi.object({
|
|||||||
// Regex from https://gist.github.com/dperini/729294
|
// Regex from https://gist.github.com/dperini/729294
|
||||||
var urlRegex = new RegExp(
|
var urlRegex = new RegExp(
|
||||||
"^" +
|
"^" +
|
||||||
// protocol identifier (optional)
|
// protocol identifier (optional)
|
||||||
// short syntax // still required
|
// short syntax // still required
|
||||||
"(?:(?:https?|ftp):\\/\\/)?" +
|
"(?:(?:https?|ftp):\\/\\/)?" +
|
||||||
// user:pass BasicAuth (optional)
|
// user:pass BasicAuth (optional)
|
||||||
"(?:" +
|
"(?:" +
|
||||||
// IP address dotted notation octets
|
// IP address dotted notation octets
|
||||||
// excludes loopback network 0.0.0.0
|
// excludes loopback network 0.0.0.0
|
||||||
// excludes reserved space >= 224.0.0.0
|
// excludes reserved space >= 224.0.0.0
|
||||||
// excludes network & broadcast addresses
|
// excludes network & broadcast addresses
|
||||||
// (first & last IP address of each class)
|
// (first & last IP address of each class)
|
||||||
"(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])" +
|
"(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])" +
|
||||||
"(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}" +
|
"(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}" +
|
||||||
"(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))" +
|
"(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))" +
|
||||||
"|" +
|
"|" +
|
||||||
// host & domain names, may end with dot
|
// host & domain names, may end with dot
|
||||||
// can be replaced by a shortest alternative
|
// can be replaced by a shortest alternative
|
||||||
// (?![-_])(?:[-\\w\\u00a1-\\uffff]{0,63}[^-_]\\.)+
|
// (?![-_])(?:[-\\w\\u00a1-\\uffff]{0,63}[^-_]\\.)+
|
||||||
"(?:" +
|
"(?:" +
|
||||||
// Single hostname without dots (like localhost)
|
// Single hostname without dots (like localhost)
|
||||||
"[a-z0-9\\u00a1-\\uffff][a-z0-9\\u00a1-\\uffff_-]{0,62}" +
|
"[a-z0-9\\u00a1-\\uffff][a-z0-9\\u00a1-\\uffff_-]{0,62}" +
|
||||||
"|" +
|
"|" +
|
||||||
// Domain with dots
|
// Domain with dots
|
||||||
"(?:" +
|
"(?:" +
|
||||||
"(?:" +
|
"(?:" +
|
||||||
"[a-z0-9\\u00a1-\\uffff]" +
|
"[a-z0-9\\u00a1-\\uffff]" +
|
||||||
"[a-z0-9\\u00a1-\\uffff_-]{0,62}" +
|
"[a-z0-9\\u00a1-\\uffff_-]{0,62}" +
|
||||||
")?" +
|
")?" +
|
||||||
"[a-z0-9\\u00a1-\\uffff]\\." +
|
"[a-z0-9\\u00a1-\\uffff]\\." +
|
||||||
")+" +
|
")+" +
|
||||||
// TLD identifier name, may end with dot
|
// TLD identifier name, may end with dot
|
||||||
"(?:[a-z\\u00a1-\\uffff]{2,}\\.?)" +
|
"(?:[a-z\\u00a1-\\uffff]{2,}\\.?)" +
|
||||||
")" +
|
")" +
|
||||||
")" +
|
")" +
|
||||||
// port number (optional)
|
// port number (optional)
|
||||||
"(?::\\d{2,5})?" +
|
"(?::\\d{2,5})?" +
|
||||||
// resource path (optional)
|
// resource path (optional)
|
||||||
"(?:[/?#]\\S*)?" +
|
"(?:[/?#]\\S*)?" +
|
||||||
"$",
|
"$",
|
||||||
"i"
|
"i"
|
||||||
);
|
);
|
||||||
if (!urlRegex.test(value)) {
|
if (!urlRegex.test(value)) {
|
||||||
@@ -448,6 +448,7 @@ const infrastructureMonitorValidation = joi.object({
|
|||||||
"number.max": "Status window threshold cannot exceed 100%.",
|
"number.max": "Status window threshold cannot exceed 100%.",
|
||||||
}),
|
}),
|
||||||
notifications: joi.array().items(joi.string()),
|
notifications: joi.array().items(joi.string()),
|
||||||
|
selectedDisks: joi.array().items(joi.string()).optional(),
|
||||||
});
|
});
|
||||||
|
|
||||||
const notificationValidation = joi.object({
|
const notificationValidation = joi.object({
|
||||||
|
|||||||
@@ -1129,5 +1129,12 @@
|
|||||||
"packetsReceivedRate": "Rate empfangener Pakete",
|
"packetsReceivedRate": "Rate empfangener Pakete",
|
||||||
"packetsSent": "Gesendete Pakete",
|
"packetsSent": "Gesendete Pakete",
|
||||||
"rate": "Rate",
|
"rate": "Rate",
|
||||||
"selectInterface": "Schnittstelle auswählen"
|
"selectInterface": "Schnittstelle auswählen",
|
||||||
|
"v1": {
|
||||||
|
"infrastructure": {
|
||||||
|
"disk_selection_title": "Festplattenauswahl",
|
||||||
|
"disk_selection_info": "Momentan wurde keine Festplatte erkannt.",
|
||||||
|
"disk_selection_description": "Wählen Sie die spezifischen Festplatten aus, die Sie überwachen möchten."
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1142,6 +1142,12 @@
|
|||||||
"packetsSent": "Packets Sent",
|
"packetsSent": "Packets Sent",
|
||||||
"rate": "Rate",
|
"rate": "Rate",
|
||||||
"selectInterface": "Select Interface",
|
"selectInterface": "Select Interface",
|
||||||
|
"v1": {
|
||||||
|
"infrastructure": {
|
||||||
|
"disk_selection_title": "Disk Selection",
|
||||||
|
"disk_selection_info": "No disk detected for the moment.",
|
||||||
|
"disk_selection_description": "Select the specific disks you want to monitor."
|
||||||
|
}
|
||||||
"incidentsPage": {
|
"incidentsPage": {
|
||||||
"title": "Incidents",
|
"title": "Incidents",
|
||||||
"description": "Manage incidents for your monitors. You can resolve incidents here.",
|
"description": "Manage incidents for your monitors. You can resolve incidents here.",
|
||||||
|
|||||||
@@ -1129,5 +1129,12 @@
|
|||||||
"packetsReceivedRate": "",
|
"packetsReceivedRate": "",
|
||||||
"packetsSent": "",
|
"packetsSent": "",
|
||||||
"rate": "",
|
"rate": "",
|
||||||
"selectInterface": ""
|
"selectInterface": "",
|
||||||
|
"v1": {
|
||||||
|
"infrastructure": {
|
||||||
|
"disk_selection_title": "Sélection des disques",
|
||||||
|
"disk_selection_info": "Aucun disque détecté pour le moment.",
|
||||||
|
"disk_selection_description": "Sélectionnez les disques spécifiques que vous souhaitez surveiller."
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1108,5 +1108,12 @@
|
|||||||
"packetsReceivedRate": "",
|
"packetsReceivedRate": "",
|
||||||
"packetsSent": "",
|
"packetsSent": "",
|
||||||
"rate": "",
|
"rate": "",
|
||||||
"selectInterface": ""
|
"selectInterface": "",
|
||||||
|
"v1": {
|
||||||
|
"infrastructure": {
|
||||||
|
"disk_selection_title": "ディスク選択",
|
||||||
|
"disk_selection_info": "現在ディスクが検出されていません。",
|
||||||
|
"disk_selection_description": "監視したい特定のディスクを選択してください。"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1129,5 +1129,12 @@
|
|||||||
"packetsReceivedRate": "",
|
"packetsReceivedRate": "",
|
||||||
"packetsSent": "",
|
"packetsSent": "",
|
||||||
"rate": "",
|
"rate": "",
|
||||||
"selectInterface": ""
|
"selectInterface": "",
|
||||||
|
"v1": {
|
||||||
|
"infrastructure": {
|
||||||
|
"disk_selection_title": "Seleção de Discos",
|
||||||
|
"disk_selection_info": "Nenhum disco detectado no momento.",
|
||||||
|
"disk_selection_description": "Selecione os discos específicos que você deseja monitorar."
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1129,5 +1129,12 @@
|
|||||||
"packetsReceivedRate": "Скорость получения пакетов",
|
"packetsReceivedRate": "Скорость получения пакетов",
|
||||||
"packetsSent": "Отправлено пакетов",
|
"packetsSent": "Отправлено пакетов",
|
||||||
"rate": "коэффициент",
|
"rate": "коэффициент",
|
||||||
"selectInterface": "Выберите интерфейс"
|
"selectInterface": "Выберите интерфейс",
|
||||||
|
"v1": {
|
||||||
|
"infrastructure": {
|
||||||
|
"disk_selection_title": "Выбор дисков",
|
||||||
|
"disk_selection_info": "На данный момент диск не обнаружен.",
|
||||||
|
"disk_selection_description": "Выберите конкретные диски, которые вы хотите отслеживать."
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1129,5 +1129,12 @@
|
|||||||
"packetsReceivedRate": "อัตราการรับแพ็กเก็ต",
|
"packetsReceivedRate": "อัตราการรับแพ็กเก็ต",
|
||||||
"packetsSent": "แพ็กเก็ตที่ส่ง",
|
"packetsSent": "แพ็กเก็ตที่ส่ง",
|
||||||
"rate": "อัตรา",
|
"rate": "อัตรา",
|
||||||
"selectInterface": "เลือกอินเทอร์เฟซ"
|
"selectInterface": "เลือกอินเทอร์เฟซ",
|
||||||
|
"v1": {
|
||||||
|
"infrastructure": {
|
||||||
|
"disk_selection_title": "การเลือกดิสก์",
|
||||||
|
"disk_selection_info": "ไม่พบดิสก์ในขณะนี้",
|
||||||
|
"disk_selection_description": "เลือกดิสก์ที่คุณต้องการตรวจสอบ"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1121,5 +1121,12 @@
|
|||||||
"packetsReceivedRate": "数据包接收率",
|
"packetsReceivedRate": "数据包接收率",
|
||||||
"packetsSent": "已发送数据包",
|
"packetsSent": "已发送数据包",
|
||||||
"rate": "速度",
|
"rate": "速度",
|
||||||
"selectInterface": "选择接口"
|
"selectInterface": "选择接口",
|
||||||
|
"v1": {
|
||||||
|
"infrastructure": {
|
||||||
|
"disk_selection_title": "磁盘选择",
|
||||||
|
"disk_selection_info": "目前没有检测到磁盘。",
|
||||||
|
"disk_selection_description": "选择您要监控的特定磁盘。"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -12,6 +12,9 @@ export default defineConfig(({}) => {
|
|||||||
return {
|
return {
|
||||||
base: "/",
|
base: "/",
|
||||||
plugins: [svgr(), react()],
|
plugins: [svgr(), react()],
|
||||||
|
server: {
|
||||||
|
host: true,
|
||||||
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
"@": path.resolve(__dirname, "src"),
|
"@": path.resolve(__dirname, "src"),
|
||||||
|
|||||||
@@ -0,0 +1,74 @@
|
|||||||
|
# Infrastructure Monitoring - Disk Selection
|
||||||
|
|
||||||
|
This guide explains how to use the selective disk monitoring feature in Checkmate's infrastructure monitoring.
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
By default, Checkmate monitors all detected disks on your server. The disk selection feature allows you to choose specific disks/mountpoints to monitor, giving you more control over what gets tracked and displayed.
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
- Checkmate server running with [Capture agent](https://github.com/bluewave-labs/capture) installed on target server
|
||||||
|
- An existing infrastructure monitor already created and configured
|
||||||
|
- At least one disk detected by the Capture agent
|
||||||
|
|
||||||
|
## Using Disk Selection
|
||||||
|
|
||||||
|
### Accessing the Feature
|
||||||
|
|
||||||
|
1. Navigate to your Infrastructure monitors page
|
||||||
|
2. Click on an existing infrastructure monitor to view details
|
||||||
|
3. Click the "Configure" or "Edit" button
|
||||||
|
4. Scroll down to the **Disk Selection** section
|
||||||
|
|
||||||
|
> **Note:** The disk selection feature is only available when editing existing monitors that have already detected disks.
|
||||||
|
|
||||||
|
### Selecting Disks to Monitor
|
||||||
|
|
||||||
|
1. **View Available Disks**: The system automatically detects all disks/mountpoints from your server
|
||||||
|
2. **Select Disks**: Check the boxes next to the disks you want to monitor
|
||||||
|
3. **Apply Changes**: Click "Save" to update your monitor configuration
|
||||||
|
|
||||||
|
### Understanding Disk Identifiers
|
||||||
|
|
||||||
|
Disks are identified by their mountpoint or device name:
|
||||||
|
- **Mountpoint**: `/` (root), `/home`, `/var`, etc.
|
||||||
|
- **Device**: `/dev/sda1`, `/dev/nvme0n1p1`, etc.
|
||||||
|
|
||||||
|
### Behavior
|
||||||
|
|
||||||
|
- **All disks selected**: Shows all detected disks in gauges and charts
|
||||||
|
- **Specific disks selected**: Only shows selected disks in the monitoring interface
|
||||||
|
- **No disks detected**: Displays "No disk detected for the moment" message
|
||||||
|
|
||||||
|
## What Gets Filtered
|
||||||
|
|
||||||
|
When you select specific disks, the following elements are filtered:
|
||||||
|
|
||||||
|
- **Disk Usage Gauges**: Only selected disks appear in the dashboard
|
||||||
|
- **Disk Usage Charts**: Time-series charts show only selected disks
|
||||||
|
- **Monitor Table**: Summary view reflects only selected disk usage
|
||||||
|
|
||||||
|
## Example Use Cases
|
||||||
|
|
||||||
|
- **Server with multiple drives**: Monitor only critical system disks, ignore temporary storage
|
||||||
|
- **Database servers**: Focus monitoring on database partition while ignoring logs partition
|
||||||
|
- **Web servers**: Monitor web content disk separately from system disk
|
||||||
|
- **Development environments**: Track only project-specific mountpoints
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
### No Disks Appearing
|
||||||
|
- Verify the Capture agent is running on the target server
|
||||||
|
- Check that the agent has proper permissions to read disk information
|
||||||
|
- Ensure the monitor has been running long enough to collect at least one check
|
||||||
|
|
||||||
|
### Missing Disk Information
|
||||||
|
- Some disks may not be accessible to the Capture agent due to permissions
|
||||||
|
- Virtual or network-mounted disks may not appear in the list
|
||||||
|
- Check the Capture agent logs for any disk detection errors
|
||||||
|
|
||||||
|
## Related Documentation
|
||||||
|
|
||||||
|
- [Infrastructure Monitoring Setup](https://docs.checkmate.so/checkmate-2.1)
|
||||||
|
- [Capture Agent Installation](https://github.com/bluewave-labs/capture)
|
||||||
@@ -17,6 +17,8 @@ const memorySchema = mongoose.Schema({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const diskSchema = mongoose.Schema({
|
const diskSchema = mongoose.Schema({
|
||||||
|
device: { type: String, default: "" },
|
||||||
|
mountpoint: { type: String, default: "" },
|
||||||
read_speed_bytes: { type: Number, default: 0 },
|
read_speed_bytes: { type: Number, default: 0 },
|
||||||
write_speed_bytes: { type: Number, default: 0 },
|
write_speed_bytes: { type: Number, default: 0 },
|
||||||
total_bytes: { type: Number, default: 0 },
|
total_bytes: { type: Number, default: 0 },
|
||||||
|
|||||||
@@ -125,6 +125,10 @@ const MonitorSchema = mongoose.Schema(
|
|||||||
return this.alertThreshold;
|
return this.alertThreshold;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
selectedDisks: {
|
||||||
|
type: [String],
|
||||||
|
default: [],
|
||||||
|
},
|
||||||
gameId: {
|
gameId: {
|
||||||
type: String,
|
type: String,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -174,6 +174,7 @@ const createMonitorBodyValidation = joi.object({
|
|||||||
expectedValue: joi.string().allow(""),
|
expectedValue: joi.string().allow(""),
|
||||||
matchMethod: joi.string(),
|
matchMethod: joi.string(),
|
||||||
gameId: joi.string().allow(""),
|
gameId: joi.string().allow(""),
|
||||||
|
selectedDisks: joi.array().items(joi.string()).optional(),
|
||||||
group: joi.string().max(50).trim().allow(null, "").optional(),
|
group: joi.string().max(50).trim().allow(null, "").optional(),
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -204,6 +205,7 @@ const editMonitorBodyValidation = joi.object({
|
|||||||
usage_temperature: joi.number(),
|
usage_temperature: joi.number(),
|
||||||
}),
|
}),
|
||||||
gameId: joi.string(),
|
gameId: joi.string(),
|
||||||
|
selectedDisks: joi.array().items(joi.string()).optional(),
|
||||||
group: joi.string().max(50).trim().allow(null, "").optional(),
|
group: joi.string().max(50).trim().allow(null, "").optional(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user