From 1ef992543f3f1f09159642bea3981c051f558560 Mon Sep 17 00:00:00 2001 From: Piotr <17101802+thampiotr@users.noreply.github.com> Date: Tue, 18 Feb 2025 10:18:06 +0000 Subject: [PATCH] remove unused function with issues on freeBSD --- collector/zfs_freebsd.go | 43 ---------------------------------------- 1 file changed, 43 deletions(-) diff --git a/collector/zfs_freebsd.go b/collector/zfs_freebsd.go index f98ac62a..dcf1ee7a 100644 --- a/collector/zfs_freebsd.go +++ b/collector/zfs_freebsd.go @@ -17,13 +17,9 @@ package collector import ( - "fmt" "log/slog" - "strings" "github.com/prometheus/client_golang/prometheus" - - "golang.org/x/sys/unix" ) type zfsCollector struct { @@ -320,42 +316,3 @@ func (c *zfsCollector) Update(ch chan<- prometheus.Metric) error { 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 -}