mirror of
https://github.com/prometheus/node_exporter.git
synced 2025-01-19 17:50:49 -08:00
fix(zfs) zfs arcstats.p
on FreeBSD 14.0+ (#2754)
* dongjiang, fix zfs arcstats.p Signed-off-by: dongjiang1989 <dongjiang1989@126.com> * dongjiang, fix gofmt -s Signed-off-by: dongjiang1989 <dongjiang1989@126.com> * change warn log to debug log by code review Signed-off-by: dongjiang1989 <dongjiang1989@126.com> --------- Signed-off-by: dongjiang1989 <dongjiang1989@126.com>
This commit is contained in:
parent
446b3e64ff
commit
e8c5110ada
|
@ -20,6 +20,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"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"
|
"golang.org/x/sys/unix"
|
||||||
|
@ -241,6 +242,7 @@ func NewZfsCollector(logger log.Logger) (Collector, error) {
|
||||||
valueType: prometheus.GaugeValue,
|
valueType: prometheus.GaugeValue,
|
||||||
labels: nil,
|
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",
|
||||||
|
@ -249,6 +251,27 @@ func NewZfsCollector(logger log.Logger) (Collector, error) {
|
||||||
valueType: prometheus.GaugeValue,
|
valueType: prometheus.GaugeValue,
|
||||||
labels: nil,
|
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",
|
||||||
description: "ZFS ARC size",
|
description: "ZFS ARC size",
|
||||||
|
@ -282,7 +305,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(
|
||||||
|
|
Loading…
Reference in a new issue