1 Star 0 Fork 0

sqos/beats

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
system.go 1.05 KB
一键复制 编辑 原始数据 按行查看 历史
package system
import (
"flag"
"math"
"sync"
"github.com/elastic/beats/metricbeat/mb"
)
var (
HostFS = flag.String("system.hostfs", "", "mountpoint of the host's filesystem for use in monitoring a host from within a container")
)
var once sync.Once
func init() {
// Register the ModuleFactory function for the "system" module.
if err := mb.Registry.AddModule("system", NewModule); err != nil {
panic(err)
}
}
type Module struct {
mb.BaseModule
HostFS string // Mountpoint of the host's filesystem for use in monitoring inside a container.
}
func NewModule(base mb.BaseModule) (mb.Module, error) {
// This only needs to be configured once for all system modules.
once.Do(func() {
initModule()
})
return &Module{BaseModule: base, HostFS: *HostFS}, nil
}
func Round(val float64, roundOn float64, places int) (newVal float64) {
var round float64
pow := math.Pow(10, float64(places))
digit := pow * val
_, div := math.Modf(digit)
if div >= roundOn {
round = math.Ceil(digit)
} else {
round = math.Floor(digit)
}
newVal = round / pow
return
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/sqos/beats.git
git@gitee.com:sqos/beats.git
sqos
beats
beats
v5.1.2

搜索帮助

0d507c66 1850385 C8b1a773 1850385