os

package
v0.10.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 6, 2026 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Overview

Package os queries the host OS information (e.g., kernel version).

Index

Constants

View Source
const (
	// DefaultMaxAllocatedFileHandles is some high number, in case the system is under high file descriptor usage.
	DefaultMaxAllocatedFileHandles = 10000000

	// DefaultMaxRunningPIDs is some high number, in case fd-max is unlimited
	DefaultMaxRunningPIDs = 900000
)
View Source
const Name = "os"

Name is the ID of the OS component.

Variables

This section is empty.

Functions

func HasVFSFileMaxLimitReached added in v0.5.0

func HasVFSFileMaxLimitReached(line string) bool

Returns true if the line indicates that the file-max limit has been reached. ref. https://docs.kernel.org/admin-guide/sysctl/fs.html#file-max-file-nr

func Match added in v0.5.0

func Match(line string) (eventName string, message string)

func New

func New(gpudInstance *components.GPUdInstance) (components.Component, error)

Types

type FileDescriptors added in v0.5.0

type FileDescriptors struct {
	// The number of file descriptors currently allocated on the host (not per process).
	AllocatedFileHandles uint64 `json:"allocated_file_handles"`
	// The number of running PIDs returned by https://pkg.go.dev/github.com/shirou/gopsutil/v4/process#Pids.
	RunningPIDs uint64 `json:"running_pids"`
	Usage       uint64 `json:"usage"`
	Limit       uint64 `json:"limit"`

	// AllocatedFileHandlesPercent is the percentage of file descriptors that are currently allocated,
	// based on the current file descriptor limit and the current number of file descriptors allocated on the host (not per process).
	AllocatedFileHandlesPercent string `json:"allocated_file_handles_percent"`
	// UsedPercent is the percentage of file descriptors that are currently in use,
	// based on the current file descriptor limit on the host (not per process).
	UsedPercent string `json:"used_percent"`

	ThresholdAllocatedFileHandles        uint64 `json:"threshold_allocated_file_handles"`
	ThresholdAllocatedFileHandlesPercent string `json:"threshold_allocated_file_handles_percent"`

	ThresholdRunningPIDs        uint64 `json:"threshold_running_pids"`
	ThresholdRunningPIDsPercent string `json:"threshold_running_pids_percent"`

	// Set to true if the file handles are supported.
	FileHandlesSupported bool `json:"file_handles_supported"`
	// Set to true if the file descriptor limit is supported.
	FDLimitSupported bool `json:"fd_limit_supported"`
}

FileDescriptors represents the file descriptors of the host.

type Host

type Host struct {
	ID string `json:"id"`
}

type Kernel

type Kernel struct {
	Arch    string `json:"arch"`
	Version string `json:"version"`
}

type KernelPanicInstance added in v0.6.0

type KernelPanicInstance struct {
	// Process ID from the CPU line
	PID int
	// CPU number where the panic occurred
	CPU int
	// Process name (e.g., "khungtaskd")
	ProcessName string
}

KernelPanicInstance contains information related to a kernel panic event

func (*KernelPanicInstance) Summary added in v0.6.0

func (k *KernelPanicInstance) Summary() string

type MachineMetadata added in v0.3.5

type MachineMetadata struct {
	BootID        string `json:"boot_id"`
	DmidecodeUUID string `json:"dmidecode_uuid"`
	OSMachineID   string `json:"os_machine_id"`
}

type Platform

type Platform struct {
	Name    string `json:"name"`
	Family  string `json:"family"`
	Version string `json:"version"`
}

type Uptimes

type Uptimes struct {
	Seconds             uint64 `json:"seconds"`
	BootTimeUnixSeconds uint64 `json:"boot_time_unix_seconds"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL