Operating system (OS)
The operating system connector provides static functions to retrieve live performance metrics and hardware information from the host operating system. Use it to monitor CPU utilization, memory allocation, disk storage, network throughput, and running Docker containers.
Since all functions in this class are static, they do not manage state. You do not need to create an instance to use them.
System metrics
cpuUsage
Retrieves the current overall CPU utilization as a percentage.
Parameters
interval
The measurement window in milliseconds used to calculate utilization. Default 1000.
integer
Output
Returns a number representing the total CPU usage percentage.
Example
# interval
2000cpuCount
Retrieves the total number of logical CPU cores available on the system.
Parameters
None.
Output
Returns an integer representing the core count.
loadAverage
Retrieves system load averages for the past 1, 5, and 15 minutes, normalized by the total number of available logical CPU cores.
Platform limitation
Load averages are a Unix-specific metric. On Windows, this function always returns [0, 0, 0].
Parameters
None.
Output
Returns an array of three numbers representing the normalized system load averages.
driveInfo
Retrieves capacity and utilization metrics for the primary disk drive.
Parameters
None.
Output
Returns an object containing disk storage statistics:
memInfo
Retrieves resource allocation and utilization metrics for the physical memory.
Parameters
None.
Output
Returns an object containing physical RAM capacity and allocation statistics:
netInfo
Retrieves network input and output throughput statistics aggregated across active network interfaces.
Parameters
interval
The measurement window in milliseconds used to calculate network throughput. Default 1000.
integer
Output
Returns an object detailing input and output metrics in megabytes for each network interface alongside a combined total:
Example
uptime
Retrieves the total operational uptime of the operating system.
Parameters
None.
Output
Returns an object breaking down system uptime into chronological increments alongside the absolute duration in seconds:
os
Retrieves the platform name of the underlying operating system.
Parameters
None.
Output
Returns a string containing the operating system identifier (such as Linux, macOS, or Windows_NT).
hostname
Retrieves the network hostname of the local system.
Parameters
None.
Output
Returns a string containing the system hostname.
Container management
containerStats
Retrieves live resource utilization and status metrics for all running Docker containers.
Parameters
socketPath
The file system path to the Docker daemon socket. Default '/var/run/docker.sock'.
string
Output
Returns an array of objects detailing container execution statistics, processing allocations, and memory usage with inactive file cache overhead removed:
containerInfo
Retrieves configuration and state metadata profiles for all running Docker containers.
Parameters
socketPath
The file system path to the Docker daemon socket. Default '/var/run/docker.sock'.
string
Output
Returns an array of detailed inspection objects containing container configuration profiles, layer settings, storage volume bindings, and network maps.
Last updated
Was this helpful?