hitron/docs

Grafana: dashboards, alerts, and logs

Two dashboards are generated by src/hitron/grafana.py and committed as JSON so they can be imported without running anything. This page explains what each panel reads, how to provision them, how to write alerts that will not page you at 3 a.m. for a normal channel flap, and how to add the log stream.


1. Files#

File What it is
dashboards/hitron-coda6x.json CODA6X gateway dashboard (uid hitron-coda6x)
dashboards/hitron-ht-em5.json HT-EM5 MoCA dashboard (uid hitron-ht-em5)
deploy/grafana/provisioning/datasources/hitron-prometheus.yml Prometheus + Loki datasources
deploy/grafana/provisioning/dashboards/hitron.yml file provider pointing at /var/lib/grafana/dashboards
deploy/grafana/prometheus/rules/hitron.rules.yml eight alert rules
deploy/grafana/dashboards/ the same JSON, mounted into the container

Regenerate after changing a panel:

hitron grafana --dir deploy/grafana
# or, to refresh only the importable copies:
python -c "from hitron.grafana import write_bundle; write_bundle('deploy/grafana')"

The generator writes both deploy/grafana/dashboards/*.json and the provisioning YAML. Copy the dashboards to dashboards/ if you want the GitHub-download links to stay current (they are committed already).


2. Provision with Docker Compose#

cd deploy
cp .env.example .env
# edit CODA60_HOST, CODA57_HOST, HT_EM5_HOST
docker compose up -d

Services:

Service Port Purpose
exporter 9877 polls devices, serves /metrics
prometheus 9090 scrapes the exporter, evaluates rules
grafana 3000 dashboards, admin/admin on first boot
loki 3100 optional log store
promtail — ships exporter container logs to Loki

First boot takes ~20 seconds. Open http://localhost:3000, sign in, and the Hitron folder already contains both dashboards.

If the exporter container cannot reach the gateway, check that the device is routed from the Docker network. network_mode: host on Linux, or the LAN IP instead of 127.0.0.1, usually fixes it.


3. Import without Docker#

  1. Add a Prometheus datasource. Note its UID; the dashboards use a ${DS} variable so any UID works.
  2. Dashboards → New → Import → Upload JSON.
  3. Pick the datasource when asked, then set the source variable to the label you gave the exporter (--coda60 edge=192.168.100.1 → edge).

The dashboards are editable ("editable": true), so save-as before you tune.


4. Dashboard tour — CODA6X#

Overview row#

Panel Query Reading it
Uptime modem_system_uptime_seconds Drops mean a reboot. Correlate with the DOCSIS log.
Provisioning min(modem_docsis_provisioning_step_success) 1 only when every step (HW init, downstream, ranging, DHCP, ToD, config, registration) succeeded.
DS/US channels count(modem_downstream_channel_info) A missing channel is often the first sign of a plant problem.
Wi-Fi clients sum(modem_wifi_client_count) Per-band counts are on the series; this is the total.
Power in spec min(modem_power_in_spec) Only emitted by the CODA-57 source, where the carrier envelope is configured.

Downstream RF row#

  • Power per channel — modem_downstream_channel_power_dbmv, one line per channel_id. Healthy DOCSIS 3.1 plants usually sit near 0 dBmV; the rule fires outside −6…15.
  • SNR per channel — modem_downstream_channel_snr_db. Below ~33 dB on 256-QAM is where correctable errors start climbing.
  • Corrected / uncorrectable codewords per second — rate(...[5m]). A flat zero is normal. A rising uncorrectable rate with flat SNR usually means ingress, not level.

Upstream RF row#

modem_upstream_channel_power_dbmv and modem_upstream_channel_bandwidth_hz. Upstream power creeping up over weeks is the classic sign of a degrading drop or splitter; alert on the band, not on a single sample.

OFDM / OFDMA row#

  • modem_downstream_ofdm_channel_plc_power_dbmv — PLC power.
  • modem_downstream_ofdm_channel_snr_db — OFDM SNR (often a clean integer).
  • modem_upstream_ofdm_channel_power_1_6_dbmv — the DOCSIS 3.0-equivalent reported power, which is the number to compare with SC-QAM upstream levels.
  • modem_downstream_ofdm_channel_{plc,ncp,mdc1}_locked — lock flags. A drop to 0 without a reboot means the OFDM channel lost sync.
  • modem_upstream_ofdm_channel_operating — state label carries the firmware string (OPERATE, …).

Wireless, hosts, MoCA#

Wi-Fi client count per band, per-client RSSI, LAN host count, Ethernet link state per port, and the MoCA link flag. Client and host series carry identifying labels (hostname, mac) — useful for topk, but do not build recording rules that multiply them by time.

Exporter health and logs#

hitron_exporter_up, hitron_exporter_samples, hitron_exporter_scrape_duration_seconds, and hitron_exporter_scrape_error_info. The error metric only exists while a source is failing, which makes it a good table panel: an empty table means healthy.

The last panel is a Loki log stream ({job="hitron"}). It needs the LOKI variable wired to a Loki datasource; without Loki, leave it collapsed. Scrape failures are still visible as metrics.


5. Dashboard tour — HT-EM5#

  • MoCA link, nodes visible, beacon channel, TX power index — four stats from hitron_moca_*.
  • Ethernet frames/s — rate(hitron_moca_ethernet_frames_total[5m]) split by direction and outcome.
  • PHY rate by node pair — hitron_moca_phy_rate_mbps. Only present when the exporter runs with --phy-rates, which is slower because the bridge is probed node pair by node pair.
  • Configured bands — enable/supported/privacy per band.
  • Node inventory — instant table of hitron_moca_node_present with node_id, mac, and self/coordinator flags.

6. Alerts that are worth having#

The bundled rules:

Alert Expression (abridged) For
HitronSourceDown hitron_exporter_up == 0 2m
HitronProvisioningFailed min by (source) (modem_docsis_provisioning_step_success) == 0 10m
HitronDownstreamPowerOutOfSpec min < −6 or max > 15 dBmV 10m
HitronUpstreamPowerOutOfSpec min < 35 or max > 48 dBmV 10m
HitronLowDownstreamSNR min by (source) (modem_downstream_channel_snr_db) < 33 10m
HitronUncorrectableErrors sum by (source) (rate(...uncorrectable_total[5m])) > 1 10m
HitronMocaLinkDown hitron_moca_link_up == 0 5m
HitronExporterScrapeSlow hitron_exporter_scrape_duration_seconds > 20 5m

Tuning advice:

  • Replace the power envelope with your carrier's published range. Midco's numbers are the default because coda57.check_midco_spec uses them.
  • Use min by (source) / max by (source) rather than per-channel alerts. One noisy channel during a scan should not page anyone.
  • Keep for: at 10 minutes or more for RF alerts; a single 30-second scrape is not evidence.
  • Alert on the rate of uncorrectables, never the raw counter — the counter resets on reboot and would otherwise look like a huge drop.
  • If you run both a CODA6X and a CODA-57, source keeps them separate. Do not aggregate across sources for RF alerts.

Add a silence window during known maintenance (plant work, firmware pushes) in Alerting → Silences rather than disabling the rule.


7. Logs with Loki#

The compose file includes Loki and Promtail. Promtail discovers the exporter container, labels lines job="hitron", and forwards them. The dashboard's log panel queries that label.

To wire the panel:

  1. Grafana → Connections → Data sources → Loki, URL http://loki:3100.
  2. Give it UID loki (matches the provisioned file).
  3. Refresh the dashboard; the LOKI variable now resolves.

Useful LogQL:

{job="hitron"} |= "failed"
{job="hitron"} | json | level="WARNING"
sum by (level) (count_over_time({job="hitron"}[5m]))

The exporter also keeps the last 500 log records in memory and serves them at /api/v1/logs, so a quick curl works even without Loki.


8. Adding your own panel#

  1. Find the series: curl -s http://<exporter>:9877/metrics | grep <name>.
  2. Add a panel to src/hitron/grafana.py in the relevant row. _panel() takes title, type_, grid, targets, unit, description.
  3. Regenerate: hitron grafana --dir deploy/grafana.
  4. Copy the JSON to dashboards/ if you want the download link updated.
  5. Commit both, so the generator and the committed copy stay in sync.

Metric names are stable by design:

  • modem_* for CODA6X and CODA-57, matching the original exporter.
  • hitron_* for HT-EM5 and for exporter self-metrics.
  • Counters end in _total; everything else is a gauge.
  • Labels are bounded identifiers (source, channel_id, index, band, port_id, host, node_id), never free text such as a log message.

If you need a new label, add it in src/hitron/metrics.py; every output format and both dashboards pick it up from there.


9. Common problems#

Problem Fix
Panels show "No data" but the target is UP the source variable does not match the exporter label; clear it
$DS unresolved import asked for a datasource and you skipped it; edit the dashboard variable
Dashboard imports but queries fail datasource UID changed; the dashboards use a variable, so re-select it
Log panel empty no Loki, or Promtail cannot read the Docker socket
OFDM panels empty device has no OFDM channel, or firmware omits DsOfdm
PHY-rate panel empty restart the exporter with --phy-rates

Edit this page on GitHub