UNPKG

19.6 kBTypeScriptView Raw
1// Type definitions for systeminformation
2// Project: https://github.com/sebhildebrandt/systeminformation
3// Definitions by: sebhildebrandt <https://github.com/sebhildebrandt>
4
5export namespace Systeminformation {
6
7 // 1. General
8
9 interface TimeData {
10 current: string;
11 uptime: string;
12 timezone: string;
13 timezoneName: string;
14 }
15
16 // 2. System (HW)
17
18 interface SystemData {
19 manufacturer: string;
20 model: string;
21 version: string;
22 serial: string;
23 uuid: string;
24 sku: string;
25 }
26
27 interface BiosData {
28 vendor: string;
29 version: string;
30 releaseDate: string;
31 revision: string;
32 }
33
34 interface BaseboardData {
35 manufacturer: string;
36 model: string;
37 version: string;
38 serial: string;
39 assetTag: string;
40 }
41
42 interface ChassisData {
43 manufacturer: string;
44 model: string;
45 type: string;
46 version: string;
47 serial: string;
48 assetTag: string;
49 sku: string;
50 }
51
52 // 3. CPU, Memory, Disks, Battery, Graphics
53
54 interface CpuData {
55 manufacturer: string;
56 brand: string;
57 vendor: string;
58 family: string;
59 model: string;
60 stepping: string;
61 revision: string;
62 voltage: string;
63 speed: string;
64 speedmin: string;
65 speedmax: string;
66 governor: string;
67 cores: number;
68 physicalCores: number;
69 processors: number;
70 socket: string;
71 cache: CpuCacheData;
72 }
73
74 interface CpuWithFlagsData extends CpuData {
75 flags: string;
76 }
77
78 interface CpuCacheData {
79 l1d: number;
80 l1i: number;
81 l2: number;
82 l3: number;
83 }
84
85 interface CpuCurrentSpeedData {
86 min: number;
87 max: number;
88 avg: number;
89 cores: number[];
90 }
91
92 interface CpuTemperatureData {
93 main: number;
94 cores: number[];
95 max: number;
96 }
97
98 interface MemData {
99 total: number;
100 free: number;
101 used: number;
102 active: number;
103 available: number;
104 buffcache: number;
105 buffers: number;
106 cached: number;
107 slab: number;
108 swaptotal: number;
109 swapused: number;
110 swapfree: number;
111 }
112
113 interface MemLayoutData {
114 size: number;
115 bank: string;
116 type: string;
117 clockSpeed: number;
118 formFactor: string;
119 partNum: string;
120 serialNum: string;
121 voltageConfigured: number;
122 voltageMin: number;
123 voltageMax: number;
124 }
125
126 interface SmartData {
127 smartctl: {
128 version: number[];
129 platform_info: string;
130 build_info: string;
131 argv: string[];
132 exit_status: number;
133 };
134 json_format_version: number[];
135 device: {
136 name: string;
137 info_name: string;
138 type: string;
139 protocol: string;
140 }
141 smart_status: {
142 passed: boolean;
143 }
144 ata_smart_attributes: {
145 revision: number;
146 table: {
147 id: number;
148 name: string;
149 value: number;
150 worst: number;
151 thresh: number;
152 when_failed: string;
153 flags: {
154 value: number;
155 string: string;
156 prefailure: boolean;
157 updated_online: boolean;
158 performance: boolean;
159 error_rate: boolean;
160 event_count: boolean;
161 auto_keep: boolean;
162 };
163 raw: { value: number; string: string }
164 }[];
165 };
166 power_on_time: {
167 hours: number;
168 };
169 power_cycle_count: number;
170 temperature: {
171 current: number;
172 };
173 ata_smart_error_log: {
174 summary: {
175 revision: number;
176 count: number;
177 };
178 };
179 ata_smart_self_test_log: {
180 standard: {
181 revision: number;
182 table: {
183 type: {
184 value: number;
185 string: string;
186 },
187 status: {
188 value: number;
189 string: string;
190 passed: boolean;
191 },
192 lifetime_hours: number;
193 }[];
194 count: number;
195 error_count_total: number;
196 error_count_outdated: number;
197 };
198 }
199 }
200
201 interface DiskLayoutData {
202 device: string;
203 type: string;
204 name: string;
205 vendor: string;
206 size: number;
207 bytesPerSector: number;
208 totalCylinders: number;
209 totalHeads: number;
210 totalSectors: number;
211 totalTracks: number;
212 tracksPerCylinder: number;
213 sectorsPerTrack: number;
214 firmwareRevision: string;
215 serialNum: string;
216 interfaceType: string;
217 smartStatus: string;
218 smartData?: SmartData;
219 }
220
221 interface BatteryData {
222 hasbattery: boolean;
223 cyclecount: number;
224 ischarging: boolean;
225 voltage: number;
226 designedcapacity: number;
227 maxcapacity: number;
228 currentcapacity: number;
229 capacityUnit: string;
230 percent: number;
231 timeremaining: number,
232 acconnected: boolean;
233 type: string;
234 model: string;
235 manufacturer: string;
236 serial: string;
237 }
238
239 interface GraphicsData {
240 controllers: GraphicsControllerData[];
241 displays: GraphicsDisplayData[];
242 }
243
244 interface GraphicsControllerData {
245 vendor: string;
246 model: string;
247 bus: string;
248 vram: number;
249 vramDynamic: boolean;
250 }
251
252 interface GraphicsDisplayData {
253 vendor: string;
254 model: string;
255 main: boolean;
256 builtin: boolean;
257 connection: string;
258 sizex: number;
259 sizey: number;
260 pixeldepth: number;
261 resolutionx: number;
262 resolutiony: number;
263 currentResX: number;
264 currentResY: number;
265 positionX: number;
266 positionY: number;
267 currentRefreshRate: number;
268 }
269
270 // 4. Operating System
271
272 interface OsData {
273 platform: string;
274 distro: string;
275 release: string;
276 codename: string;
277 kernel: string;
278 arch: string;
279 hostname: string;
280 codepage: string;
281 logofile: string;
282 serial: string;
283 build: string;
284 servicepack: string;
285 uefi: boolean;
286 }
287
288 interface UuidData {
289 os: string;
290 }
291
292 interface VersionData {
293 kernel?: string;
294 openssl?: string;
295 systemOpenssl?: string;
296 systemOpensslLib?: string;
297 node?: string;
298 v8?: string;
299 npm?: string;
300 yarn?: string;
301 pm2?: string;
302 gulp?: string;
303 grunt?: string;
304 git?: string;
305 tsc?: string;
306 mysql?: string;
307 redis?: string;
308 mongodb?: string;
309 nginx?: string;
310 php?: string;
311 docker?: string;
312 postfix?: string;
313 postgresql?: string;
314 perl?: string;
315 python?: string;
316 python3?: string;
317 pip?: string;
318 pip3?: string;
319 java?: string;
320 gcc?: string;
321 virtualbox?: string;
322 dotnet?: string;
323 }
324
325 interface UserData {
326 user: string;
327 tty: string;
328 date: string;
329 time: string;
330 ip: string;
331 command: string;
332 }
333
334 // 5. File System
335
336 interface FsSizeData {
337 fs: string;
338 type: string;
339 size: number;
340 used: number;
341 use: number;
342 mount: string;
343 }
344
345 interface FsOpenFilesData {
346 max: number;
347 allocated: number;
348 available: number;
349 }
350
351 interface BlockDevicesData {
352 name: string;
353 identifier: string;
354 type: string;
355 fstype: string;
356 mount: string;
357 size: number;
358 physical: string;
359 uuid: string;
360 label: string;
361 model: string;
362 serial: string;
363 removable: boolean;
364 protocol: string;
365 }
366
367 interface FsStatsData {
368 rx: number;
369 wx: number;
370 tx: number;
371 rx_sec: number;
372 wx_sec: number;
373 tx_sec: number;
374 ms: number;
375 }
376
377 interface DisksIoData {
378 rIO: number;
379 wIO: number;
380 tIO: number;
381 rIO_sec: number;
382 wIO_sec: number;
383 tIO_sec: number;
384 ms: number;
385 }
386
387 // 6. Network related functions
388
389 interface NetworkInterfacesData {
390 iface: string;
391 ifaceName: string;
392 ip4: string;
393 ip4subnet: string;
394 ip6: string;
395 ip6subnet: string;
396 mac: string;
397 internal: boolean;
398 virtual: boolean;
399 operstate: string;
400 type: string;
401 duplex: string;
402 mtu: number;
403 speed: number;
404 dhcp: boolean;
405 dnsSuffix: string;
406 ieee8021xAuth: string;
407 ieee8021xState: string;
408 carrier_changes: number;
409 }
410
411 interface NetworkStatsData {
412 iface: string;
413 operstate: string;
414 rx_bytes: number;
415 rx_dropped: number;
416 rx_errors: number;
417 tx_bytes: number;
418 tx_dropped: number;
419 tx_errors: number;
420 rx_sec: number;
421 tx_sec: number;
422 ms: number;
423 }
424
425 interface NetworkConnectionsData {
426 protocol: string;
427 localaddress: string;
428 localport: string;
429 peeraddress: string;
430 peerport: string;
431 state: string;
432 pid: number;
433 process: string;
434 }
435
436 interface InetChecksiteData {
437 url: string;
438 ok: boolean;
439 status: number;
440 ms: number;
441 }
442
443 interface WifiNetworkData {
444 ssid: string;
445 bssid: string;
446 mode: string;
447 channel: number;
448 frequency: number;
449 signalLevel: number;
450 quality: number;
451 security: string[];
452 wpaFlags: string[];
453 rsnFlags: string[];
454 }
455
456 // 7. Current Load, Processes & Services
457
458 interface CurrentLoadData {
459 avgload: number;
460 currentload: number;
461 currentload_user: number;
462 currentload_system: number;
463 currentload_nice: number;
464 currentload_idle: number;
465 currentload_irq: number;
466 raw_currentload: number;
467 raw_currentload_user: number;
468 raw_currentload_system: number;
469 raw_currentload_nice: number;
470 raw_currentload_idle: number;
471 raw_currentload_irq: number;
472 cpus: CurrentLoadCpuData[];
473 }
474
475 interface CurrentLoadCpuData {
476 load: number;
477 load_user: number;
478 load_system: number;
479 load_nice: number;
480 load_idle: number;
481 load_irq: number;
482 raw_load: number;
483 raw_load_user: number;
484 raw_load_system: number;
485 raw_load_nice: number;
486 raw_load_idle: number;
487 raw_load_irq: number;
488 }
489
490 interface ProcessesData {
491 all: number;
492 running: number;
493 blocked: number;
494 sleeping: number;
495 unknown: number;
496 list: ProcessesProcessData[];
497 }
498
499 interface ProcessesProcessData {
500 pid: number;
501 parentPid: number;
502 name: string,
503 pcpu: number;
504 pcpuu: number;
505 pcpus: number;
506 pmem: number;
507 priority: number;
508 mem_vsz: number;
509 mem_rss: number;
510 nice: number;
511 started: string,
512 state: string;
513 tty: string;
514 user: string;
515 command: string;
516 params: string;
517 path: string;
518 }
519
520 interface ProcessesProcessLoadData {
521 proc: string;
522 pid: number;
523 pids: number[];
524 cpu: number;
525 mem: number;
526 }
527
528 interface ServicesData {
529 name: string;
530 running: boolean;
531 startmode: string;
532 pids: number[];
533 pcpu: number;
534 pmem: number;
535 }
536
537 // 8. Docker
538
539 interface DockerInfoData {
540 id: string;
541 containers: number;
542 containersRunning: number;
543 containersPaused: number;
544 containersStopped: number;
545 images: number;
546 driver: string;
547 memoryLimit: boolean;
548 swapLimit: boolean;
549 kernelMemory: boolean;
550 cpuCfsPeriod: boolean;
551 cpuCfsQuota: boolean;
552 cpuShares: boolean;
553 cpuSet: boolean;
554 ipv4Forwarding: boolean;
555 bridgeNfIptables: boolean;
556 bridgeNfIp6tables: boolean;
557 debug: boolean;
558 mfd: number;
559 oomKillDisable: boolean;
560 ngoroutines: number;
561 systemTime: string;
562 loggingDriver: string;
563 cgroupDriver: string;
564 nEventsListener: number;
565 kernelVersion: string;
566 operatingSystem: string;
567 osType: string;
568 architecture: string;
569 ncpu: number;
570 memTotal: number;
571 dockerRootDir: string;
572 httpProxy: string;
573 httpsProxy: string;
574 noProxy: string;
575 name: string;
576 labels: string[];
577 experimentalBuild: boolean;
578 serverVersion: string;
579 clusterStore: string;
580 clusterAdvertise: string;
581 defaultRuntime: string;
582 liveRestoreEnabled: boolean;
583 isolation: string;
584 initBinary: string;
585 productLicense: string;
586 }
587
588 interface DockerContainerData {
589 id: string;
590 name: string;
591 image: string;
592 imageID: string;
593 command: string;
594 created: number;
595 started: number;
596 finished: number;
597 createdAt: string;
598 startedAt: string;
599 finishedAt: string;
600 state: string;
601 restartCount: number;
602 platform: string;
603 driver: string;
604 ports: number[];
605 mounts: DockerContainerMountData[];
606 }
607
608 interface DockerContainerMountData {
609 Type: string;
610 Source: string;
611 Destination: string;
612 Mode: string;
613 RW: boolean;
614 Propagation: string;
615 }
616
617 interface DockerContainerStatsData {
618 id: string;
619 mem_usage: number;
620 mem_limit: number;
621 mem_percent: number;
622 cpu_percent: number;
623 netIO: {
624 rx: number;
625 wx: number;
626 };
627 blockIO: {
628 r: number;
629 w: number;
630 };
631 restartCount: number;
632 cpu_stats: any;
633 precpu_stats: any;
634 memory_stats: any,
635 networks: any;
636 }
637
638 // 9. Virtual Box
639
640 interface VboxInfoData {
641 id: string;
642 name: string;
643 running: boolean;
644 started: string;
645 runningSince: number;
646 stopped: string;
647 stoppedSince: number;
648 guestOS: string;
649 hardwareUUID: string;
650 memory: number;
651 vram: number;
652 cpus: number;
653 cpuExepCap: string;
654 cpuProfile: string;
655 chipset: string;
656 firmware: string;
657 pageFusion: boolean;
658 configFile: string;
659 snapshotFolder: string;
660 logFolder: string;
661 HPET: boolean;
662 PAE: boolean;
663 longMode: boolean;
664 tripleFaultReset: boolean;
665 APIC: boolean;
666 X2APIC: boolean;
667 ACPI: boolean;
668 IOAPIC: boolean;
669 biosAPICmode: string;
670 bootMenuMode: string;
671 bootDevice1: string;
672 bootDevice2: string;
673 bootDevice3: string;
674 bootDevice4: string;
675 timeOffset: string;
676 RTC: string;
677 }
678
679 // 10. "Get All at once" - functions
680
681 interface StaticData {
682 version: string;
683 system: SystemData;
684 bios: BiosData;
685 baseboard: BaseboardData;
686 chassis: ChassisData;
687 os: OsData;
688 uuid: UuidData;
689 versions: VersionData;
690 cpu: CpuWithFlagsData;
691 graphics: GraphicsData;
692 net: NetworkInterfacesData[];
693 memLayout: MemLayoutData[];
694 diskLayout: DiskLayoutData[];
695 }
696
697}
698
699export function version(): string;
700export function system(cb?: (data: Systeminformation.SystemData) => any): Promise<Systeminformation.SystemData>;
701export function bios(cb?: (data: Systeminformation.BiosData) => any): Promise<Systeminformation.BiosData>;
702export function baseboard(cb?: (data: Systeminformation.BaseboardData) => any): Promise<Systeminformation.BaseboardData>;
703export function chassis(cb?: (data: Systeminformation.ChassisData) => any): Promise<Systeminformation.ChassisData>;
704
705export function time(): Systeminformation.TimeData;
706export function osInfo(cb?: (data: Systeminformation.OsData) => any): Promise<Systeminformation.OsData>;
707export function versions(apps?: string, cb?: (data: Systeminformation.VersionData) => any): Promise<Systeminformation.VersionData>;
708export function shell(cb?: (data: string) => any): Promise<string>;
709export function uuid(cb?: (data: Systeminformation.UuidData) => any): Promise<Systeminformation.UuidData>;
710
711export function cpu(cb?: (data: Systeminformation.CpuData) => any): Promise<Systeminformation.CpuData>;
712export function cpuFlags(cb?: (data: string) => any): Promise<string>;
713export function cpuCache(cb?: (data: Systeminformation.CpuCacheData) => any): Promise<Systeminformation.CpuCacheData>;
714export function cpuCurrentspeed(cb?: (data: Systeminformation.CpuCurrentSpeedData) => any): Promise<Systeminformation.CpuCurrentSpeedData>;
715export function cpuTemperature(cb?: (data: Systeminformation.CpuTemperatureData) => any): Promise<Systeminformation.CpuTemperatureData>;
716export function currentLoad(cb?: (data: Systeminformation.CurrentLoadData) => any): Promise<Systeminformation.CurrentLoadData>;
717export function fullLoad(cb?: (data: number) => any): Promise<number>;
718
719export function mem(cb?: (data: Systeminformation.MemData) => any): Promise<Systeminformation.MemData>;
720export function memLayout(cb?: (data: Systeminformation.MemLayoutData[]) => any): Promise<Systeminformation.MemLayoutData[]>;
721
722export function battery(cb?: (data: Systeminformation.BatteryData) => any): Promise<Systeminformation.BatteryData>;
723export function graphics(cb?: (data: Systeminformation.GraphicsData) => any): Promise<Systeminformation.GraphicsData>;
724
725export function fsSize(cb?: (data: Systeminformation.FsSizeData[]) => any): Promise<Systeminformation.FsSizeData[]>;
726export function fsOpenFiles(cb?: (data: Systeminformation.FsOpenFilesData[]) => any): Promise<Systeminformation.FsOpenFilesData[]>;
727export function blockDevices(cb?: (data: Systeminformation.BlockDevicesData[]) => any): Promise<Systeminformation.BlockDevicesData[]>;
728export function fsStats(cb?: (data: Systeminformation.FsStatsData) => any): Promise<Systeminformation.FsStatsData>;
729export function disksIO(cb?: (data: Systeminformation.DisksIoData) => any): Promise<Systeminformation.DisksIoData>;
730export function diskLayout(cb?: (data: Systeminformation.DiskLayoutData[]) => any): Promise<Systeminformation.DiskLayoutData[]>;
731
732export function networkInterfaceDefault(cb?: (data: string) => any): Promise<string>;
733export function networkGatewayDefault(cb?: (data: string) => any): Promise<string>;
734export function networkInterfaces(cb?: (data: Systeminformation.NetworkInterfacesData[]) => any): Promise<Systeminformation.NetworkInterfacesData[]>;
735
736export function networkStats(ifaces?: string, cb?: (data: Systeminformation.NetworkStatsData[]) => any): Promise<Systeminformation.NetworkStatsData[]>;
737export function networkConnections(cb?: (data: Systeminformation.NetworkConnectionsData[]) => any): Promise<Systeminformation.NetworkConnectionsData[]>;
738export function inetChecksite(url: string, cb?: (data: Systeminformation.InetChecksiteData) => any): Promise<Systeminformation.InetChecksiteData>;
739export function inetLatency(host?: string, cb?: (data: number) => any): Promise<number>;
740
741export function wifiNetworks(cb?: (data: Systeminformation.WifiNetworkData[]) => any): Promise<Systeminformation.WifiNetworkData[]>;
742
743export function users(cb?: (data: Systeminformation.UserData[]) => any): Promise<Systeminformation.UserData[]>;
744
745export function processes(cb?: (data: Systeminformation.ProcessesData) => any): Promise<Systeminformation.ProcessesData>;
746export function processLoad(processName: string, cb?: (data: Systeminformation.ProcessesProcessLoadData) => any): Promise<Systeminformation.ProcessesProcessLoadData>;
747export function services(serviceName: string, cb?: (data: Systeminformation.ServicesData[]) => any): Promise<Systeminformation.ServicesData[]>;
748
749export function dockerInfo(cb?: (data: Systeminformation.DockerInfoData) => any): Promise<Systeminformation.DockerInfoData>;
750export function dockerContainers(all?: boolean, cb?: (data: Systeminformation.DockerContainerData[]) => any): Promise<Systeminformation.DockerContainerData[]>;
751export function dockerContainerStats(id?: string, cb?: (data: Systeminformation.DockerContainerStatsData[]) => any): Promise<Systeminformation.DockerContainerStatsData[]>;
752export function dockerContainerProcesses(id?: string, cb?: (data: any) => any): Promise<any>;
753export function dockerAll(cb?: (data: any) => any): Promise<any>;
754
755export function vboxInfo(cb?: (data: Systeminformation.VboxInfoData[]) => any): Promise<Systeminformation.VboxInfoData[]>;
756
757export function getStaticData(cb?: (data: Systeminformation.StaticData) => any): Promise<Systeminformation.StaticData>;
758export function getDynamicData(srv?: string, iface?: string, cb?: (data: any) => any): Promise<any>;
759export function getAllData(srv?: string, iface?: string, cb?: (data: any) => any): Promise<any>;
760export function get(valuesObject: any, cb?: (data: any) => any): Promise<any>;
761export function observe(valuesObject: any, interval: number, cb?: (data: any) => any): number;