summaryrefslogtreecommitdiff
path: root/app-metrics/smartctl_exporter/files
diff options
context:
space:
mode:
Diffstat (limited to 'app-metrics/smartctl_exporter/files')
-rw-r--r--app-metrics/smartctl_exporter/files/smartctl_exporter.confd2
-rw-r--r--app-metrics/smartctl_exporter/files/smartctl_exporter.initd23
-rw-r--r--app-metrics/smartctl_exporter/files/smartctl_exporter.service22
3 files changed, 47 insertions, 0 deletions
diff --git a/app-metrics/smartctl_exporter/files/smartctl_exporter.confd b/app-metrics/smartctl_exporter/files/smartctl_exporter.confd
new file mode 100644
index 0000000..5a8a1d6
--- /dev/null
+++ b/app-metrics/smartctl_exporter/files/smartctl_exporter.confd
@@ -0,0 +1,2 @@
+# arguments for smartctl exporter
+command_args=""
diff --git a/app-metrics/smartctl_exporter/files/smartctl_exporter.initd b/app-metrics/smartctl_exporter/files/smartctl_exporter.initd
new file mode 100644
index 0000000..b9e18a6
--- /dev/null
+++ b/app-metrics/smartctl_exporter/files/smartctl_exporter.initd
@@ -0,0 +1,23 @@
+#!/sbin/openrc-run
+# Copyright 2016-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+description="smartctl metrics exporter"
+pidfile=${pidfile:-"/run/${RC_SVCNAME}.pid"}
+user=root
+group=root
+
+command="/usr/bin/smartctl_exporter"
+command_args="${command_args}"
+command_background="true"
+command_user="${user}:${group}"
+output_log="/var/log/smartctl_exporter/${RC_SVCNAME}.log"
+error_log="/var/log/smartctl_exporter/${RC_SVCNAME}.log"
+
+depend() {
+ after net
+}
+
+start_pre() {
+ checkpath -q -d -m 0755 -o ${user}:${group} /var/log/smartctl_exporter
+}
diff --git a/app-metrics/smartctl_exporter/files/smartctl_exporter.service b/app-metrics/smartctl_exporter/files/smartctl_exporter.service
new file mode 100644
index 0000000..c21aa5a
--- /dev/null
+++ b/app-metrics/smartctl_exporter/files/smartctl_exporter.service
@@ -0,0 +1,22 @@
+[Unit]
+Description=smartctl exporter
+Documentation=https://github.com/prometheus-community/smartctl_exporter
+After=network-online.target
+
+[Service]
+# Security improvements required in future, but needs care; ideally
+# smartctl_exporter runs minimal privilege, but can invoke smartctl via sudo to
+# touch disks.
+# https://github.com/prometheus-community/smartctl_exporter/issues/146
+User=root
+Group=root
+Restart=on-failure
+Type=exec
+# TODO: find a good way to add args here
+ExecStart=/usr/sbin/smartctl_exporter
+ExecReload=/usr/bin/kill -HUP $MAINPID
+TimeoutStopSec=20s
+SendSIGKILL=no
+
+[Install]
+WantedBy=multi-user.target