UNPKG

node-os-utils

Version:

Advanced cross-platform operating system monitoring utilities with TypeScript support

205 lines 5.52 kB
/** * node-os-utils v2.0.0 * * 现代化的跨平台操作系统监控工具库 * TypeScript 重构版本,提供全面的系统监控功能 */ import { AdapterFactory } from './adapters/adapter-factory'; import { CacheManager } from './core/cache-manager'; import { CPUMonitor } from './monitors/cpu-monitor'; import { MemoryMonitor } from './monitors/memory-monitor'; import { DiskMonitor } from './monitors/disk-monitor'; import { NetworkMonitor } from './monitors/network-monitor'; import { ProcessMonitor } from './monitors/process-monitor'; import { SystemMonitor } from './monitors/system-monitor'; import { GlobalConfig } from './types'; /** * OSUtils 主类 * * 提供统一的系统监控 API,自动处理平台适配和缓存管理 */ export declare class OSUtils { private adapter; private cache; private config; private _cpu?; private _memory?; private _disk?; private _network?; private _process?; private _system?; constructor(config?: Partial<GlobalConfig>); /** * CPU 监控器 */ get cpu(): CPUMonitor; /** * 内存监控器 */ get memory(): MemoryMonitor; /** * 磁盘监控器 */ get disk(): DiskMonitor; /** * 网络监控器 */ get network(): NetworkMonitor; /** * 进程监控器 */ get process(): ProcessMonitor; /** * 系统监控器 */ get system(): SystemMonitor; /** * 获取平台信息 */ getPlatformInfo(): { platform: string; arch: string; version: string; supported: boolean; }; /** * 获取支持的平台列表 */ getSupportedPlatforms(): string[]; /** * 检查平台能力 */ checkPlatformCapabilities(): Promise<{ platform: string; supported: boolean; capabilities: { commands: string[]; files: string[]; features: string[]; }; issues: string[]; }>; /** * 获取缓存统计信息 */ getCacheStats(): import("./core/cache-manager").CacheStats; /** * 清理缓存 */ clearCache(): this; /** * 配置缓存 */ configureCache(options: { enabled?: boolean; maxSize?: number; defaultTTL?: number; }): this; /** * 配置调试模式 */ setDebug(enabled: boolean): this; /** * 获取系统总览信息 */ overview(): Promise<{ platform: string; timestamp: number; system: import("./types").SystemInfo | null; cpu: { usage: number | null; }; memory: { total: string; used: string; available: string; usagePercentage: number; swap: { total: string; used: string; usagePercentage: number; }; } | null; disk: { total: import("./types").DataSize; used: import("./types").DataSize; available: import("./types").DataSize; usagePercentage: number; disks: number; } | null; network: { interfaces: number; activeInterfaces: number; totalRxBytes: import("./types").DataSize; totalTxBytes: import("./types").DataSize; totalPackets: number; totalErrors: number; } | null; processes: { total: number; running: number; sleeping: number; waiting: number; zombie: number; stopped: number; unknown: number; totalCpuUsage: number; totalMemoryUsage: import("./types").DataSize; } | null; }>; /** * 健康检查 */ healthCheck(): Promise<{ status: "healthy"; issues: string[]; timestamp: number; details: { system: { status: "critical" | "warning" | "healthy"; checks: { load: boolean; uptime: boolean; services: boolean; resources: boolean; }; issues: string[]; score: number; } | null; disk: { status: "critical" | "warning" | "healthy"; issues: string[]; checks: { spaceUsage: boolean; mountStatus: boolean; ioErrors: boolean; }; } | null; network: { status: "critical" | "warning" | "healthy"; issues: string[]; checks: { interfaceStatus: boolean; connectivity: boolean; performance: boolean; }; } | null; }; }>; /** * 销毁实例,清理资源 */ destroy(): void; private resetMonitors; } /** * 创建 OSUtils 实例的工厂函数 */ export declare function createOSUtils(config?: Partial<GlobalConfig>): OSUtils; export * from './types'; export { CPUMonitor, MemoryMonitor, DiskMonitor, NetworkMonitor, ProcessMonitor, SystemMonitor }; export { AdapterFactory, CacheManager }; export default OSUtils; export declare const version: string; export declare const name: string; //# sourceMappingURL=index.d.ts.map