Skip to content

Run the Glances Service

This tutorial walks through running the Glances microservice end to end: a dockerized Glances server as the data source, a running ToloMEO Edge agent, and tlm_glances bridging the two.

What you will do

Run the Glances service against a dockerized Glances server and a running ToloMEO Edge agent, and watch CPU metrics arrive on events.data.

Prerequisites

  • Python ≥ 3.11
  • uv installed
  • Docker
  • A working instance of the ToloMEO Edge agent
  • tlm-services installed: uv sync

1. Start a Glances server

The service polls a running Glances instance over HTTP; it does not start one for you. Run the official Glances image with its web/API server exposed on port 61208:

docker run --rm -p 61208:61208 -e GLANCES_OPT="-w" nicolargo/glances:latest

Note

See the Glances documentation for setting up and configuring the server itself. By default the service reaches the API at http://localhost:61208; set hostname/port under [plugins.glances_stats] to point at a server elsewhere.

2. Configure the service

Create tlm_glances.toml:

[nats]
url = "nats://127.0.0.1:4222"

[plugins.glances_stats]
interval_s = 5.0
api_version = 4

3. Run the service

TOLOMEO_CONFIG=./tlm_glances.toml DEVICE_SERIAL_NUMBER=test001 tlm_glances

4. Observe the output

In another terminal, subscribe to the agent's NATS subject to see the metrics arrive:

nats sub "events.data"

Every interval_s seconds you should see a SenML record with CPU fields namespaced under glances_stats:cpu::

[{"bn": "urn:cpt:device:sn:test001:", "n": "glances_stats:cpu:total", "v": 12.4, "t": 1700000010.0}]

Next Steps