Documentation
¶
Overview ¶
Package fd tracks the number of file descriptors used on the host.
Index ¶
Constants ¶
View Source
const ( StateNameFileDescriptors = "file_descriptors" // 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" StateKeyUsedPercent = "used_percent" StateKeyFDLimitSupported = "fd_limit_supported" StateKeyThresholdLimit = "threshold_limit" StateKeyThresholdUsedPercent = "threshold_used_percent" )
View Source
const DefaultThresholdLimit = 1048576
DefaultThresholdLimit is some high number, in case fd-max is unlimited
View Source
const Name = "file-descriptor"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
Query query_config.Config `json:"query"`
// ThresholdLimit is the number of file descriptor limit 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.
ThresholdLimit uint64 `json:"threshold_limit"`
}
type Output ¶
type Output struct {
RunningPIDs uint64 `json:"running_pids"`
Usage uint64 `json:"usage"`
Limit uint64 `json:"limit"`
// 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"`
// Set to true if the max file descriptor is supported (e.g., /proc/sys/fs/file-max exists on linux).
FDLimitSupported bool `json:"fd_limit_supported"`
ThresholdLimit uint64 `json:"threshold_limit"`
// ThresholdUsedPercent is the percentage of file descriptors that are currently in use,
// based on the threshold file descriptor limit.
ThresholdUsedPercent string `json:"threshold_used_percent"`
Errors []string `json:"errors,omitempty"`
}
func ParseOutputJSON ¶
func ParseStatesToOutput ¶
func ParseStatesToOutput(states ...components.State) (*Output, error)
func (Output) GetThresholdUsedPercent ¶
func (Output) GetUsedPercent ¶
Click to show internal directories.
Click to hide internal directories.