From de13d912414609dc07142bd938106d8da1894b48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=93=D0=BE=D1=80=D0=BB=D0=BE=D0=B2=20=D0=9C=D0=B0=D0=BA?= =?UTF-8?q?=D1=81=D0=B8=D0=BC?= Date: Thu, 15 Aug 2019 00:04:32 +0300 Subject: [PATCH] systemd service --- smartctl.go | 2 +- systemd/smartctl_exporter.service | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 systemd/smartctl_exporter.service diff --git a/smartctl.go b/smartctl.go index 17a5276..9173e3f 100644 --- a/smartctl.go +++ b/smartctl.go @@ -23,7 +23,7 @@ type SMARTctl struct { device SMARTDevice } -// NewSMARTctl is NFTables constructor +// NewSMARTctl is smartctl constructor func NewSMARTctl(json gjson.Result, ch chan<- prometheus.Metric) SMARTctl { smart := SMARTctl{} smart.ch = ch diff --git a/systemd/smartctl_exporter.service b/systemd/smartctl_exporter.service new file mode 100644 index 0000000..4fbde98 --- /dev/null +++ b/systemd/smartctl_exporter.service @@ -0,0 +1,19 @@ +[Unit] +Description=smartctl exporter service +After=network-online.target + +[Service] +Type=simple +PIDFile=/run/smartctl_exporter.pid +ExecStart=/usr/bin/smartctl_exporter +User=root +Group=root +SyslogIdentifier=smartctl_exporter +Restart=on-failure +RemainAfterExit=no +RestartSec=100ms +StandardOutput=journal +StandardError=journal + +[Install] +WantedBy=multi-user.target