From d01097f26fb94d6a4d7301df7f53bf4d027e25d0 Mon Sep 17 00:00:00 2001 From: silence_eternal Date: Mon, 21 Mar 2022 15:17:32 -0700 Subject: [PATCH] Added doc for systemd service config Also updated typo/wording for confirming pwrstat service status. --- README.md | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4def04c..69c9c9f 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Cyberpower UPS Linux daemon (pwrstat) exporter for prometheus ## Installation Must have Linux PowerPanel application from CyberPower already downloaded (https://www.cyberpowersystems.com/product/software/powerpanel-for-linux/) -And make sure the ``pwrstat.service`` has been staring. +And make sure the ``pwrstat.service`` has been started: `service pwrstat status` ### Build from source **Please install golang 1.16** @@ -25,6 +25,30 @@ Args sudo pwrstat-exporter --web.listen-address 8088 --web.telemetry-path /metrics ``` +## Systemd service +Create the service config +`nano /etc/systemd/system/pwrstat-exporter.service` + +``` +[Unit] +Description=pwrstat-exporter + +[Service] +TimeoutStartSec=0 +ExecStart=/usr/local/bin/pwrstat-exporter + +[Install] +WantedBy=multi-user.target +``` +Restart the systemd daemon, set the service to start on boot, and start the service manually for the first time. + +`systemctl daemon-reload` + +`systemctl enable pwrstat-exporter` + +`service pwrstat-exporter start` + ## Dashboard You can import the dashboard using ``grafana-dashboard.json`` ![grafana](/image/grafana.png) +