|
17 | 17 | package collector |
18 | 18 |
|
19 | 19 | import ( |
20 | | - "fmt" |
21 | 20 | "log/slog" |
22 | | - "strings" |
23 | 21 |
|
24 | 22 | "github.com/prometheus/client_golang/prometheus" |
25 | | - |
26 | | - "golang.org/x/sys/unix" |
27 | 23 | ) |
28 | 24 |
|
29 | 25 | type zfsCollector struct { |
@@ -320,42 +316,3 @@ func (c *zfsCollector) Update(ch chan<- prometheus.Metric) error { |
320 | 316 |
|
321 | 317 | return nil |
322 | 318 | } |
323 | | - |
324 | | -func (c *zfsCollector) parseFreeBSDPoolObjsetStats() error { |
325 | | - |
326 | | - sysCtlMetrics := []string{ |
327 | | - "nunlinked", "nunlinks", "nread", "reads", "nwritten", "writes", |
328 | | - } |
329 | | - zfsPoolMibPrefix := "kstat.zfs.pool.dataset" |
330 | | - zfsDatasetsNames := []string{} |
331 | | - |
332 | | - zfsDatasets, err := unix.Sysctl(zfsPoolMibPrefix) |
333 | | - if err != nil { |
334 | | - return fmt.Errorf("couldn't get sysctl: %w", err) |
335 | | - } |
336 | | - |
337 | | - for dataset, _ := range zfsDatasets { |
338 | | - if strings.HasSuffix(dataset, ".dataset_name") { |
339 | | - zfsDatasetsNames = append(zfsDatasetsNames, strings.SplitAfter(dataset, ".")[3]) |
340 | | - } |
341 | | - } |
342 | | - |
343 | | - for _, zpoolDataset := range zfsDatasetsNames { |
344 | | - zfsDatasetLabels := map[string]string{ |
345 | | - "dataset": zpoolDataset, |
346 | | - "zpool": strings.SplitAfter(zpoolDataset, "/")[0], |
347 | | - } |
348 | | - for metric := range sysCtlMetrics { |
349 | | - c.sysctls = append(c.sysctls, bsdSysctl{ |
350 | | - name: fmt.SprintF("node_zfs_zpool_dataset_%s", metric), |
351 | | - description: fmt.SprintF("node_zfs_zpool_dataset_%s", metric), |
352 | | - mib: fmt.Sprintf("%s.%s.%s", zfsPoolMibPrefix, poolObj, metric), |
353 | | - dataType: bsdSysctlTypeUint64, |
354 | | - valueType: prometheus.CounterValue, |
355 | | - labels: zfsDatasetLabels, |
356 | | - }) |
357 | | - } |
358 | | - } |
359 | | - |
360 | | - return nil |
361 | | -} |
0 commit comments