daily compression of InfluxDB

InfluxDB is an open source time series database built by InfluxData and used in e.g. Openhab for data persistance.
For small computers like raspi’s it is a best practice to compress the database regurlarly.

Why not using cron ?

Well, it works.. the only (security)-drawback is to grant /bin/bash to the influx-user:

cat /etc/cron.daily/00influx:

#!/bin/bash
#execute
/home/pi/1_influxrepair.sh


cat /home/pi/1_influxrepair.sh:

#!/bin/bash
service influxdb stop
echo "before su"
su influxdb -c /home/pi/1_subscript.sh
echo "after su"
whoami
service influxdb start

cat /home/pi/1_subscript.sh:

#!/bin/bash
echo "now in sub shell"
whoami
cd /var/lib/influxdb
influx_inspect buildtsi -compact-series-file -datadir ./data -waldir ./wal
exit
echo "exiting sub shell"

cat /etc/passwd|grep infl:

modify influxdb:/bin/bash

done!

ntopng , fritzbox (fritzdump.sh) and geolocation

The latest browsers have removed the Geolocation API from unsecured Origins. If you still want to use Geo-API tools with fritzdump.sh ntopng needs to run secure, based on ssl (TLS).

ntopng has written a nice howto to use let’s encrypt-based certs.

But what needs to be adjusted on the firtzdump.sh script ?

if you want to run only ntopng with TLS on port 3001 and disable http the original line:

wget --no-check-certificate -qO- $FRITZIP/cgi-bin/capture_notimeout?ifaceorminor=$IFACE\&snaplen=\&capture=Start\&sid=$SID | ntopng -i -

should be adjusted to:

wget --no-check-certificate -qO- $FRITZIP/cgi-bin/capture_notimeout?ifaceorminor=$IFACE\&snaplen=\&capture=Start\&sid=$SID | ntopng --https-port=3001 --http-port=0 -i -

Done 🙂

How do I debug Tradfri on Openhab ?

open the openhab-cli:

root@rpi6:/home/pi# openhab-cli console

Logging in as openhab

                          __  _____    ____
  ____  ____  ___  ____  / / / /   |  / __ )
 / __ \/ __ \/ _ \/ __ \/ /_/ / /| | / __  |
/ /_/ / /_/ /  __/ / / / __  / ___ |/ /_/ /
\____/ .___/\___/_/ /_/_/ /_/_/  |_/_____/
    /_/                        2.5.0.M4
                               Milestone Build

Hit '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
Hit '<ctrl-d>' or type 'system:shutdown' or 'logout' to shutdown openHAB.

Find the packacke-namespace of the tradfri bundle:

openhab> bundle:list -s|grep trad
226 │ Active │  80 │ 2.5.0.M4              │ org.openhab.binding.tradfri

get the current debug-level:

openhab> log:get org.openhab.binding.tradfri
INFO

change the debug-level if needed:

openhab> log:set ERROR org.openhab.binding.tradfri
openhab> log:set DEBUG org.openhab.binding.tradfri
openhab> log:set INFO org.openhab.binding.tradfri