Skip to content

Commit cb16e25

Browse files
committed
Fix service and downtime listing in garbage collector
Also bump go-icinga2-client to v0.0.13
1 parent 13fb0f1 commit cb16e25

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

gc/gc.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,17 @@ func Collect(ts time.Time, c config.Configuration) error {
6969
// Get all signalilo services
7070
icinga := c.GetIcingaClient()
7171
hostname := c.GetConfig().HostName
72-
services, err := icinga.ListServices(fmt.Sprintf("host=%v", hostname))
72+
services, err := icinga.ListServices(icinga2.QueryFilter{
73+
Filter: fmt.Sprintf(`match("%v", service.host_name)`, hostname),
74+
})
7375
if err != nil {
7476
l.Errorf(fmt.Sprintf("[Collect] Error while listing services: %v", err))
7577
return err
7678
}
7779
l.V(2).Infof("[Collect] Found %v services with host = %v", len(services), hostname)
78-
downtimes, err := icinga.ListDowntimes(fmt.Sprintf("host=%v", hostname))
80+
downtimes, err := icinga.ListDowntimes(icinga2.QueryFilter{
81+
Filter: fmt.Sprintf(`match("%v", downtime.host_name)`, hostname),
82+
})
7983
if err != nil {
8084
l.Errorf(fmt.Sprintf("[Collect] Error while listing downtimes: %v", err))
8185
return err

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ require (
88
github.com/prometheus/alertmanager v0.21.0
99
github.com/sirupsen/logrus v1.8.0
1010
github.com/stretchr/testify v1.7.0
11-
github.com/vshn/go-icinga2-client v0.0.12
11+
github.com/vshn/go-icinga2-client v0.0.13
1212
gopkg.in/alecthomas/kingpin.v2 v2.2.6
1313
)

go.sum

+3
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,7 @@ github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H
414414
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
415415
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
416416
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
417+
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
417418
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
418419
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
419420
github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
@@ -424,6 +425,8 @@ github.com/vshn/go-icinga2-client v0.0.11 h1:R9AhqestE+7ct3xMvbHhup1RLP86X74Qqzh
424425
github.com/vshn/go-icinga2-client v0.0.11/go.mod h1:T6r6HQ22NZsSUI/u5ThOlPsQrtbnJIImZTPAvEOSCdI=
425426
github.com/vshn/go-icinga2-client v0.0.12 h1:HCNgId5XjUeahhe0+K3YMQ6RJi5nrKeR9b9K7l70VVk=
426427
github.com/vshn/go-icinga2-client v0.0.12/go.mod h1:T6r6HQ22NZsSUI/u5ThOlPsQrtbnJIImZTPAvEOSCdI=
428+
github.com/vshn/go-icinga2-client v0.0.13 h1:zX0xceD5zyqOojZpPfNWyiqXnMAjQpc7fgfekR6u2ts=
429+
github.com/vshn/go-icinga2-client v0.0.13/go.mod h1:T6r6HQ22NZsSUI/u5ThOlPsQrtbnJIImZTPAvEOSCdI=
427430
github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I=
428431
github.com/xdg/stringprep v0.0.0-20180714160509-73f8eece6fdc/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y=
429432
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=

0 commit comments

Comments
 (0)