mirror of
https://github.com/nicotsx/ironmount.git
synced 2025-12-10 12:10:51 +01:00
feat: volume stats & charts
This commit is contained in:
@@ -103,9 +103,9 @@ export const deleteVolumeDto = describeRoute({
|
||||
const getVolumeResponse = type({
|
||||
volume: volumeSchema,
|
||||
statfs: type({
|
||||
total: "number",
|
||||
used: "number",
|
||||
free: "number",
|
||||
total: "number = 0",
|
||||
used: "number = 0",
|
||||
free: "number = 0",
|
||||
}),
|
||||
});
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ const getVolume = async (name: string) => {
|
||||
where: eq(volumesTable.name, name),
|
||||
});
|
||||
|
||||
const statfs = await getStatFs(`${VOLUME_MOUNT_BASE}/${name}/_data`);
|
||||
const statfs = await getStatFs(`${VOLUME_MOUNT_BASE}/${name}/_data`).catch(() => {});
|
||||
|
||||
if (!volume) {
|
||||
throw new NotFoundError("Volume not found");
|
||||
@@ -182,7 +182,7 @@ const checkHealth = async (name: string) => {
|
||||
|
||||
await db
|
||||
.update(volumesTable)
|
||||
.set({ lastHealthCheck: new Date(), status, lastError: error })
|
||||
.set({ lastHealthCheck: new Date(), status, lastError: error ?? null })
|
||||
.where(eq(volumesTable.name, volume.name));
|
||||
|
||||
return { status, error };
|
||||
|
||||
Reference in New Issue
Block a user