Documentation
¶
Overview ¶
Package configurablemetrics handles the collection of arbitrary metric data in the agent, as defined by a collection definition configuration file.
Index ¶
- func BuildMetricMap(metrics []*cmpb.EvalMetric) map[string]string
- func CollectMetricsFromFile(reader FileReader, path string, metrics []*cmpb.EvalMetric) map[string]string
- func CollectOSCommandMetric(m *cmpb.OSCommandMetric, exec commandlineexecutor.Execute, vendor string) (label, value string)
- func Evaluate[M proto.Message](metric M, output Output) (string, bool)
- type FileReader
- type Output
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildMetricMap ¶
func BuildMetricMap(metrics []*cmpb.EvalMetric) map[string]string
BuildMetricMap iterates over an EvalMetric slice and returns a map of metric labels defaulted to an empty string value.
func CollectMetricsFromFile ¶
func CollectMetricsFromFile(reader FileReader, path string, metrics []*cmpb.EvalMetric) map[string]string
CollectMetricsFromFile scans a configuration file and returns a map of collected metric values, keyed by metric label.
func CollectOSCommandMetric ¶
func CollectOSCommandMetric(m *cmpb.OSCommandMetric, exec commandlineexecutor.Execute, vendor string) (label, value string)
CollectOSCommandMetric executes a command, evaluates the output, and returns the metric label and resulting value of the evaluation.
If a specific os_vendor is supplied for a metric, then the command will only be run if the system is using the same vendor. Otherwise, the metric should be excluded from collection.
Types ¶
type FileReader ¶
type FileReader func(string) (io.ReadCloser, error)
FileReader abstracts loading and reading files into an io.ReadCloser object.