aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2021-03-15 21:28:26 +0100
committerChristian Weiske <cweiske@cweiske.de>2021-03-15 21:28:26 +0100
commit76589ea07926b0101cae599736d13e4c507c8f97 (patch)
treedb7de3e86e0a13ff26694e93beedc91298b6ed29
parent023737be6524df79d22ab7f8df5a94fd7f38764e (diff)
downloadusb-wde1-tools-76589ea07926b0101cae599736d13e4c507c8f97.tar.gz
usb-wde1-tools-76589ea07926b0101cae599736d13e4c507c8f97.zip
Store logged data in spool directory
So that we do not get problems with systemd PrivateTmp setting
-rw-r--r--README.rst4
-rwxr-xr-xmunin/usb-wde1-log-last.sh8
-rwxr-xr-xmunin/usb-wde1_2
3 files changed, 9 insertions, 5 deletions
diff --git a/README.rst b/README.rst
index f118e91..13e7b03 100644
--- a/README.rst
+++ b/README.rst
@@ -28,7 +28,7 @@ Setup
$ cd munin && nohup ./usb-wde1-log-last.sh &
- once. It backgrounds the logging process and logs into ``/tmp/usb-wde1-last``.
+ once. It backgrounds the logging process and logs into ``/var/spool/usb-wde1/usb-wde1-last``.
This process needs to be started whenever the machine is rebooted.
You can run ``make`` to install the init script.
@@ -43,7 +43,7 @@ Setup
Edit /etc/munin/plugin-conf.d/munin-node and add the following lines::
[usb-wde1_*]
- env.logfile /tmp/usb-wde1-last
+ env.logfile /var/spool/usb-wde1/usb-wde1-last
env.host_name House
env.sensors 0 1 7
env.sensor0 Living room
diff --git a/munin/usb-wde1-log-last.sh b/munin/usb-wde1-log-last.sh
index 0b702de..620dd0c 100755
--- a/munin/usb-wde1-log-last.sh
+++ b/munin/usb-wde1-log-last.sh
@@ -13,10 +13,14 @@
device=/dev/ttyUSB0
+if [ ! -d /var/spool/usb-wde1 ]; then
+ mkdir /var/spool/usb-wde1
+fi
+
curdir="$(dirname "$0")"
if [ "$1" = "--dummy-data" ]; then
$curdir/../dummy-data-generator.php\
- | $curdir/log-single-line.sh /tmp/usb-wde1-last
+ | $curdir/log-single-line.sh /var/spool/usb-wde1/usb-wde1-last
else
if [ ! -r $device ]; then
echo "Device $device is not readable"
@@ -27,5 +31,5 @@ else
# WRONG VAL, WRONG CMD and FullBuff->Reset
# errors
socat $device,b9600,min=1,time=1,brkint=0,icrnl=0,ixoff=1,imaxbel=0,opost=0,isig=0,icanon=0,iexten=0,echo=0,echoe=0,echok=0 STDOUT\
- | $curdir/log-single-line.sh /tmp/usb-wde1-last
+ | $curdir/log-single-line.sh /var/spool/usb-wde1/usb-wde1-last
fi
diff --git a/munin/usb-wde1_ b/munin/usb-wde1_
index 6bae030..3c75c72 100755
--- a/munin/usb-wde1_
+++ b/munin/usb-wde1_
@@ -15,7 +15,7 @@ usb-wde1 - Munin plugin to report usb-wde1 temperature and humidity data
=head2 EXAMPLE CONFIGURATION
[usb-wde1_*]
- env.logfile /tmp/usb-wde1-last
+ env.logfile /var/spool/usb-wde1/usb-wde1-last
env.host_name House
env.sensors 0 1 7
env.sensor0 Living room