Bug 282015 - net-mgmt/smartctl_exporter: rc script fails to pick up some devices
Summary: net-mgmt/smartctl_exporter: rc script fails to pick up some devices
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Xin LI
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-10-11 17:32 UTC by Lexi Winter
Modified: 2024-10-18 07:25 UTC (History)
0 users

See Also:
delphij: maintainer-feedback+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lexi Winter freebsd_triage 2024-10-11 17:32:45 UTC
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:="NO"}
 : ${smartctl_exporter_user:="root"}
 : ${smartctl_exporter_listen_address:="localhost:9633"}
-: ${smartctl_exporter_devices:="$(geom disk status -s | cut -f1 -d\ | sed -e s,^,/dev/,g)"}
+: ${smartctl_exporter_devices:="$(geom disk status -s | awk '{print $1}' | sed -e s,^,/dev/,g)"}
 : ${smartctl_exporter_log_level:=""}
 : ${smartctl_exporter_log_format:=""}

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\ 
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
Comment 1 commit-hook freebsd_committer freebsd_triage 2024-10-18 07:18:02 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=8179e0a7720bdcfbde72fae87c549c93e2025572

commit 8179e0a7720bdcfbde72fae87c549c93e2025572
Author:     Lexi Winter <lexi.freebsd@le-fay.org>
AuthorDate: 2024-10-18 07:07:30 +0000
Commit:     Xin LI <delphij@FreeBSD.org>
CommitDate: 2024-10-18 07:17:26 +0000

    net-mgmt/smartctl_exporter: pick up more devices

    PR:             ports/282015

 net-mgmt/smartctl_exporter/Makefile                   | 2 +-
 net-mgmt/smartctl_exporter/files/smartctl_exporter.in | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Comment 2 Lexi Winter freebsd_triage 2024-10-18 07:25:50 UTC
thanks!