Running components

The only supported mechanism for running the Monitoring components is via systemd. Running processes manually is supported for debugging purposes only. systemd is the simplest way to start, stop and monitor the Monitoring components.

IDs for components

systemctl provides start, stop and status commands for all services on the current server. The default instance of each component is called default. Therefore, to start, stop or check the status of this instance:

# Start
systemctl start kx-refinery-monitoring-daemon@default

# Stop
systemctl stop kx-refinery-monitoring-daemon@default

# Status
systemctl status kx-refinery-monitoring-daemon@default

Once the components are installed, you can ensure that they are automatically started on a system boot with the enable argument to systemd:

systemctl enable kx-refinery-monitoring-daemon@default

All API and Generator components have the daemon as a required dependent service (using BindTo=). Therefore, starting any API or Generator service will start the daemon automatically and fail to start if the daemon fails to start.

Viewing log files

When running in systemd, all log information gets captured by journald. To access this data, use journalctl:

journalctl --identifier=kx-refinery-monitoring-daemon

To follow the logs (similar to tail -f), simply append -f to the journalctl call:

journalctl --identifier=kx-refinery-monitoring-daemon -f

Additional flags to run with journalctl can be found in the man pages.

Due to a known issue with systemd, always use --identifier instead of -u.

Running multiple instances

To run multiple instances of each Monitoring component (where multiple Refinery installations run on the same server), see Running Multiple Instances.

systemd and Docker

By default, systemd is not supported within Docker images but can be enabled with a custom Docker file and modified run command.

Docker configuration for systemd support

Red Hat's podman is better suited to running containers with systemd support.

How to run systemd in a container

Manually

If you are unable to use systemd, you can use the underlying scripts to perform start and stop.

This method of running the Monitoring daemon is not recommended and not supported by KX.

Define the following environment variables before running the scripts.

KX_REF_MON_HOME   installation folder of the component
KX_REF_MON_DATA   data folder of the component
KX_REF_MON_PORT   port for the kdb process to bind to

The default values for these variables can be found in the systemd service script.

Start

/opt/kx-refinery-monitoring-daemon/current/bin/start-kx-refinery-monitoring-daemon.sh \
  --background --instance=default
/opt/kx-refinery-monitoring-api-web/current/bin/start-kx-refinery-monitoring-api-web.sh \
  --background --instance=default

Stop

/opt/kx-refinery-monitoring-api-web/current/bin/stop-kx-refinery-monitoring-api-web.sh \
  --instance=default
/opt/kx-refinery-monitoring-daemon/current/bin/stop-kx-refinery-monitoring-daemon.sh \
  --instance=default

When running in this mode, there is no built-in mechanism to check the process status. Therefor, a manual check is required.