Skip to content

Commit

Permalink
[bugfix]: avoid panic when no host metrics are collected
Browse files Browse the repository at this point in the history
  • Loading branch information
Tesifonte Belda committed Sep 5, 2022
1 parent a8df9ac commit 5fa50c6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion plugins/inputs/vcstat/vcstat.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,9 @@ func (vcs *VCstatConfig) Gather(acc telegraf.Accumulator) error {

// selfmonitoring
vcs.GatherTime.Set(int64(time.Since(startTime).Nanoseconds()))
vcs.NotRespondingHosts.Set(int64(vcs.vcc.GetNumberNotRespondingHosts()))
if vcs.HostHBAInstances || vcs.HostNICInstances || vcs.HostFwInstances {
vcs.NotRespondingHosts.Set(int64(vcs.vcc.GetNumberNotRespondingHosts()))
}
for _, m := range selfstat.Metrics() {
if m.Name() != "internal_agent" {
acc.AddMetric(m)
Expand Down

0 comments on commit 5fa50c6

Please sign in to comment.