Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Agent ¶
type Agent struct {
Skipmap map[string]struct{} // collectors to skip
MetricFrequency time.Duration // frequency of metric collection
InvFrequency time.Duration // frequency of inventory collection
CollectorTimeout time.Duration // time to wait on collection before timing out
ID int // ID of the inventory blob
TimeoutLimit int // max number of times a collector can timeout before being skipped
ErrorLimit int // max number of times a collector can error out before being skipped
SendCh chan []byte // channel for sending data to Server
WaitGroup sync.WaitGroup // wait for collectors to finish
WaitTime time.Duration // number of seconds between attempting to reconnect to remote server
Config *Config // the agent config object
SigChan chan os.Signal
Destination *Destination // currnet destination
// contains filtered or unexported fields
}
Agent represents information of agent like metric, inventory etc
func (*Agent) NonBlockingSend ¶
NonBlockingSend sends data to stdout and over channel and is non-blocking
func (*Agent) ProcessInv ¶
ProcessInv collects, formats, and sends inventory.
type BaseCollector ¶
type BaseCollector struct {
// contains filtered or unexported fields
}
BaseCollector contains common information for collectors
func (*BaseCollector) Precheck ¶
func (u *BaseCollector) Precheck(a *Agent) error
Precheck validates dependencies needed for collection by collectors
type Blob ¶
type Blob struct {
Type string
ID int
Digest, NodeID string
Timestamp string
Content json.RawMessage
}
Blob defines format of message sent to stdout or sendBuffer
type Config ¶
type Config struct {
NodeID string `json:"-"` // ID of host machine
Chdir string `json:"chdir"`
CollectorTimeout int `json:"collection-timeout"` // number of seconds before a collector times out
Destination string `json:"destination"`
DryRun bool `json:"dry-run"`
Duration int `json:"duration"` // How many seconds to run agent for
Freq int `json:"frequency"`
SkipStr string `json:"skipStr"`
Stdout bool `json:"stdout"`
WaitTime int `json:"retrywait"` // number of seconds between attempting to reconnect to remote server
}
Config settings saved in external storage
so we can run hds-agent without command line flags
func NewDefaultConfig ¶
func NewDefaultConfig() *Config
NewDefaultConfig sets the default flags for the Agent so we can support passing no flags from the command line
func (*Config) InitializeNodeID ¶
InitializeNodeID will set nodeID if agent doesn't already have node.id file with valid value
func (*Config) ReadNodeID ¶
ReadNodeID reads the node.id file when available
func (*Config) WriteNodeID ¶
WriteNodeID writes the node.id file
type Destination ¶
type Destination struct {
// contains filtered or unexported fields
}
Destination contains information of destination server where metric/inventory data needs to be sent
type Inventory ¶
type Inventory struct {
Name, Type string
Data json.RawMessage
Timeout bool
// contains filtered or unexported fields
}
Inventory contains information of inventory of machine
type InventoryCollector ¶
type InventoryCollector struct {
BaseCollector
// contains filtered or unexported fields
}
InventoryCollector contains information of inventory collector
type MetricCollector ¶
type MetricCollector struct {
BaseCollector
// contains filtered or unexported fields
}
MetricCollector contains information of metric collector