1. Starting the software
    1. JAR distribution
    2. Zip distribution
    3. Docker distribution
    4. Custom install
  2. Accessing the web UI
  3. Closing the application
  4. Optimized use
  5. System service

This section shows how to start the measurement software, depending on how the software was installed in the previous step.

The measurement program does not launch the web interface by default, but we feel that this is the most natural way to use the program, so the target state after launch is that the program can be used via the web interface. A command line switch is required to launch the web interface. Another switch is required to configure settings such as the HTTP port for the interface, if the default configuration needs to be changed.

Starting the software

Using the application is straightforward. First make sure you have already installed the application and its dependencies and configured them.

Depending on how you obtained the software, we have multiple ways of starting the application.

JAR distribution

If you downloaded the jar distribution, run:

$ java --enable-native-access=ALL-UNNAMED -jar powergoblin.jar

The --enable-native-access=ALL-UNNAMED option is a recent addition in Java 25+ and is supposed to control the access to low level devices. Obviously PowerGoblin requires such access, because it is communicating with power meters.


Zip distribution

The first command assumes that you have downloaded the zip distribution and extracted the application to a local directory powergoblin/:

$ powergoblin/bin/power 

The project repository also contains the XDG .desktop file for setting up a quick launch icon for the application on Linux and other compatible systems. Simply extract the zip to /usr/local/powergoblin, copy the jpg file there as well, then copy the .desktop file to ~/.local/share/applications/ and restart your desktop session.


Docker distribution

If you downloaded the Docker distribution, run:

$ docker run --privileged registry.gitlab.utu.fi/tech/soft/tools/power/powergoblin:latest

The --privileged flag is used here to share the devices connected to the host to the containers. Otherwise, the meter device files will not be visible inside the container. However, there are other options for sharing the device files as well, if this sounds too risky.

You may also want to set --network=host in case internet connection is needed inside the container (e.g. updates) and DNS does not work properly.


Custom install

If you wanted to build the application yourself, after running mvn clean package jlink:jlink, simply type:

$ target/maven-jlink/classifiers/app/bin/power

Accessing the web UI

After launching the application, it should print some debug data such as

Web [Simple HTTP] listening at [ http://172.17.0.1:8080 ]
Web [Simple HTTP] listening at [ http://192.168.0.100:8080 ]

Interactive mode. You can close the application by pressing enter / ctrl-c or via mqtt/http

The application will listen to localhost and http://192.168.0.100:8080. Assuming you are not using Docker, you can access the web UI by accessing http://localhost:8080 with a browser.

For Docker users, depending on your Docker settings the container might have a distinct IP address (localhost or 127.0.0.1 will not work). You can access the web UI, but you will need to locate the container's IP first. You can use the following commands to locate the container:

$ docker container ls
CONTAINER ID IMAGE        COMMAND                CREATED       STATUS       PORTS     NAMES
3c002596c0cc 22367e0d24d7 "/power/bin/power -d…" 1 seconds ago Up 1 seconds           vibrant_liskov

$ docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' 3c002596c0cc
172.17.0.4

We can deduce that the address of the web UI is now http://172.17.0.4:8080.

In order to send trigger messages from the SUT, the container's IP needs to be accessible from the SUT's network as well. You'll need to configure a bridge or some other network configuration so that the SUT can access the container. Configuring bridges is out of the scope of this tutorial.


Closing the application

The easiest way to close the application is to use the web interface. There is a Shutdown button in the Config section (see the instructions on sections).

If you started a native instance (non-Docker) of the application, it can be closed by pressing ctrl-c in the terminal for interactive sessions. For non-interactive sessions, use the kill or killall command or a task manager to close the application process:

$ killall java -9
$ killall java -15

Docker users should kill the container with docker container kill.


Optimized use

You can enable Java's AOT and compact object features to make the tool more efficient:

  • AOT features speed up launch
    • will probably improve even further in the future as the current versions of Java do not cache everything yet
    • Java 26+ will support AOT with other GC types as well
  • Compact object headers will shrink object size to save memory

First, start the application once using the following options:

$ java -XX:AOTCacheOutput=app.aot --enable-native-access=ALL-UNNAMED -XX:+UseCompactObjectHeaders -jar powergoblin.jar

Later, start the application like this:

$ java -XX:AOTCache=app.aot --enable-native-access=ALL-UNNAMED -XX:+UseCompactObjectHeaders -jar powergoblin.jar

System service

PowerGoblin can also be started as a background system service. This can be a particularly good solution if, for example, a Raspberry Pi computer is used to manage measurements. When PowerGoblin starts automatically, it can be managed via the web UI without the need to connect a display or input devices to the Raspberry Pi computer. This makes deployment easier in some situations.

Previously, PowerGoblin was very experimental and probably required reboots in case of problems. It did not make sense to run the program as a service. We are now confident that PowerGoblin can run as a background service for multiple measurements. Of course, it should be noted that to ensure maximum reliability, it is advisable to verify the success of the measurement.

PowerGoblin comes with a systemd service description that allows you to start the service in the background when the machine boots up. Please note that you need a user called powergoblin for the service, which must be given the correct permissions (see #1 and #2). In addition, the

The following commands set up the user and the service binary on a system which already has a working OpenJDK 25+ installation:

$ useradd -G uucp -m powergoblin
$ mkdir -p /opt/powergoblin
$ wget https://tech.utugit.fi/soft/tools/power/powergoblin/powergoblin.jar -O  /opt/powergoblin/powergoblin.jar
$ chown -R powergoblin /opt/powergoblin

You can now enable the service file as follows:

$ sudo cp powergoblin.service /etc/systemd/system/powergoblin.service
$ sudo systemctl daemon-reload
$ sudo systemctl enable --now powergoblin 

You can check the functionality of the service by visiting http://localhost:8080 (or whatever address you set for the service).

Please note that the service is not safe to run in a public network. We have not implemented any kind of security mechanisms.