AvrelDocs

Running a collector

How to look after a collector once it is installed. To install one, see Connect a site.

The collector keeps reading the controller and queues readings on the gateway, up to 20,000 readings or 32 MB (change it with --queue-mb). At one reading a minute that is about two weeks. If the queue fills, the oldest readings are dropped first. When the link returns, the queue uploads in the order the readings were taken, 500 at a time, and Avrel fills in the gap. New readings wait behind the queue, so they never arrive out of order. Each reading carries an ID, so a reading sent twice after a dropped connection is stored once.

Avrel uses the readings from the gap to work out that the collector kept working and only the link was down. See Alerts and collector health.

Readings the server refuses, for example because the key was revoked, are not queued. The reason is written to the log instead.

After a power cut or reboot#

The service starts by itself on boot. Nothing needs doing. Avrel shows COLLECTOR SILENT while the gateway is down and LIVE again within a minute or two of it coming back.

The first reading after a start says why the collector started: a first start, a restart of the collector program, or a reboot of the computer. For a reboot it also says whether the computer shut down cleanly and, where the hardware reports it, whether a hardware watchdog caused it. Avrel lists each restart under the collector's Health panel and alerts your channels.

If the collector hangs#

The service has a watchdog: the collector checks in with systemd every few seconds, and if it stops for 2 minutes systemd restarts it. This restarts only the collector program. It never touches the controller or any equipment.

If the gateway hangs#

If the whole computer freezes, the service watchdog cannot help, because systemd is frozen too. Most single-board computers and industrial PCs have a hardware watchdog for this. Install with --host-watchdog to arm it: systemd then feeds the watchdog, and if the computer hangs for 30 seconds the hardware reboots it. After the reboot, the collector reports that the watchdog caused it.

This reboots the whole computer, including anything else it runs. If the gateway also runs your controller, agree it with whoever owns the controller first. To turn it off again, delete /etc/systemd/system.conf.d/avrel-host-watchdog.conf and run sudo systemctl daemon-reexec, or uninstall the collector.

Updating the collector#

The collector does not update itself. To update it, run the same install command again. The installer downloads the current version, checks it against the server's checksum, keeps the queue, and restarts the service.

Replacing a key#

Do this every year, when someone with access leaves, or if a key may have been seen.

  1. In Edge > Collectors, choose Add collector and create a new key.
  2. On the gateway, run the install command again and paste the new key.
  3. When the new collector shows REPORTING, choose Revoke on the old one and confirm.

Removing the collector#

  1. On the gateway, run sudo bash install.sh --uninstall. This stops the service and removes the program, settings, key and queue. If install.sh is gone, download it again with the first line of the install command.
  2. In Edge > Collectors, choose Revoke on that collector and confirm.

Revoking alone is enough to stop a gateway you cannot reach. Avrel refuses its readings from that moment.

Troubleshooting#

Installer messages#

MessageCause and fix
run this with sudoRun the command with sudo.
this machine does not use systemdThe gateway needs a Linux system that uses systemd, such as Raspberry Pi OS, Debian or Ubuntu.
python3 3.9 or newer is requiredUpdate Python, or use a newer OS image.
cannot reach … from this machineThe gateway cannot reach the Avrel server. Check the address, DNS and any outbound firewall or proxy.
the server did not accept this keyThe key was mistyped, revoked, or belongs to another server. Create a new key.
this key belongs to organization …The --org value does not match the key. Copy the install command from Avrel again.
downloaded collector does not match the server's checksumThe download was changed or cut short on the way. Try again. If it repeats, stop and contact Avrel.
no terminal to ask for the keyYou ran the installer from a script. Pass --key-file.
Warning: … is not answering right nowThe installer could not read the controller. It still installs. Fix the controller or --source-url, and Avrel goes LIVE by itself.
The service did not startRead the log lines it prints. journalctl -u avrel-collector -n 50 shows more.

In Avrel#

What you seeWhat to check
Collector stays NOT CONNECTED YETOn the gateway, systemctl status avrel-collector should say active (running). If it does, check the log for refused or failed uploads.
System shows CONTROLLER OFFLINEOn the gateway, run curl <source-url>/api/system/status. If that fails, the controller's dashboard is down or --source-url is wrong.
System is LIVE but readings say No dataThe controller answered but had no readings from the last 15 minutes. Check the sensors on the controller.
System shows COLLECTOR SILENTThe gateway is off, has lost power, or has lost its network. Readings queued in the meantime upload when it returns. Open the collector's Health panel for its last readings and a likely cause.
Collector shows STOPPED REPORTINGNothing has arrived for longer than its alert delay, and your alert channels were told. See Alerts and collector health.
Collector shows REVOKED but the system still appearsExpected. Avrel keeps showing the last readings it received. Remove the collector from the gateway as well.