Fetch the repository succeeded.
package cpu
import (
"strings"
"github.com/pkg/errors"
"github.com/elastic/beats/libbeat/common/cfgwarn"
)
// CPU metric types.
const (
percentages = "percentages"
normalizedPercentages = "normalized_percentages"
ticks = "ticks"
)
// Config for the system cpu metricset.
type Config struct {
Metrics []string `config:"cpu.metrics"`
CPUTicks *bool `config:"cpu_ticks"` // Deprecated.
}
// Validate validates the cpu config.
func (c Config) Validate() error {
if c.CPUTicks != nil {
cfgwarn.Deprecate("6.1", "cpu_ticks is deprecated. Add 'ticks' to the cpu.metrics list.")
}
if len(c.Metrics) == 0 {
return errors.New("cpu.metrics cannot be empty")
}
for _, metric := range c.Metrics {
switch strings.ToLower(metric) {
case percentages, normalizedPercentages, ticks:
default:
return errors.Errorf("invalid cpu.metrics value '%v' (valid "+
"options are %v, %v, and %v)", metric, percentages,
normalizedPercentages, ticks)
}
}
return nil
}
var defaultConfig = Config{
Metrics: []string{percentages},
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。