ZFS Collector: Convert dashes to underscores for metrics

This fixes #442, and prevents other ZFS metrics from slipping through in the future.

Signed-Off-By: Joe Handzik <joseph.t.handzik@hpe.com>
This commit is contained in:
Joe Handzik 2017-01-31 14:11:56 -06:00
parent 7cfa5e75b8
commit 8c23f5ff54
2 changed files with 13 additions and 13 deletions

View File

@ -2383,18 +2383,18 @@ node_zfs_dmu_tx_dmu_tx_quota 0
# HELP node_zfs_dmu_tx_dmu_tx_suspended kstat.zfs.misc.dmu_tx.dmu_tx_suspended # HELP node_zfs_dmu_tx_dmu_tx_suspended kstat.zfs.misc.dmu_tx.dmu_tx_suspended
# TYPE node_zfs_dmu_tx_dmu_tx_suspended untyped # TYPE node_zfs_dmu_tx_dmu_tx_suspended untyped
node_zfs_dmu_tx_dmu_tx_suspended 0 node_zfs_dmu_tx_dmu_tx_suspended 0
# HELP node_zfs_fm_erpt-dropped kstat.zfs.misc.fm.erpt-dropped # HELP node_zfs_fm_erpt_dropped kstat.zfs.misc.fm.erpt-dropped
# TYPE node_zfs_fm_erpt-dropped untyped # TYPE node_zfs_fm_erpt_dropped untyped
node_zfs_fm_erpt-dropped 18 node_zfs_fm_erpt_dropped 18
# HELP node_zfs_fm_erpt-set-failed kstat.zfs.misc.fm.erpt-set-failed # HELP node_zfs_fm_erpt_set_failed kstat.zfs.misc.fm.erpt-set-failed
# TYPE node_zfs_fm_erpt-set-failed untyped # TYPE node_zfs_fm_erpt_set_failed untyped
node_zfs_fm_erpt-set-failed 0 node_zfs_fm_erpt_set_failed 0
# HELP node_zfs_fm_fmri-set-failed kstat.zfs.misc.fm.fmri-set-failed # HELP node_zfs_fm_fmri_set_failed kstat.zfs.misc.fm.fmri-set-failed
# TYPE node_zfs_fm_fmri-set-failed untyped # TYPE node_zfs_fm_fmri_set_failed untyped
node_zfs_fm_fmri-set-failed 0 node_zfs_fm_fmri_set_failed 0
# HELP node_zfs_fm_payload-set-failed kstat.zfs.misc.fm.payload-set-failed # HELP node_zfs_fm_payload_set_failed kstat.zfs.misc.fm.payload-set-failed
# TYPE node_zfs_fm_payload-set-failed untyped # TYPE node_zfs_fm_payload_set_failed untyped
node_zfs_fm_payload-set-failed 0 node_zfs_fm_payload_set_failed 0
# HELP node_zfs_vdev_cache_delegations kstat.zfs.misc.vdev_cache_stats.delegations # HELP node_zfs_vdev_cache_delegations kstat.zfs.misc.vdev_cache_stats.delegations
# TYPE node_zfs_vdev_cache_delegations untyped # TYPE node_zfs_vdev_cache_delegations untyped
node_zfs_vdev_cache_delegations 40 node_zfs_vdev_cache_delegations 40

View File

@ -81,7 +81,7 @@ func (c *zfsCollector) Update(ch chan<- prometheus.Metric) (err error) {
func (s zfsSysctl) metricName() string { func (s zfsSysctl) metricName() string {
parts := strings.Split(string(s), ".") parts := strings.Split(string(s), ".")
return parts[len(parts)-1] return strings.Replace(parts[len(parts)-1], "-", "_", -1)
} }
func (c *zfsCollector) constSysctlMetric(subsystem string, sysctl zfsSysctl, value int) prometheus.Metric { func (c *zfsCollector) constSysctlMetric(subsystem string, sysctl zfsSysctl, value int) prometheus.Metric {