fd

package
v0.0.1-test1 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

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"
)
View Source
const Name = "file-descriptor"

Variables

This section is empty.

Functions

func Get

func Get(ctx context.Context) (_ any, e error)

func New

Types

type Config

type Config struct {
	Query query_config.Config `json:"query"`
}

func ParseConfig

func ParseConfig(b any, db *sql.DB) (*Config, error)

func (Config) Validate

func (cfg Config) Validate() error

type Output

type Output struct {
	RunningPIDs uint64   `json:"running_pids"`
	Usage       uint64   `json:"usage"`
	Limit       uint64   `json:"limit"`
	UsedPercent string   `json:"used_percent"`
	Errors      []string `json:"errors,omitempty"`
}

func ParseOutputJSON

func ParseOutputJSON(data []byte) (*Output, error)

func ParseStateFileDescriptors

func ParseStateFileDescriptors(m map[string]string) (*Output, error)

func ParseStatesToOutput

func ParseStatesToOutput(states ...components.State) (*Output, error)

func (Output) GetUsedPercent

func (o Output) GetUsedPercent() (float64, error)

func (*Output) JSON

func (o *Output) JSON() ([]byte, error)

func (*Output) States

func (o *Output) States() ([]components.State, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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