forked from elastic/beats
-
Notifications
You must be signed in to change notification settings - Fork 0
/
system.go
35 lines (27 loc) · 770 Bytes
/
system.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package system
import (
"flag"
"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
}