From ae695aed716e810221fd8cf8a19fcf8b79e61dea Mon Sep 17 00:00:00 2001 From: Mike Langmayr <1809691+mikelangmayr@users.noreply.github.com> Date: Thu, 17 Sep 2026 18:08:21 -0700 Subject: [PATCH] Deploy the keyword archiver: shim, config, systemd instance and a secrets file --- README.md | 2 +- config/hispec/hispec_keygrabber.yaml | 134 ++++++++++++++++++++++++ daemons/generic/keygrabber | 16 +++ pyproject.toml | 3 +- systemd/README.md | 43 +++++++- systemd/hispec-daemon@.service | 4 + systemd/install.sh | 15 +++ systemd/instances/hispec_keygrabber.env | 16 +++ 8 files changed, 229 insertions(+), 4 deletions(-) create mode 100644 config/hispec/hispec_keygrabber.yaml create mode 100755 daemons/generic/keygrabber create mode 100644 systemd/instances/hispec_keygrabber.env diff --git a/README.md b/README.md index b57869d..b207f72 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ or the [daemon inventory][inventory] to find a specific mechanism. | Path | Contents | | --- | --- | -| `daemons/` | Deployable device daemons. `generic/` are config-driven and shared across subsystems; `hsfei/`, `hscal/` are subsystem-specific. | +| `daemons/` | Deployable device daemons. `generic/` are config-driven and shared across subsystems; `hsfei/`, `hscal/` are subsystem-specific. `generic/keygrabber` is the exception that drives no hardware: it records the other daemons' keywords into InfluxDB for Grafana. | | `config/` | One YAML file per deployed daemon instance, organised by subsystem. | | `src/hispec/` | Installable package: the `HispecDaemon` base class and the `driver/` submodules. | | `systemd/` | Template unit, per-instance env files and installer. See [systemd/README.md](systemd/README.md). | diff --git a/config/hispec/hispec_keygrabber.yaml b/config/hispec/hispec_keygrabber.yaml new file mode 100644 index 0000000..a2af913 --- /dev/null +++ b/config/hispec/hispec_keygrabber.yaml @@ -0,0 +1,134 @@ +# Keyword Archiver — polls the HISPEC daemons and writes to InfluxDB for Grafana +# +# Usage: +# daemons/generic/keygrabber -c config/hispec/hispec_keygrabber.yaml +# +# Needs libby's optional extra on the host: pip install 'libby[influxdb]' +# The InfluxDB token comes from the environment, never from this file; the +# systemd instance file is where it gets set. + +peer_id: keygrabber +group_id: hispec + +sink: + type: influxdb + url: http://localhost:8086 + org: hispec + bucket: telemetry + token_env: HISPEC_INFLUX_TOKEN + +# Concurrent reads. Collections are read in parallel up to this many at once, +# but a single daemon still answers one request at a time, so raising this only +# helps spread reads across peers. +workers: 4 + +defaults: + interval_s: 30.0 + timeout_s: 2.0 + refresh_s: 300.0 + +# Each collection reads one peer. "%" takes everything readable, minus the +# defaults libby excludes (uptime, lasterror). Narrow a collection's keywords +# list once a dashboard shows which ones matter; that costs nothing to change, +# since a reload re-reads this file. +collections: + + # Motion: positions and limits move during an observation, so read faster + adc: + peer: hsfei.adc + keywords: ["%"] + interval_s: 5.0 + atcl: + peer: hsfei.atcl + keywords: ["%"] + interval_s: 5.0 + atcp: + peer: hsfei.atcp + keywords: ["%"] + interval_s: 5.0 + feipo: + peer: hsfei.feipo + keywords: ["%"] + interval_s: 5.0 + lsm: + peer: hsfei.lsm + keywords: ["%"] + interval_s: 5.0 + ms: + peer: hsfei.ms + keywords: ["%"] + interval_s: 5.0 + piaagimb: + peer: hsfei.piaagimb + keywords: ["%"] + interval_s: 5.0 + piaagimr: + peer: hsfei.piaagimr + keywords: ["%"] + interval_s: 5.0 + + piaadeploy: + peer: hsfei.piaadeploy + keywords: ["%"] + interval_s: 5.0 + yjfam: + peer: hsfei.yjfam + keywords: ["%"] + interval_s: 5.0 + hkfam: + peer: hsfei.hkfam + keywords: ["%"] + interval_s: 5.0 + + # Filter wheels and attenuators: discrete positions, changed rarely + atcfw: + peer: hsfei.atcfw + keywords: ["%"] + hkcalfwheel1: + peer: hscal.hkcalfwheel1 + keywords: ["%"] + hkcalfwheel2: + peer: hscal.hkcalfwheel2 + keywords: ["%"] + hkgcellfwheel: + peer: hscal.hkgcellfwheel + keywords: ["%"] + yjcalfwheel1: + peer: hscal.yjcalfwheel1 + keywords: ["%"] + yjcalfwheel2: + peer: hscal.yjcalfwheel2 + keywords: ["%"] + hketatten: + peer: hscal.hketatten + keywords: ["%"] + + # Thermal: slow-moving, but the long-term trend is the point + atctherm: + peer: hsfei.atctherm + keywords: ["%"] + hkettherm: + peer: hscal.hkettherm + keywords: ["%"] + yjettherm: + peer: hscal.yjettherm + keywords: ["%"] + gcellheater1: + peer: hscal.gcellheater1 + keywords: ["%"] + gcellheater2: + peer: hscal.gcellheater2 + keywords: ["%"] + + # Cryo and vacuum: slowest of all, and the trend that matters over weeks + atccryo: + peer: hsfei.atccryo + keywords: ["%"] + interval_s: 60.0 + atcpress: + peer: hsfei.atcpress + keywords: ["%"] + interval_s: 60.0 + +logging: + level: INFO diff --git a/daemons/generic/keygrabber b/daemons/generic/keygrabber new file mode 100755 index 0000000..07b8888 --- /dev/null +++ b/daemons/generic/keygrabber @@ -0,0 +1,16 @@ +#!/usr/bin/env python3 +""" +Keyword Archiver Daemon + +Polls keywords from the other HISPEC daemons and writes them to InfluxDB for +Grafana. The daemon itself lives in libby, since nothing about it is +instrument-specific; this shim exists so the systemd unit template, which runs +``daemons//