diff --git a/internal/vccollector/host.go b/internal/vccollector/host.go index 6f34b06..3b9151b 100644 --- a/internal/vccollector/host.go +++ b/internal/vccollector/host.go @@ -114,6 +114,9 @@ func (c *VcCollector) CollectHostInfo( acc.AddFields("vcstat_host", hsfields, hstags, t) } + if err = ctx.Err(); err != nil { + return err + } } } @@ -190,6 +193,9 @@ func (c *VcCollector) CollectHostHBA( hostSt.setNotResponding(true) return fmt.Errorf("slow response from %s: %w", host.Name(), context.DeadlineExceeded) } + if err = ctx.Err(); err != nil { + return err + } } } @@ -270,6 +276,9 @@ func (c *VcCollector) CollectHostNIC( hostSt.setNotResponding(true) return fmt.Errorf("slow response from %s: %w", host.Name(), context.DeadlineExceeded) } + if err = ctx.Err(); err != nil { + return err + } } } @@ -353,6 +362,9 @@ func (c *VcCollector) CollectHostFw( hostSt.setNotResponding(true) return fmt.Errorf("slow response from %s: %w", host.Name(), context.DeadlineExceeded) } + if err = ctx.Err(); err != nil { + return err + } } } @@ -443,6 +455,9 @@ func (c *VcCollector) CollectHostServices( acc.AddFields("vcstat_host_service", hsfields, hstags, t) } } + if err = ctx.Err(); err != nil { + return err + } } } @@ -460,6 +475,7 @@ func (c *VcCollector) ReportHostEsxcliResponse( hostSt *hostState t time.Time z time.Duration + err error respondingCode int ) @@ -495,6 +511,9 @@ func (c *VcCollector) ReportHostEsxcliResponse( acc.AddFields("vcstat_host_esxcli", hsfields, hstags, t) } + if err = ctx.Err(); err != nil { + return err + } } return nil