-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmain.go
55 lines (40 loc) · 941 Bytes
/
main.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
51
52
53
54
55
package main
import (
"github.com/NETWAYS/go-check"
"github.com/NETWAYS/go-check/perfdata"
"github.com/NETWAYS/go-check/result"
)
func main() {
defer check.CatchPanic()
var overall result.Overall
check1 := result.PartialResult{}
check1.Output = "Check1"
err := check1.SetState(check.OK)
if err != nil {
check.ExitError(err)
}
pd := &perfdata.Perfdata{
Label: "foo",
Value: perfdata.NewPdvUint64(23),
}
check1.Perfdata.Add(pd)
check2 := result.PartialResult{}
check2.Output = "Check2"
err = check2.SetState(check.Warning)
if err != nil {
check.ExitError(err)
}
pd2 := &perfdata.Perfdata{
Label: "bar",
Value: perfdata.NewPdvUint64(42),
}
check2.Perfdata.Add(pd2)
pd3 := &perfdata.Perfdata{
Label: "foo2 bar",
Value: perfdata.NewPdvUint64(46),
}
check2.Perfdata.Add(pd3)
overall.AddSubcheck(check1)
overall.AddSubcheck(check2)
check.ExitRaw(overall.GetStatus(), overall.GetOutput())
}