Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Oct 2024 17:32:45 +0000
From:      bugzilla-noreply@freebsd.org
To:        ports-bugs@FreeBSD.org
Subject:   [Bug 282015] net-mgmt/smartctl_exporter: rc script fails to pick up some devices
Message-ID:  <bug-282015-7788@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D282015

            Bug ID: 282015
           Summary: net-mgmt/smartctl_exporter: rc script fails to pick up
                    some devices
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: delphij@FreeBSD.org
          Reporter: lexi.freebsd@le-fay.org
             Flags: maintainer-feedback?(delphij@FreeBSD.org)
          Assignee: delphij@FreeBSD.org

patch to /usr/local/etc/rc.d/smartctl_exporter:

--- smartctl_exporter.old       2024-10-11 18:28:43.712179000 +0100
+++ smartctl_exporter   2024-10-11 18:28:53.758091000 +0100
@@ -28,7 +28,7 @@
 : ${smartctl_exporter_enable:=3D"NO"}
 : ${smartctl_exporter_user:=3D"root"}
 : ${smartctl_exporter_listen_address:=3D"localhost:9633"}
-: ${smartctl_exporter_devices:=3D"$(geom disk status -s | cut -f1 -d\ | se=
d -e
s,^,/dev/,g)"}
+: ${smartctl_exporter_devices:=3D"$(geom disk status -s | awk '{print $1}'=
 | sed
-e s,^,/dev/,g)"}
 : ${smartctl_exporter_log_level:=3D""}
 : ${smartctl_exporter_log_format:=3D""}

rationale:

'geom disk status -s' produces this output:

--o<--
# geom disk status -s
ada0  N/A  N/A
ada1  N/A  N/A
 cd0  N/A  N/A
 da4  N/A  N/A
 da6  N/A  N/A
 da0  N/A  N/A
 da7  N/A  N/A
 da5  N/A  N/A
 da3  N/A  N/A
 da2  N/A  N/A
 da1  N/A  N/A
--o<--

with the current script, that turns into this:

--o<--
# geom disk status -s | cut -f1 -d\=20
ada0
ada1







--o<--

in other words, it's replaced all the 'da' entries with blank lines.

with awk, this works correctly:

--o<--
# geom disk status -s | awk '{print $1}'
ada0
ada1
cd0
da4
da6
da0
da7
da5
da3
da2
da1
--o<--

tested with smartctl_exporter 0.12.0_6, FreeBSD 15.0-CURRENT #43
lf/main-n269060-ffd494371643: Tue Sep 17 05:59:59 BST 2024

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-282015-7788>