Our repository: https://github.com/volkszaehler/vzlogger
Actually vzlogger and sometimes the libraries are only provided by sourcecode. They have to be compiled before use. Select a working directory your user has writing permissions. For example the home directory:
cd ~
The most experience is collected from Debian and other Distributions close (Ubuntu, Raspian). The following guide is based on Debian „Bullseye“ in April of 2022. Specific instructions for older Versions can be found in the history of this site.
Please note that a full configured vzlogger requires besides gcc (4.7 or higher) and glibc, these libraries to compile successfully:
On Debian based distributions, most of these dependencies can easily be installed with: (as root, consider running „apt-get update“ first)
sudo apt-get install build-essential git cmake pkg-config subversion libcurl4-openssl-dev libgnutls28-dev libsasl2-dev uuid-dev libtool libssl-dev libgcrypt20-dev libmicrohttpd-dev libltdl-dev libjson-c-dev libleptonica-dev libmosquitto-dev libunistring-dev dh-autoreconf
Vzlogger provides a shell script for download, build and install of the modules issued only as sourcecode.
git clone https://github.com/volkszaehler/vzlogger.git cd vzlogger ./install.sh
The script supports also build of one single module. See the comments in the script for details.
At this point a daemon-service should be prepared to run vzlogger in backgroung. Details down below.
If a update is necessary follow these steps:
sudo systemctl stop vzlogger cd vzlogger git pull ./install.sh vzlogger sudo systemctl start vzlogger
The based SML Library may (before) updated by:
cd vzlogger/libs/libsml git pull cd ../.. ./install.sh libsml
In cases the script does not fit the conditions.
Debian provides a paket libsml-dev, but it's not well maintained and too old for our needs.
git clone https://github.com/volkszaehler/libsml.git cd libsml sudo make
Note that libsml does not include a 'make install' target.
You can manually install it into your system by copying the following files and directories
sudo cp sml/lib/libsml.* /usr/lib/ sudo cp -R sml/include/* /usr/include/ sudo cp sml.pc /usr/lib/pkgconfig/
Go back to your starting directory:
cd ..
git clone https://github.com/volkszaehler/vzlogger.git cd vzlogger mkdir build cd build cmake -DBUILD_TEST=off .. make sudo make install
Go back to your starting directory:
cd ../..
The vzlogger repository contains code to build a „clean“ paket for Debian.
git clone https://github.com/volkszaehler/vzlogger.git cd vzlogger apt build-dep ./ apt install devscripts debuild
OMS requires openssl and libmbus >=0.8.0 from e.g. https://github.com/rscada/libmbus.git (installation is easy:)
git clone https://github.com/rscada/libmbus.git cd libmbus sudo ./build.sh sudo make install
Go back to your starting directory:
cd ..
At this point a daemon-service should be prepared to run vzlogger in backgroung. Details down below.
If a update is necessary follow these steps:
cd vzlogger git pull cd build cmake -DBUILD_TEST=off .. make sudo systemctl stop vzlogger sudo make install sudo systemctl start vzlogger
Systemd is used to install and execute services in background (daemon).
The installscript asks you for installing the systemd unit file for you. If your computer uses systemd (since Debian-Jessie) you may answer yes.
If you want to copy and edit it by yourself you find a template under: ./etc/vzlogger.service
sudo cp ./etc/vzlogger.service /etc/systemd/system/vzlogger.service
You can start, stop or verify vzloggers status using the common systemctl command:
sudo systemctl start vzlogger systemctl status vzlogger sudo systemctl stop vzlogger
If you are satisfied and want to have vzlogger permanently startet as a service everytime your machine boots, just enable it:
sudo systemctl enable vzlogger
sudo setcap 'cap_sys_nice=eip' /usr/local/bin/vzlogger
/etc/rc.local
solves the problem.
Add a user without home-directory and generate password.
sudo useradd -M vzlogger sudo passwd vzlogger
Add the user to the follwing groups:
sudo usermod -aG gpio vzlogger sudo usermod -aG dialout vzlogger sudo usermod -aG staff vzlogger
For the logfile generate a sub-directory with adequate rights.
sudo mkdir /var/log/vzlogger sudo chgrp staff /var/log/vzlogger sudo chmod g+w /var/log/vzlogger
The new location oft logfile has to be configured accordingly. /etc/vzlogger.conf
:
"log" : "/var/log/vzlogger/vzlogger.log",
Last change is to promote the new user in systemd startscript (see chapter above).
Under [Service] add the following line:
User=vzlogger
Systemd need to be restartet to activate the change:
sudo systemctl daemon-reload
This adaption is of particular interest in combination with meter-protocol „exec“. Vzlogger doesn't have to be recompiled and the actions started by „exec“ run with lower user-privilges.
a debian package can be generated using:
cpack -G DEB
cmake -DCMAKE_TOOLCHAIN_FILE=/path/to/toolchainfile /path/to/vzlogger_sources