Documentation ¶
Overview ¶
Package fd tracks the number of file descriptors used on the host.
Index ¶
- Constants
- func CreateGet(cfg Config) query.GetFunc
- func New(ctx context.Context, cfg Config) components.Component
- type Config
- type Output
- func (o Output) GetAllocatedFileHandlesPercent() (float64, error)
- func (o Output) GetThresholdAllocatedFileHandlesPercent() (float64, error)
- func (o Output) GetThresholdRunningPIDsPercent() (float64, error)
- func (o Output) GetUsedPercent() (float64, error)
- func (o *Output) JSON() ([]byte, error)
- func (o *Output) States() ([]components.State, error)
Constants ¶
View Source
const ( EventNameErrorVFSFileMaxLimitReached = "error_vfs_file_max_limit_reached" EventKeyErrorVFSFileMaxLimitReachedUnixSeconds = "unix_seconds" EventKeyErrorVFSFileMaxLimitReachedLogLine = "log_line" )
View Source
const ( StateNameFileDescriptors = "file_descriptors" // The number of file descriptors currently allocated on the host (not per process). StateKeyAllocatedFileHandles = "allocated_file_handles" // The number of running PIDs returned by https://pkg.go.dev/github.com/shirou/gopsutil/v4/process#Pids. StateKeyRunningPIDs = "running_pids" StateKeyUsage = "usage" StateKeyLimit = "limit" StateKeyAllocatedFileHandlesPercent = "allocated_file_handles_percent" StateKeyUsedPercent = "used_percent" StateKeyThresholdAllocatedFileHandles = "threshold_allocated_file_handles" StateKeyThresholdAllocatedFileHandlesPercent = "threshold_allocated_file_handles_percent" StateKeyThresholdRunningPIDs = "threshold_running_pids" StateKeyThresholdRunningPIDsPercent = "threshold_running_pids_percent" // Set to true if the file handles are supported. StateKeyFileHandlesSupported = "file_handles_supported" // Set to true if the file descriptor limit is supported. StateKeyFDLimitSupported = "fd_limit_supported" )
View Source
const DefaultThresholdAllocatedFileHandles = 900000
DefaultThresholdAllocatedFileHandles is some high number, in case the system is under high file descriptor usage.
View Source
const DefaultThresholdRunningPIDs = 900000
DefaultThresholdRunningPIDs is some high number, in case fd-max is unlimited
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { Query query_config.Config `json:"query"` // ThresholdAllocatedFileHandles is the number of file descriptors that are currently allocated, // at which we consider the system to be under high file descriptor usage. ThresholdAllocatedFileHandles uint64 `json:"threshold_allocated_file_handles"` // ThresholdRunningPIDs is the number of running pids at which // we consider the system to be under high file descriptor usage. // This is useful for triggering alerts when the system is under high load. // And useful when the actual system fd-max is set to unlimited. ThresholdRunningPIDs uint64 `json:"threshold_running_pids"` }
type Output ¶
type Output struct { AllocatedFileHandles uint64 `json:"allocated_file_handles"` 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"` Errors []string `json:"errors,omitempty"` }
func ParseOutputJSON ¶
func ParseStatesToOutput ¶
func ParseStatesToOutput(states ...components.State) (*Output, error)
func (Output) GetAllocatedFileHandlesPercent ¶ added in v0.3.1
func (Output) GetThresholdAllocatedFileHandlesPercent ¶ added in v0.3.1
func (Output) GetThresholdRunningPIDsPercent ¶ added in v0.3.1
func (Output) GetUsedPercent ¶
Directories ¶
Path | Synopsis |
---|---|
Package id defines the component ID for the file descriptor component.
|
Package id defines the component ID for the file descriptor component. |
Package metrics implements the file descriptor metrics collection and reporting.
|
Package metrics implements the file descriptor metrics collection and reporting. |
Click to show internal directories.
Click to hide internal directories.