-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdiskspace.go
50 lines (38 loc) · 982 Bytes
/
diskspace.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package main
import (
"log"
)
type Filesystem struct {
Device string
Mount string
Type string
}
type FilesystemStats struct {
DeviceName string
Used float64
Free float64
Reserved float64
Available float64
}
const DiskspaceModuleName = "diskspace"
var defaultCheckTypes = []string{"ext2", "ext3", "ext4", "xfs", "glusterfs", "nfs", "ntfs", "hfs", "fat32", "fat16", "btrfs"}
type DiskspaceInputModule struct {
CheckTypes StringSet
}
func (m *DiskspaceInputModule) Name() string {
return DiskspaceModuleName
}
func (m *DiskspaceInputModule) Init(config *Config, moduleConfig *ModuleConfig) error {
m.CheckTypes = StringSet{}
types, err := moduleConfig.SettingsStringArray("filesystems")
if err != nil {
log.Printf("filesystems not set, using default settings: %v", err)
types = defaultCheckTypes
}
log.Printf("types: %v", types)
m.CheckTypes.AddAll(types)
return nil
}
func (m *DiskspaceInputModule) TearDown() error {
return nil
}