Qbee graphic with faded configuration code and the title Self-Healing by Design: Why qbee-agent Never Stops Checking

Most people picture device management as a push. You write a config file, click "deploy", the file lands on 500 devices, and the job is marked done.

Deploying is exactly what you want to do: roll out a new broker config, a new application version or a security fix, and know it reached the whole fleet. The question is what happens after the rollout. Once that file is on disk, anything can happen to it. A technician on site edits it to debug a problem and forgets to change it back. A package upgrade overwrites it with the vendor default. A script truncates it. An SD card corrupts a block. A device that was offline during the rollout comes back six weeks later with the old version. None of this shows up in your dashboard, because the tool already reported success.

This is configuration drift, and in large fleets of embedded and edge devices it's the normal state of things. qbee-agent is built around one idea that fixes it: the agent always tries to converge to the configured state, and it checks again and again.

Pull, don't push

qbee-agent doesn't wait for the server to tell it what to do. It runs a control loop on the device. At a fixed, configurable interval (every five minutes by default) the agent:

  1. Pulls its committed configuration from the qbee device hub.
  2. Checks the actual state of the system against that configuration.
  3. Changes only what differs.
  4. Reports what it did.

Then it waits and does it all again.

This changes what a deployment is. With qbee you don't push files at devices. You deploy configuration: a description of the state your devices should be in. That might be a config file with specific content, a package installed at a given version, or a container running from a particular image. Committing that configuration is your deployment, and it's as deliberate and controlled as any release. Each agent then brings its device into that state, fetching whatever it needs along the way. On every run after that, it checks that the device is still in that state and corrects it if not. Your deployment doesn't end when the last device acknowledges it. It stays in force until you deploy something else.

There's a useful side effect. If the device can't reach the hub, the agent falls back to its locally cached copy of the last known configuration and keeps enforcing it. A device in a basement with patchy LTE heals itself just as reliably as one on a fiber link.

A concrete example: a templated config file

Here's a file distribution setup with a template. Say every gateway in your fleet runs an MQTT broker, and you keep a single template for its config:

# mosquitto.conf (template)
listener {{port}}
allow_anonymous false
log_dest syslog
connection_messages true
clientid_prefixes {{site_prefix}}

In qbee you set this file to be placed at /etc/mosquitto/mosquitto.conf with the template option turned on. You also give it parameters: port = 8883 and site_prefix = $(sys.host)-, so each device fills in its own hostname. Last, you set the command to run: systemctl restart mosquitto.

On every run, the agent:

  • Makes sure it has the right template, checking its SHA-256 digest against the one the hub expects.
  • Works out what the rendered file should look like on this device, as a digest of the template with this device's parameters filled in.
  • Hashes the file actually sitting at /etc/mosquitto/mosquitto.conf.
  • If the hashes match, it does nothing. No rewrite, no restart, no noise.
  • If they don't match, or the file is missing, it renders the template again, writes the file and runs the command so the service picks up the correct config.

Now suppose someone SSHs into a gateway at 2 a.m. and sets allow_anonymous true to test something quickly. With a push tool, that change stays until someone notices, probably during a security audit, or worse, after an incident. With qbee-agent, the next run (at most a few minutes later) sees the digest mismatch. It renders the file again, restarts the broker and logs a report that the file was changed. The device has healed itself, and you have a record that it happened.

The same applies when you change the configuration on purpose. Update the template or a parameter in qbee, and every device converges to the new state on its next check-in, including the ones that are offline right now, whenever they come back.

Idempotent by default

Constant checking only works if checking is cheap and safe. qbee-agent's configuration handlers are idempotent: running them a thousand times against a correct system changes nothing. Files are compared by content digest, not by timestamp. Downloads are staged and verified before they're moved into place, so a half-finished transfer never replaces a good file. The command to run fires only when a file is actually rewritten, so services aren't restarted every five minutes for no reason.

That's what lets the agent enforce state all the time without getting in the way. On a healthy device a run costs a few hashes and changes nothing.

Not just files

File distribution is the easiest case to picture, but the same convergence loop runs through everything the agent manages: packages, users and SSH keys, firewall rules, Docker and Podman containers, Compose projects, process watch and more. Each one describes a desired state, and on every run the agent compares it with reality and fixes the difference.

Deploy once, stay deployed

None of this means giving up deployments. You still decide when a new configuration goes out, which devices get it, and what it contains. The difference is what happens next. A device that was correct on deploy day tells you nothing about whether it's correct today. Hardware fails, people change things and software overwrites files. Over months and years in the field, every device drifts.

A push-based, fire-and-forget tool records what you sent. A pull-based, continuously checking agent makes sure your fleet keeps matching what you deployed, and keeps fixing it when it doesn't. When you're running thousands of devices you can't physically reach, that's what lets you know your deployment held, instead of hoping it did.

Deploy your configuration once. qbee-agent will keep it deployed.

Self-Healing by Design: Why qbee-agent Never Stops Checking

Simplify device management,
accelerate innovation.

Manage your devices with Qbee
Keep your devices always up-to-date with minimal effort.
Deploy updates to thousands of devices in minutes
Remote Access VPN
Compatible with all major Linux-based systems
Try Qbee for free >

Frequently asked questions