Skip to content

Commit

Permalink
[bugfix] fix error message when esxcli graphics fails
Browse files Browse the repository at this point in the history
  • Loading branch information
Tesifonte Belda committed Jun 17, 2023
1 parent 1b50232 commit f85c427
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 18 deletions.
18 changes: 3 additions & 15 deletions internal/vccollector/graphics.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,29 +52,17 @@ func (c *VcCollector) CollectHostGraphics(
}
startTime = time.Now()
if x, err = esxcli.NewExecutor(c.client.Client, host); err != nil {
acc.AddError(
fmt.Errorf(
"could not get esxcli executor for host %s: %w",
host.Name(),
err,
),
)
hostExecutorNewAddError(acc, host.Name(), err)
continue
}
res, err = x.Run([]string{"graphics", "device", "stats", "list"})
hostSt.setMeanResponseTime(time.Since(startTime), c.maxResponseDuration)
if err != nil {
hostExecutorRunAddError(acc, "graphics device", host.Name(), err)
hostSt.setNotResponding(true)
if exit, err := govplus.IsHardQueryError(err); exit {
return err
}
acc.AddError(
fmt.Errorf(
"could not run esxcli storage executor against host %s: %w",
host.Name(),
err,
),
)
hostSt.setNotResponding(true)
continue
}
t = time.Now()
Expand Down
6 changes: 3 additions & 3 deletions internal/vccollector/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func (c *VcCollector) CollectHostHBA(
res, err = x.Run([]string{"storage", "core", "adapter", "list"})
hostSt.setMeanResponseTime(time.Since(startTime), c.maxResponseDuration)
if err != nil {
hostExecutorRunAddError(acc, "storage", host.Name(), err)
hostExecutorRunAddError(acc, "storage core", host.Name(), err)
hostSt.setNotResponding(true)
if exit, err := govplus.IsHardQueryError(err); exit {
return err
Expand Down Expand Up @@ -233,7 +233,7 @@ func (c *VcCollector) CollectHostNIC(
res, err = x.Run([]string{"network", "nic", "list"})
hostSt.setMeanResponseTime(time.Since(startTime), c.maxResponseDuration)
if err != nil {
hostExecutorRunAddError(acc, "nic", host.Name(), err)
hostExecutorRunAddError(acc, "network nic", host.Name(), err)
hostSt.setNotResponding(true)
if exit, err := govplus.IsHardQueryError(err); exit {
return err
Expand Down Expand Up @@ -309,7 +309,7 @@ func (c *VcCollector) CollectHostFw(
res, err = x.Run([]string{"network", "firewall", "get"})
hostSt.setMeanResponseTime(time.Since(startTime), c.maxResponseDuration)
if err != nil {
hostExecutorRunAddError(acc, "firewall", host.Name(), err)
hostExecutorRunAddError(acc, "network firewall", host.Name(), err)
hostSt.setNotResponding(true)
if exit, err := govplus.IsHardQueryError(err); exit {
return err
Expand Down

0 comments on commit f85c427

Please sign in to comment.