mirror of
https://github.com/prometheus/node_exporter.git
synced 2025-03-05 21:00:12 -08:00
Revert "I have no idea how the code in node_exporter prometheus compiles."
This reverts commit a372120527
.
This commit is contained in:
parent
7023184297
commit
20ed63b2e7
|
@ -18,9 +18,13 @@ package collector
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/go-kit/log"
|
"github.com/go-kit/log"
|
||||||
|
"github.com/go-kit/log/level"
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
|
|
||||||
|
"golang.org/x/sys/unix"
|
||||||
)
|
)
|
||||||
|
|
||||||
type zfsCollector struct {
|
type zfsCollector struct {
|
||||||
|
@ -33,7 +37,7 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
registerCollector("zfs", defaultEnabled, NewZfsCollector)
|
registerCollector(zfsCollectorSubsystem, defaultEnabled, NewZfsCollector)
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewZfsCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) {
|
func NewZfsCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) {
|
||||||
|
@ -45,6 +49,7 @@ func NewZfsCollector(config *NodeCollectorConfig, logger log.Logger) (Collector,
|
||||||
mib: "kstat.zfs.misc.abdstats.linear_cnt",
|
mib: "kstat.zfs.misc.abdstats.linear_cnt",
|
||||||
dataType: bsdSysctlTypeUint64,
|
dataType: bsdSysctlTypeUint64,
|
||||||
valueType: prometheus.CounterValue,
|
valueType: prometheus.CounterValue,
|
||||||
|
labels: nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "abdstats_linear_data_bytes",
|
name: "abdstats_linear_data_bytes",
|
||||||
|
@ -52,6 +57,7 @@ func NewZfsCollector(config *NodeCollectorConfig, logger log.Logger) (Collector,
|
||||||
mib: "kstat.zfs.misc.abdstats.linear_data_size",
|
mib: "kstat.zfs.misc.abdstats.linear_data_size",
|
||||||
dataType: bsdSysctlTypeUint64,
|
dataType: bsdSysctlTypeUint64,
|
||||||
valueType: prometheus.GaugeValue,
|
valueType: prometheus.GaugeValue,
|
||||||
|
labels: nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "abdstats_scatter_chunk_waste_bytes",
|
name: "abdstats_scatter_chunk_waste_bytes",
|
||||||
|
@ -59,6 +65,7 @@ func NewZfsCollector(config *NodeCollectorConfig, logger log.Logger) (Collector,
|
||||||
mib: "kstat.zfs.misc.abdstats.scatter_chunk_waste",
|
mib: "kstat.zfs.misc.abdstats.scatter_chunk_waste",
|
||||||
dataType: bsdSysctlTypeUint64,
|
dataType: bsdSysctlTypeUint64,
|
||||||
valueType: prometheus.GaugeValue,
|
valueType: prometheus.GaugeValue,
|
||||||
|
labels: nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "abdstats_scatter_count_total",
|
name: "abdstats_scatter_count_total",
|
||||||
|
@ -66,6 +73,7 @@ func NewZfsCollector(config *NodeCollectorConfig, logger log.Logger) (Collector,
|
||||||
mib: "kstat.zfs.misc.abdstats.scatter_cnt",
|
mib: "kstat.zfs.misc.abdstats.scatter_cnt",
|
||||||
dataType: bsdSysctlTypeUint64,
|
dataType: bsdSysctlTypeUint64,
|
||||||
valueType: prometheus.CounterValue,
|
valueType: prometheus.CounterValue,
|
||||||
|
labels: nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "abdstats_scatter_data_bytes",
|
name: "abdstats_scatter_data_bytes",
|
||||||
|
@ -73,6 +81,7 @@ func NewZfsCollector(config *NodeCollectorConfig, logger log.Logger) (Collector,
|
||||||
mib: "kstat.zfs.misc.abdstats.scatter_data_size",
|
mib: "kstat.zfs.misc.abdstats.scatter_data_size",
|
||||||
dataType: bsdSysctlTypeUint64,
|
dataType: bsdSysctlTypeUint64,
|
||||||
valueType: prometheus.GaugeValue,
|
valueType: prometheus.GaugeValue,
|
||||||
|
labels: nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "abdstats_struct_bytes",
|
name: "abdstats_struct_bytes",
|
||||||
|
@ -80,6 +89,7 @@ func NewZfsCollector(config *NodeCollectorConfig, logger log.Logger) (Collector,
|
||||||
mib: "kstat.zfs.misc.abdstats.struct_size",
|
mib: "kstat.zfs.misc.abdstats.struct_size",
|
||||||
dataType: bsdSysctlTypeUint64,
|
dataType: bsdSysctlTypeUint64,
|
||||||
valueType: prometheus.GaugeValue,
|
valueType: prometheus.GaugeValue,
|
||||||
|
labels: nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "arcstats_anon_bytes",
|
name: "arcstats_anon_bytes",
|
||||||
|
@ -87,6 +97,7 @@ func NewZfsCollector(config *NodeCollectorConfig, logger log.Logger) (Collector,
|
||||||
mib: "kstat.zfs.misc.arcstats.anon_size",
|
mib: "kstat.zfs.misc.arcstats.anon_size",
|
||||||
dataType: bsdSysctlTypeUint64,
|
dataType: bsdSysctlTypeUint64,
|
||||||
valueType: prometheus.GaugeValue,
|
valueType: prometheus.GaugeValue,
|
||||||
|
labels: nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "arcstats_c_bytes",
|
name: "arcstats_c_bytes",
|
||||||
|
@ -94,6 +105,7 @@ func NewZfsCollector(config *NodeCollectorConfig, logger log.Logger) (Collector,
|
||||||
mib: "kstat.zfs.misc.arcstats.c",
|
mib: "kstat.zfs.misc.arcstats.c",
|
||||||
dataType: bsdSysctlTypeUint64,
|
dataType: bsdSysctlTypeUint64,
|
||||||
valueType: prometheus.GaugeValue,
|
valueType: prometheus.GaugeValue,
|
||||||
|
labels: nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "arcstats_c_max_bytes",
|
name: "arcstats_c_max_bytes",
|
||||||
|
@ -101,6 +113,7 @@ func NewZfsCollector(config *NodeCollectorConfig, logger log.Logger) (Collector,
|
||||||
mib: "kstat.zfs.misc.arcstats.c_max",
|
mib: "kstat.zfs.misc.arcstats.c_max",
|
||||||
dataType: bsdSysctlTypeUint64,
|
dataType: bsdSysctlTypeUint64,
|
||||||
valueType: prometheus.GaugeValue,
|
valueType: prometheus.GaugeValue,
|
||||||
|
labels: nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "arcstats_c_min_bytes",
|
name: "arcstats_c_min_bytes",
|
||||||
|
@ -108,6 +121,7 @@ func NewZfsCollector(config *NodeCollectorConfig, logger log.Logger) (Collector,
|
||||||
mib: "kstat.zfs.misc.arcstats.c_min",
|
mib: "kstat.zfs.misc.arcstats.c_min",
|
||||||
dataType: bsdSysctlTypeUint64,
|
dataType: bsdSysctlTypeUint64,
|
||||||
valueType: prometheus.GaugeValue,
|
valueType: prometheus.GaugeValue,
|
||||||
|
labels: nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "arcstats_data_bytes",
|
name: "arcstats_data_bytes",
|
||||||
|
@ -115,6 +129,7 @@ func NewZfsCollector(config *NodeCollectorConfig, logger log.Logger) (Collector,
|
||||||
mib: "kstat.zfs.misc.arcstats.data_size",
|
mib: "kstat.zfs.misc.arcstats.data_size",
|
||||||
dataType: bsdSysctlTypeUint64,
|
dataType: bsdSysctlTypeUint64,
|
||||||
valueType: prometheus.GaugeValue,
|
valueType: prometheus.GaugeValue,
|
||||||
|
labels: nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "arcstats_demand_data_hits_total",
|
name: "arcstats_demand_data_hits_total",
|
||||||
|
@ -122,6 +137,7 @@ func NewZfsCollector(config *NodeCollectorConfig, logger log.Logger) (Collector,
|
||||||
mib: "kstat.zfs.misc.arcstats.demand_data_hits",
|
mib: "kstat.zfs.misc.arcstats.demand_data_hits",
|
||||||
dataType: bsdSysctlTypeUint64,
|
dataType: bsdSysctlTypeUint64,
|
||||||
valueType: prometheus.CounterValue,
|
valueType: prometheus.CounterValue,
|
||||||
|
labels: nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "arcstats_demand_data_misses_total",
|
name: "arcstats_demand_data_misses_total",
|
||||||
|
@ -129,6 +145,7 @@ func NewZfsCollector(config *NodeCollectorConfig, logger log.Logger) (Collector,
|
||||||
mib: "kstat.zfs.misc.arcstats.demand_data_misses",
|
mib: "kstat.zfs.misc.arcstats.demand_data_misses",
|
||||||
dataType: bsdSysctlTypeUint64,
|
dataType: bsdSysctlTypeUint64,
|
||||||
valueType: prometheus.CounterValue,
|
valueType: prometheus.CounterValue,
|
||||||
|
labels: nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "arcstats_demand_metadata_hits_total",
|
name: "arcstats_demand_metadata_hits_total",
|
||||||
|
@ -136,6 +153,7 @@ func NewZfsCollector(config *NodeCollectorConfig, logger log.Logger) (Collector,
|
||||||
mib: "kstat.zfs.misc.arcstats.demand_metadata_hits",
|
mib: "kstat.zfs.misc.arcstats.demand_metadata_hits",
|
||||||
dataType: bsdSysctlTypeUint64,
|
dataType: bsdSysctlTypeUint64,
|
||||||
valueType: prometheus.CounterValue,
|
valueType: prometheus.CounterValue,
|
||||||
|
labels: nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "arcstats_demand_metadata_misses_total",
|
name: "arcstats_demand_metadata_misses_total",
|
||||||
|
@ -143,6 +161,7 @@ func NewZfsCollector(config *NodeCollectorConfig, logger log.Logger) (Collector,
|
||||||
mib: "kstat.zfs.misc.arcstats.demand_metadata_misses",
|
mib: "kstat.zfs.misc.arcstats.demand_metadata_misses",
|
||||||
dataType: bsdSysctlTypeUint64,
|
dataType: bsdSysctlTypeUint64,
|
||||||
valueType: prometheus.CounterValue,
|
valueType: prometheus.CounterValue,
|
||||||
|
labels: nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "arcstats_hdr_bytes",
|
name: "arcstats_hdr_bytes",
|
||||||
|
@ -150,6 +169,7 @@ func NewZfsCollector(config *NodeCollectorConfig, logger log.Logger) (Collector,
|
||||||
mib: "kstat.zfs.misc.arcstats.hdr_size",
|
mib: "kstat.zfs.misc.arcstats.hdr_size",
|
||||||
dataType: bsdSysctlTypeUint64,
|
dataType: bsdSysctlTypeUint64,
|
||||||
valueType: prometheus.GaugeValue,
|
valueType: prometheus.GaugeValue,
|
||||||
|
labels: nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "arcstats_hits_total",
|
name: "arcstats_hits_total",
|
||||||
|
@ -157,6 +177,7 @@ func NewZfsCollector(config *NodeCollectorConfig, logger log.Logger) (Collector,
|
||||||
mib: "kstat.zfs.misc.arcstats.hits",
|
mib: "kstat.zfs.misc.arcstats.hits",
|
||||||
dataType: bsdSysctlTypeUint64,
|
dataType: bsdSysctlTypeUint64,
|
||||||
valueType: prometheus.CounterValue,
|
valueType: prometheus.CounterValue,
|
||||||
|
labels: nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "arcstats_misses_total",
|
name: "arcstats_misses_total",
|
||||||
|
@ -164,6 +185,7 @@ func NewZfsCollector(config *NodeCollectorConfig, logger log.Logger) (Collector,
|
||||||
mib: "kstat.zfs.misc.arcstats.misses",
|
mib: "kstat.zfs.misc.arcstats.misses",
|
||||||
dataType: bsdSysctlTypeUint64,
|
dataType: bsdSysctlTypeUint64,
|
||||||
valueType: prometheus.CounterValue,
|
valueType: prometheus.CounterValue,
|
||||||
|
labels: nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "arcstats_mfu_ghost_hits_total",
|
name: "arcstats_mfu_ghost_hits_total",
|
||||||
|
@ -171,6 +193,7 @@ func NewZfsCollector(config *NodeCollectorConfig, logger log.Logger) (Collector,
|
||||||
mib: "kstat.zfs.misc.arcstats.mfu_ghost_hits",
|
mib: "kstat.zfs.misc.arcstats.mfu_ghost_hits",
|
||||||
dataType: bsdSysctlTypeUint64,
|
dataType: bsdSysctlTypeUint64,
|
||||||
valueType: prometheus.CounterValue,
|
valueType: prometheus.CounterValue,
|
||||||
|
labels: nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "arcstats_mfu_ghost_size",
|
name: "arcstats_mfu_ghost_size",
|
||||||
|
@ -178,6 +201,7 @@ func NewZfsCollector(config *NodeCollectorConfig, logger log.Logger) (Collector,
|
||||||
mib: "kstat.zfs.misc.arcstats.mfu_ghost_size",
|
mib: "kstat.zfs.misc.arcstats.mfu_ghost_size",
|
||||||
dataType: bsdSysctlTypeUint64,
|
dataType: bsdSysctlTypeUint64,
|
||||||
valueType: prometheus.GaugeValue,
|
valueType: prometheus.GaugeValue,
|
||||||
|
labels: nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "arcstats_mfu_bytes",
|
name: "arcstats_mfu_bytes",
|
||||||
|
@ -185,6 +209,7 @@ func NewZfsCollector(config *NodeCollectorConfig, logger log.Logger) (Collector,
|
||||||
mib: "kstat.zfs.misc.arcstats.mfu_size",
|
mib: "kstat.zfs.misc.arcstats.mfu_size",
|
||||||
dataType: bsdSysctlTypeUint64,
|
dataType: bsdSysctlTypeUint64,
|
||||||
valueType: prometheus.GaugeValue,
|
valueType: prometheus.GaugeValue,
|
||||||
|
labels: nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "arcstats_mru_ghost_hits_total",
|
name: "arcstats_mru_ghost_hits_total",
|
||||||
|
@ -192,6 +217,7 @@ func NewZfsCollector(config *NodeCollectorConfig, logger log.Logger) (Collector,
|
||||||
mib: "kstat.zfs.misc.arcstats.mru_ghost_hits",
|
mib: "kstat.zfs.misc.arcstats.mru_ghost_hits",
|
||||||
dataType: bsdSysctlTypeUint64,
|
dataType: bsdSysctlTypeUint64,
|
||||||
valueType: prometheus.CounterValue,
|
valueType: prometheus.CounterValue,
|
||||||
|
labels: nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "arcstats_mru_ghost_bytes",
|
name: "arcstats_mru_ghost_bytes",
|
||||||
|
@ -199,6 +225,7 @@ func NewZfsCollector(config *NodeCollectorConfig, logger log.Logger) (Collector,
|
||||||
mib: "kstat.zfs.misc.arcstats.mru_ghost_size",
|
mib: "kstat.zfs.misc.arcstats.mru_ghost_size",
|
||||||
dataType: bsdSysctlTypeUint64,
|
dataType: bsdSysctlTypeUint64,
|
||||||
valueType: prometheus.GaugeValue,
|
valueType: prometheus.GaugeValue,
|
||||||
|
labels: nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "arcstats_mru_bytes",
|
name: "arcstats_mru_bytes",
|
||||||
|
@ -206,6 +233,7 @@ func NewZfsCollector(config *NodeCollectorConfig, logger log.Logger) (Collector,
|
||||||
mib: "kstat.zfs.misc.arcstats.mru_size",
|
mib: "kstat.zfs.misc.arcstats.mru_size",
|
||||||
dataType: bsdSysctlTypeUint64,
|
dataType: bsdSysctlTypeUint64,
|
||||||
valueType: prometheus.GaugeValue,
|
valueType: prometheus.GaugeValue,
|
||||||
|
labels: nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "arcstats_other_bytes",
|
name: "arcstats_other_bytes",
|
||||||
|
@ -213,13 +241,37 @@ func NewZfsCollector(config *NodeCollectorConfig, logger log.Logger) (Collector,
|
||||||
mib: "kstat.zfs.misc.arcstats.other_size",
|
mib: "kstat.zfs.misc.arcstats.other_size",
|
||||||
dataType: bsdSysctlTypeUint64,
|
dataType: bsdSysctlTypeUint64,
|
||||||
valueType: prometheus.GaugeValue,
|
valueType: prometheus.GaugeValue,
|
||||||
|
labels: nil,
|
||||||
},
|
},
|
||||||
|
// when FreeBSD 14.0+, `meta/pm/pd` install of `p`.
|
||||||
{
|
{
|
||||||
name: "arcstats_p_bytes",
|
name: "arcstats_p_bytes",
|
||||||
description: "ZFS ARC MRU target size",
|
description: "ZFS ARC MRU target size",
|
||||||
mib: "kstat.zfs.misc.arcstats.p",
|
mib: "kstat.zfs.misc.arcstats.p",
|
||||||
dataType: bsdSysctlTypeUint64,
|
dataType: bsdSysctlTypeUint64,
|
||||||
valueType: prometheus.GaugeValue,
|
valueType: prometheus.GaugeValue,
|
||||||
|
labels: nil,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "arcstats_meta_bytes",
|
||||||
|
description: "ZFS ARC metadata target frac ",
|
||||||
|
mib: "kstat.zfs.misc.arcstats.meta",
|
||||||
|
dataType: bsdSysctlTypeUint64,
|
||||||
|
valueType: prometheus.GaugeValue,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "arcstats_pd_bytes",
|
||||||
|
description: "ZFS ARC data MRU target frac",
|
||||||
|
mib: "kstat.zfs.misc.arcstats.pd",
|
||||||
|
dataType: bsdSysctlTypeUint64,
|
||||||
|
valueType: prometheus.GaugeValue,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "arcstats_pm_bytes",
|
||||||
|
description: "ZFS ARC meta MRU target frac",
|
||||||
|
mib: "kstat.zfs.misc.arcstats.pm",
|
||||||
|
dataType: bsdSysctlTypeUint64,
|
||||||
|
valueType: prometheus.GaugeValue,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "arcstats_size_bytes",
|
name: "arcstats_size_bytes",
|
||||||
|
@ -227,6 +279,7 @@ func NewZfsCollector(config *NodeCollectorConfig, logger log.Logger) (Collector,
|
||||||
mib: "kstat.zfs.misc.arcstats.size",
|
mib: "kstat.zfs.misc.arcstats.size",
|
||||||
dataType: bsdSysctlTypeUint64,
|
dataType: bsdSysctlTypeUint64,
|
||||||
valueType: prometheus.GaugeValue,
|
valueType: prometheus.GaugeValue,
|
||||||
|
labels: nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "zfetchstats_hits_total",
|
name: "zfetchstats_hits_total",
|
||||||
|
@ -234,6 +287,7 @@ func NewZfsCollector(config *NodeCollectorConfig, logger log.Logger) (Collector,
|
||||||
mib: "kstat.zfs.misc.zfetchstats.hits",
|
mib: "kstat.zfs.misc.zfetchstats.hits",
|
||||||
dataType: bsdSysctlTypeUint64,
|
dataType: bsdSysctlTypeUint64,
|
||||||
valueType: prometheus.CounterValue,
|
valueType: prometheus.CounterValue,
|
||||||
|
labels: nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "zfetchstats_misses_total",
|
name: "zfetchstats_misses_total",
|
||||||
|
@ -241,6 +295,7 @@ func NewZfsCollector(config *NodeCollectorConfig, logger log.Logger) (Collector,
|
||||||
mib: "kstat.zfs.misc.zfetchstats.misses",
|
mib: "kstat.zfs.misc.zfetchstats.misses",
|
||||||
dataType: bsdSysctlTypeUint64,
|
dataType: bsdSysctlTypeUint64,
|
||||||
valueType: prometheus.CounterValue,
|
valueType: prometheus.CounterValue,
|
||||||
|
labels: nil,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
logger: logger,
|
logger: logger,
|
||||||
|
@ -251,7 +306,9 @@ func (c *zfsCollector) Update(ch chan<- prometheus.Metric) error {
|
||||||
for _, m := range c.sysctls {
|
for _, m := range c.sysctls {
|
||||||
v, err := m.Value()
|
v, err := m.Value()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("couldn't get sysctl: %w", err)
|
// debug logging
|
||||||
|
level.Debug(c.logger).Log("name", m.name, "couldn't get sysctl:", err)
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
|
@ -264,3 +321,42 @@ func (c *zfsCollector) Update(ch chan<- prometheus.Metric) error {
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *zfsCollector) parseFreeBSDPoolObjsetStats() error {
|
||||||
|
|
||||||
|
sysCtlMetrics := []string{
|
||||||
|
"nunlinked", "nunlinks", "nread", "reads", "nwritten", "writes",
|
||||||
|
}
|
||||||
|
zfsPoolMibPrefix := "kstat.zfs.pool.dataset"
|
||||||
|
zfsDatasetsNames := []string{}
|
||||||
|
|
||||||
|
zfsDatasets, err := unix.Sysctl(zfsPoolMibPrefix)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("couldn't get sysctl: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
for dataset, _ := range zfsDatasets {
|
||||||
|
if strings.HasSuffix(dataset, ".dataset_name") {
|
||||||
|
zfsDatasetsNames = append(zfsDatasetsNames, strings.SplitAfter(dataset, ".")[3])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, zpoolDataset := range zfsDatasetsNames {
|
||||||
|
zfsDatasetLabels := map[string]string{
|
||||||
|
"dataset": zpoolDataset,
|
||||||
|
"zpool": strings.SplitAfter(zpoolDataset, "/")[0],
|
||||||
|
}
|
||||||
|
for metric := range sysCtlMetrics {
|
||||||
|
c.sysctls = append(c.sysctls, bsdSysctl{
|
||||||
|
name: fmt.SprintF("node_zfs_zpool_dataset_%s", metric),
|
||||||
|
description: fmt.SprintF("node_zfs_zpool_dataset_%s", metric),
|
||||||
|
mib: fmt.Sprintf("%s.%s.%s", zfsPoolMibPrefix, poolObj, metric),
|
||||||
|
dataType: bsdSysctlTypeUint64,
|
||||||
|
valueType: prometheus.CounterValue,
|
||||||
|
labels: zfsDatasetLabels,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue