bugtool

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const TetragonBPFFS = "/sys/fs/bpf/tetragon"

Variables

This section is empty.

Functions

func Bugtool

func Bugtool(outFname string, bpftool string, gops string) error

Bugtool gathers information and writes it as a tar archive in the given filename

func FindAllMaps added in v1.2.1

func FindAllMaps() ([]bpf.ExtendedMapInfo, error)

FindAllMaps iterates over all maps loaded on the host using MapGetNextID and parses fdinfo to look for memlock.

func FindCgroupMountPath added in v1.2.1

func FindCgroupMountPath(unified bool, controller string) (string, error)

func FindMapsUsedByPinnedProgs added in v1.2.1

func FindMapsUsedByPinnedProgs(path string) ([]bpf.ExtendedMapInfo, error)

FindMapsUsedByPinnedProgs returns all info of maps used by the prog pinned under the path specified as argument. It also retrieve all the maps referenced in progs referenced in program array maps (tail calls).

func FindMemoryCgroupPath added in v1.2.1

func FindMemoryCgroupPath() (unified bool, memoryCgroupPath string, err error)

func FindPinnedMaps added in v1.2.1

func FindPinnedMaps(path string) ([]bpf.ExtendedMapInfo, error)

FindPinnedMaps returns all info of maps pinned under the path specified as argument.

func SaveInitInfo

func SaveInitInfo(info *InitInfo) error

SaveInitInfo saves InitInfo to the info file

func TotalMemlockBytes added in v1.2.1

func TotalMemlockBytes(infos []bpf.ExtendedMapInfo) int

TotalMemlockBytes iterates over the extend map info and sums the memlock field.

Types

type AggregatedMap added in v1.2.1

type AggregatedMap struct {
	Name              string  `json:"name,omitempty"`
	Type              string  `json:"type,omitempty"`
	KeySize           int     `json:"key_size,omitempty"`
	ValueSize         int     `json:"value_size,omitempty"`
	MaxEntries        int     `json:"max_entries,omitempty"`
	Count             int     `json:"count,omitempty"`
	TotalMemlockBytes int     `json:"total_memlock_bytes,omitempty"`
	PercentOfTotal    float64 `json:"percent_of_total,omitempty"`
}

type DiffMap added in v1.2.1

type DiffMap struct {
	ID           int    `json:"id,omitempty"`
	Name         string `json:"name,omitempty"`
	Type         string `json:"type,omitempty"`
	KeySize      int    `json:"key_size,omitempty"`
	ValueSize    int    `json:"value_size,omitempty"`
	MaxEntries   int    `json:"max_entries,omitempty"`
	MemlockBytes int    `json:"memlock_bytes,omitempty"`
}

type InitInfo

type InitInfo struct {
	ExportFname string `json:"export_fname"`
	LibDir      string `json:"lib_dir"`
	BtfFname    string `json:"btf_fname"`
	ServerAddr  string `json:"server_address"`
	MetricsAddr string `json:"metrics_address"`
	GopsAddr    string `json:"gops_address"`
	MapDir      string `json:"map_dir"`
	BpfToolPath string `json:"bpftool_path"`
	GopsPath    string `json:"gops_path"`
	PID         int    `json:"pid"`
}

InitInfo contains information about how Tetragon was initialized.

func LoadInitInfo

func LoadInitInfo() (*InitInfo, error)

LoadInitInfo returns the InitInfo by reading the info file from its default location

type MapsChecksOutput added in v1.2.1

type MapsChecksOutput struct {
	TotalMemlockBytes struct {
		AllMaps         int `json:"all_maps,omitempty"`
		PinnedProgsMaps int `json:"pinned_progs_maps,omitempty"`
		PinnedMaps      int `json:"pinned_maps,omitempty"`
	} `json:"total_memlock_bytes,omitempty"`

	MapsStats struct {
		PinnedProgsMaps int `json:"pinned_progs_maps,omitempty"`
		PinnedMaps      int `json:"pinned_maps,omitempty"`
		Inter           int `json:"inter,omitempty"`
		Exter           int `json:"exter,omitempty"`
		Union           int `json:"union,omitempty"`
		Diff            int `json:"diff,omitempty"`
	} `json:"maps_stats,omitempty"`

	DiffMaps []DiffMap `json:"diff_maps,omitempty"`

	AggregatedMaps []AggregatedMap `json:"aggregated_maps,omitempty"`
}

func RunMapsChecks added in v1.2.1

func RunMapsChecks(path string) (*MapsChecksOutput, error)

type MultiLog

type MultiLog struct {
	Logs []logrus.FieldLogger
}

MultiLog maintains multiple loggers

func (*MultiLog) Info

func (ml *MultiLog) Info(args ...interface{})

func (*MultiLog) Infof

func (ml *MultiLog) Infof(format string, args ...interface{})

func (*MultiLog) Warn

func (ml *MultiLog) Warn(args ...interface{})

func (*MultiLog) Warnf

func (ml *MultiLog) Warnf(format string, args ...interface{})

func (*MultiLog) WithError

func (ml *MultiLog) WithError(err error) *MultiLogEntry

WithError adds err as a single field (using ErrorKey)

func (*MultiLog) WithField

func (ml *MultiLog) WithField(key string, value interface{}) *MultiLogEntry

WithField creates a new entry and adds a field to it.

type MultiLogEntry

type MultiLogEntry struct {
	Entries []*logrus.Entry
}

MultiLogEntry maintains entries generated using a MultiLog

func (*MultiLogEntry) Info

func (mle *MultiLogEntry) Info(args ...interface{})

Info logs at the Info level

func (*MultiLogEntry) Infof

func (mle *MultiLogEntry) Infof(format string, args ...interface{})

func (*MultiLogEntry) Warn

func (mle *MultiLogEntry) Warn(args ...interface{})

Warn logs at the Warning level

func (*MultiLogEntry) Warnf

func (mle *MultiLogEntry) Warnf(format string, args ...interface{})

func (*MultiLogEntry) WithError

func (mle *MultiLogEntry) WithError(err error) *MultiLogEntry

WithError adds err as a single field (using ErrorKey)

func (*MultiLogEntry) WithField

func (mle *MultiLogEntry) WithField(key string, value interface{}) *MultiLogEntry

WithField creates a new entry by adding a field to an existing one

Jump to

Keyboard shortcuts

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