Skip to content

A modern and easy to use dashboard. 80+ integrations. 20K+ icons built in. Authentication out of the box. No YAML, drag and drop configuration.

1.8 KB
Raw Blame
import type { SystemHealthMonitoring } from "../..";
import type { ISystemHealthMonitoringIntegration } from "../../interfaces/health-monitoring/health-monitoring-integration";

export class SystemHealthMonitoringMockService implements ISystemHealthMonitoringIntegration {
  public async getSystemInfoAsync(): Promise<SystemHealthMonitoring> {
    return await Promise.resolve({
      version: "1.0.0",
      cpuModelName: "Mock CPU",
      cpuUtilization: Math.random(),
      memUsedInBytes: 4 * 1024 * 1024 * 1024, // 4 GB in bytes
      memAvailableInBytes: 8 * 1024 * 1024 * 1024, // 8 GB in bytes
      availablePkgUpdates: 0,
      network: {
        up: 1024 * 16,
        down: 1024 * 16 * 6,
      },
      rebootRequired: false,
      cpuTemp: Math.floor(Math.random() * 100), // Random temperature between 0 and 99
      uptime: Math.floor(Math.random() * 1000000), // Random uptime in seconds
      fileSystem: Array.from({ length: 3 }, (_, index) => ({
        deviceName: `sha${index + 1}`,
        used: "1 GB",
        available: "500 MB",
        percentage: Math.floor(Math.random() * 100), // Random percentage between 0 and 99
      })),
      loadAverage: {
        "1min": Math.random() * 10,
        "5min": Math.random() * 10,
        "15min": Math.random() * 10,
      },
      smart: [
        {
          deviceName: "Mock Device",
          temperature: Math.floor(Math.random() * 100), // Random temperature between 0 and 99
          overallStatus: "OK",
          healthy: true,
        },
      ],
      gpu: [
        {
          gpuId: "mock0",
          name: "Mock GPU RTX 4090",
          memoryUtilization: Math.floor(Math.random() * 100),
          processorUtilization: Math.floor(Math.random() * 100),
          temperature: Math.floor(Math.random() * 90),
          fanSpeed: Math.floor(Math.random() * 2000),
        },
      ],
    });
  }
}