Documentation
¶
Index ¶
- Constants
- func CheckForCollectors(ctx context.Context) error
- func FetchCollectors(ctx context.Context) error
- func SaveCollectors(c Collectors) error
- type APIAction
- type APIActions
- type APICollector
- type APICollectors
- type APIConfig
- type APIConfigCollector
- type Action
- type Actions
- type Collector
- type Collectors
- type Command
- type CommandData
- type CommandResult
- type Config
- type ConfigData
- type ConfigFile
- type ConfigResult
- type InstalledCollector
- type InstalledCollectors
- type Platform
- type Poller
- type Result
Constants ¶
View Source
const ( START = "start" STOP = "stop" RESTART = "restart" STATUS = "status" RELOAD = "reload" INVENTORY = "inventory" VERSION = "version" )
View Source
const ( // action types. CONFIG = "config" COMMAND = "command" STATUS_ACTIVE = "active" //nolint:revive,nosnakecase,stylecheck STATUS_ERROR = "error" //nolint:revive,nosnakecase,stylecheck )
Variables ¶
This section is empty.
Functions ¶
func CheckForCollectors ¶
func FetchCollectors ¶
func SaveCollectors ¶
func SaveCollectors(c Collectors) error
Types ¶
type APIAction ¶
type APIAction struct {
ConfigAssignmentID string `json:"collector_config_assignment_id"`
Config APIConfig `json:"collector_config"`
Collector APIConfigCollector `json:"collector"`
}
type APIActions ¶
type APIActions []APIAction
type APICollector ¶
type APICollector struct {
Platforms []Platform `json:"platforms"`
}
type APICollectors ¶
type APICollectors []APICollector
type APIConfigCollector ¶
type APIConfigCollector struct {
ID string `json:"collector_type_id"`
}
type Collector ¶
type Collector struct {
ConfigFiles map[string]string `json:"config_files" yaml:"config_files"`
Binary string `json:"binary" yaml:"binary"`
Start string `json:"start" yaml:"start"`
Stop string `json:"stop" yaml:"stop"`
Restart string `json:"restart" yaml:"restart"`
Reload string `json:"reload" yaml:"reload"`
Status string `json:"status" yaml:"status"`
Version string `json:"version" yaml:"version"`
}
type Collectors ¶
key1 is platform (GOOS) e.g. darwin, windows, linux, freebsd, etc. key2 is collector e.g. fluent-bit, telegraf, etc.
func LoadCollectors ¶
func LoadCollectors() (Collectors, error)
func ParseAPICollectors ¶
func ParseAPICollectors(data []byte) (Collectors, error)
type Command ¶
type Command struct {
ID string `json:"id" yaml:"id"`
Collector string `json:"collector" yaml:"collector"`
Command string `json:"command" yaml:"command"`
}
not OS commands, commands the agent knows (e.g. restart_collector, collector_status, etc.). how to restart a collector is in the collector inventory. collector status would be the result of running `systemctl status <collector>`.
type CommandData ¶
type CommandResult ¶
type CommandResult struct {
ID string `json:"id" yaml:"id"`
Status string `json:"status" yaml:"status"` // active or error
CommandData CommandData `json:"data" yaml:"data"`
}
Output will be base64 encoded.
type Config ¶
type Config struct {
ID string `json:"id" yaml:"id"`
Path string `json:"path" yaml:"path"`
Contents string `json:"contents" yaml:"contents"`
}
Contest should be base64 encoded.
type ConfigData ¶
type ConfigFile ¶
type ConfigResult ¶
type ConfigResult struct {
ID string `json:"collector_config_assignment_id" yaml:"collector_config_assignment_id"`
Status string `json:"status" yaml:"status"` // STATUS_ACTIVE or STATUS_ERROR
Info string `json:"info,omitempty" yaml:"info,omitempty"`
ConfigData ConfigData `json:"data,omitempty" yaml:"data,omitempty"`
}
write result will be "OK" or the err received when trying to write the file. reload result will be empty or base64 encoded as it may be multi-line output.
type InstalledCollector ¶
type InstalledCollectors ¶
type InstalledCollectors []InstalledCollector
type Platform ¶
type Platform struct {
CollectorPlatformID string `json:"collector_platform_id" yaml:"collector_platform_id"`
CollectorTypeID string `json:"collector_type_id" yaml:"collector_type_id"`
Executable string `json:"executable" yaml:"executable"`
Start string `json:"start" yaml:"start"`
Stop string `json:"stop" yaml:"stop"`
Restart string `json:"restart" yaml:"restart"`
Reload string `json:"reload" yaml:"reload"`
Status string `json:"status" yaml:"status"`
Version string `json:"version" yaml:"version"`
ConfigFiles []ConfigFile `json:"config_files" yaml:"config_files"`
}
type Result ¶
type Result struct {
ActionID string `json:"action_id" yaml:"action_id"` // not used at this time, api only supports configs
ConfigResult `json:"config_result" yaml:"config_result"`
CommandResult `json:"command_result" yaml:"command_result"`
}
Click to show internal directories.
Click to hide internal directories.