Skip to content

Commit

Permalink
Make system firmware version optional in BMC info
Browse files Browse the repository at this point in the history
There are systems that do not make this available, so don't make the
entire collector fail if only this metric can not be read. Instead, set
it to "N/A" if it cannot be determined.

This fixes prometheus-community#57.
  • Loading branch information
bitfehler committed Oct 22, 2020
1 parent 1561913 commit 57c0f96
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,9 @@ version). Example:
ipmi_bmc_info{firmware_revision="1.66",manufacturer_id="Dell Inc. (674)",system_firmware_version="2.6.1"} 1
**Note:** some systems do not expose the system's firmware version, in which
case it will be exported as `"N/A"`.
### Chassis Power State
This metric is only provided if the `chassis` collector is enabled.
Expand Down
5 changes: 3 additions & 2 deletions collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -592,8 +592,9 @@ func collectBmcInfo(ch chan<- prometheus.Metric, target ipmiTarget) (int, error)
}
systemFirmwareVersion, err := getBMCInfoSystemFirmwareVersion(output)
if err != nil {
log.Errorf("Failed to parse bmc-info data from %s: %s", targetName(target.host), err)
return 0, err
// This one is not always available.
log.Debugf("Failed to parse bmc-info data from %s: %s", targetName(target.host), err)
systemFirmwareVersion = "N/A"
}
ch <- prometheus.MustNewConstMetric(
bmcInfo,
Expand Down

0 comments on commit 57c0f96

Please sign in to comment.