socket

package
v0.0.0-...-be347a3 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2019 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package socket captures active sockets and the processes that own them.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(base mb.BaseMetricSet) (mb.MetricSet, error)

Types

type Config

type Config struct {
	ReverseLookup *ReverseLookupConfig `config:"socket.reverse_lookup"`
}

Config is the configuration specific to the socket MetricSet.

type MetricSet

type MetricSet struct {
	mb.BaseMetricSet
	// contains filtered or unexported fields
}

func (*MetricSet) Fetch

func (m *MetricSet) Fetch(r mb.ReporterV2) error

Fetch socket metrics from the system

type ReverseLookupCache

type ReverseLookupCache struct {
	// contains filtered or unexported fields
}

ReverseLookupCache is a cache for storing and retrieving the results of reverse DNS queries. It caches the results of queries regardless of their outcome (success or failure). The result is cached for the amount of time specified by parameters and not based on the TTL from the PTR record.

func NewReverseLookupCache

func NewReverseLookupCache(successTTL, failureTTL time.Duration) *ReverseLookupCache

NewReverseLookupCache returns a new cache.

func (*ReverseLookupCache) Cleanup

func (c *ReverseLookupCache) Cleanup()

Cleanup removes expired entries from the cache.

func (ReverseLookupCache) Lookup

func (c ReverseLookupCache) Lookup(ip net.IP) (string, error)

Lookup performs a reverse lookup on the given IP address. A cached result will be returned if it is contained in the cache, otherwise a lookup is performed.

type ReverseLookupConfig

type ReverseLookupConfig struct {
	Enabled    *bool         `config:"enabled"`
	SuccessTTL time.Duration `config:"success_ttl"`
	FailureTTL time.Duration `config:"failure_ttl"`
}

ReverseLookupConfig contains the configuration that controls the reverse DNS lookup behavior.

func (*ReverseLookupConfig) IsEnabled

func (c *ReverseLookupConfig) IsEnabled() bool

IsEnabled returns true if reverse_lookup is defined and 'enabled' is either not set or set to true.

type UserCache

type UserCache map[int]*user.User

UserCache is a cache of UID to username.

func NewUserCache

func NewUserCache() UserCache

NewUserCache returns a new UserCache.

func (UserCache) LookupUID

func (c UserCache) LookupUID(uid int) *user.User

LookupUID looks up a UID and returns the username associated with it. If no username could be found an empty string is returned. The value will be cached forever.

Jump to

Keyboard shortcuts

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