1.1.0: default interval 8 h, minimum 1 h
A repeater's battery, temperature and noise do not change by the hour, and every reading is airtime on a channel everyone shares. The dashboard window follows: 24 h by default (2-3x the interval), staleness thresholds too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
726a618483
commit
e2d3c72ba2
9 files changed
+50
-38
No files matched your search
@@ -11,9 +11,9 @@ README.md has the full reference. This file is the procedure and the rules.
|
|||||||
`set radio`, `advert`, `reboot`, `erase` or any other CLI command to a
|
`set radio`, `advert`, `reboot`, `erase` or any other CLI command to a
|
||||||
node, with meshcli or anything else. A repeater is part of a community
|
node, with meshcli or anything else. A repeater is part of a community
|
||||||
network; a wrong setting breaks routing for other people.
|
network; a wrong setting breaks routing for other people.
|
||||||
2. **Keep the default interval (3600 s).** Shorter only if the user explicitly
|
2. **Keep the default interval (28800 s, 8 h).** Shorter only if the user explicitly
|
||||||
asks for it and understands it costs shared airtime (point them to
|
asks for it and understands it costs shared airtime (point them to
|
||||||
https://meshcore.repeater.cz/nastaveni/telemetrie/). Never below 900 (the
|
https://meshcore.repeater.cz/nastaveni/telemetrie/). Never below 3600 (the
|
||||||
program refuses).
|
program refuses).
|
||||||
3. **Passwords** go into `stack/.env` or `repeaters.toml` only (both are
|
3. **Passwords** go into `stack/.env` or `repeaters.toml` only (both are
|
||||||
git-ignored), never into a command you print, a commit, a log or an
|
git-ignored), never into a command you print, a commit, a log or an
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ repeater ))) mesh ((( companion rádio ── USB ── meshcore-exporter ─
|
|||||||

|

|
||||||
|
|
||||||
Companion rádio (libovolná MeshCore deska s companion firmwarem, připojená
|
Companion rádio (libovolná MeshCore deska s companion firmwarem, připojená
|
||||||
k počítači) se jednou za hodinu přihlásí na repeater, vyžádá si stav
|
k počítači) se jednou za 8 hodin přihlásí na repeater, vyžádá si stav
|
||||||
a telemetrii přímými pakety a exportér to vystaví na `:9200/metrics`.
|
a telemetrii přímými pakety a exportér to vystaví na `:9200/metrics`.
|
||||||
|
|
||||||
*English: a Prometheus exporter that logs in to MeshCore repeaters over the
|
*English: a Prometheus exporter that logs in to MeshCore repeaters over the
|
||||||
@@ -78,7 +78,7 @@ desku do kontejneru nepředá, tam použijte [2.](#2-jen-exportér).
|
|||||||
Grafana poběží na `http://<počítač>:3000` (uživatel `admin`, heslo
|
Grafana poběží na `http://<počítač>:3000` (uživatel `admin`, heslo
|
||||||
z `.env`), dashboard **MeshCore — repeater** je domovská stránka. První
|
z `.env`), dashboard **MeshCore — repeater** je domovská stránka. První
|
||||||
čísla jsou tam do minuty, grafy rychlostí (duty cycle, trend baterie) se
|
čísla jsou tam do minuty, grafy rychlostí (duty cycle, trend baterie) se
|
||||||
naplní za pár hodin (počítají se z okna 3 h, proměnná dashboardu **Okno**).
|
naplní až za den (počítají se z okna 24 h, proměnná dashboardu **Okno**).
|
||||||
|
|
||||||
Data drží Prometheus 400 dní (`PROMETHEUS_RETENTION` v `.env`).
|
Data drží Prometheus 400 dní (`PROMETHEUS_RETENTION` v `.env`).
|
||||||
Aktualizace: `docker compose pull && docker compose up -d`. Stack jede na
|
Aktualizace: `docker compose pull && docker compose up -d`. Stack jede na
|
||||||
@@ -147,7 +147,7 @@ jedna z nich, rádio sdílí s tím, co na openHopu už běží.
|
|||||||
node_name: "muj-exporter"
|
node_name: "muj-exporter"
|
||||||
tcp_port: 5002
|
tcp_port: 5002
|
||||||
bind_address: 127.0.0.1 # companion protokol nemá heslo: jen lokálně
|
bind_address: 127.0.0.1 # companion protokol nemá heslo: jen lokálně
|
||||||
tcp_timeout: 0 # exportér drží spojení i hodinu mezi čteními
|
tcp_timeout: 0 # exportér drží spojení i hodiny mezi čteními
|
||||||
```
|
```
|
||||||
|
|
||||||
`tcp_timeout: 0` je nutný: výchozích 120 s by spojení mezi dvěma čteními
|
`tcp_timeout: 0` je nutný: výchozích 120 s by spojení mezi dvěma čteními
|
||||||
@@ -216,7 +216,7 @@ Přepínač má přednost před proměnnou a ta před souborem.
|
|||||||
| `--repeaters` | `MC_REPEATERS` | — | `jméno[=pubkey][@cesta]`, víc přes čárku |
|
| `--repeaters` | `MC_REPEATERS` | — | `jméno[=pubkey][@cesta]`, víc přes čárku |
|
||||||
| `--password` | `MC_PASSWORD` | — | heslo pro `--repeaters` |
|
| `--password` | `MC_PASSWORD` | — | heslo pro `--repeaters` |
|
||||||
| `--config` | `MC_CONFIG` | — | TOML s bloky `[[repeater]]` (heslo pro každý zvlášť) |
|
| `--config` | `MC_CONFIG` | — | TOML s bloky `[[repeater]]` (heslo pro každý zvlášť) |
|
||||||
| `--interval` | `MC_INTERVAL` | 3600 | sekundy mezi čteními, minimum 900 |
|
| `--interval` | `MC_INTERVAL` | 28800 | sekundy mezi čteními (8 h), minimum 3600 |
|
||||||
| `--path-hash-bytes` | `MC_PATH_HASH_BYTES` | neměnit | šířka hashů cesty companionu; CZ mesh: 2 |
|
| `--path-hash-bytes` | `MC_PATH_HASH_BYTES` | neměnit | šířka hashů cesty companionu; CZ mesh: 2 |
|
||||||
| `--rf-timeout` | `MC_RF_TIMEOUT` | 30 | čekání na jednu odpověď |
|
| `--rf-timeout` | `MC_RF_TIMEOUT` | 30 | čekání na jednu odpověď |
|
||||||
| `--listen`, `--port` | `MC_LISTEN`, `MC_METRICS_PORT` | 0.0.0.0, 9200 | kde vystavit metriky |
|
| `--listen`, `--port` | `MC_LISTEN`, `MC_METRICS_PORT` | 0.0.0.0, 9200 | kde vystavit metriky |
|
||||||
@@ -247,9 +247,9 @@ Všechny mají label `node` (jméno repeateru).
|
|||||||
|
|
||||||
Jedno čtení repeateru (status + telemetrie, tam i zpět) zabere na českém
|
Jedno čtení repeateru (status + telemetrie, tam i zpět) zabere na českém
|
||||||
nastavení (SF7/62,5 kHz) zhruba 0,8 s kanálu, který sdílí všichni. Výchozí
|
nastavení (SF7/62,5 kHz) zhruba 0,8 s kanálu, který sdílí všichni. Výchozí
|
||||||
interval je hodina, tedy necelá sekunda za hodinu na repeater. Kratší interval
|
interval je 8 hodin, tedy necelá sekunda za 8 hodin na repeater. Kratší interval
|
||||||
přidá provoz všem okolo a nic užitečného nepřinese: baterie, teplota ani šum
|
přidá provoz všem okolo a nic užitečného nepřinese: baterie, teplota ani šum
|
||||||
se za pár minut nezmění. Exportér pod 15 minut nejde.
|
se za pár minut nezmění. Exportér pod hodinu nejde.
|
||||||
|
|
||||||
Než interval zkrátíte, zamyslete se, jak často ta data opravdu potřebujete.
|
Než interval zkrátíte, zamyslete se, jak často ta data opravdu potřebujete.
|
||||||
Dobře to rozebírá návod [Telemetrie, senzory, GPS](https://meshcore.repeater.cz/nastaveni/telemetrie/)
|
Dobře to rozebírá návod [Telemetrie, senzory, GPS](https://meshcore.repeater.cz/nastaveni/telemetrie/)
|
||||||
@@ -265,7 +265,7 @@ na meshcore.repeater.cz.
|
|||||||
| `login failed` | špatné heslo — **MeshCore bere jen prvních 15 znaků**, delší heslo se tiše usekne —, nebo odpověď nedoletěla |
|
| `login failed` | špatné heslo — **MeshCore bere jen prvních 15 znaků**, delší heslo se tiše usekne —, nebo odpověď nedoletěla |
|
||||||
| jednou `login failed` / `no status reply`, pak `retrying … in 180 s` | ztracená odpověď v éteru, nebo repeater krátce po předchozím přihlášení (např. `--check`) nový login zahodil; exportér to sám zkusí znovu za 3 minuty, nic nedělejte |
|
| jednou `login failed` / `no status reply`, pak `retrying … in 180 s` | ztracená odpověď v éteru, nebo repeater krátce po předchozím přihlášení (např. `--check`) nový login zahodil; exportér to sám zkusí znovu za 3 minuty, nic nedělejte |
|
||||||
| `no status reply` | spojení jen jedním směrem: zkuste trasu přes jiný repeater (`@cesta`) |
|
| `no status reply` | spojení jen jedním směrem: zkuste trasu přes jiný repeater (`@cesta`) |
|
||||||
| prázdné nebo zubaté grafy rychlostí | počítají se z okna **Okno** (výchozí 3 h): po startu počkejte pár hodin; při jiném intervalu nastavte okno aspoň na 2–3× interval |
|
| prázdné nebo zubaté grafy rychlostí | počítají se z okna **Okno** (výchozí 24 h): po startu počkejte den; při jiném intervalu nastavte okno aspoň na 2–3× interval |
|
||||||
|
|
||||||
Podrobný log: `--log-level DEBUG`.
|
Podrobný log: `--log-level DEBUG`.
|
||||||
|
|
||||||
|
|||||||
@@ -164,8 +164,8 @@ panels = [
|
|||||||
0,
|
0,
|
||||||
"time() - meshcore_last_scrape_success_timestamp{SEL}",
|
"time() - meshcore_last_scrape_success_timestamp{SEL}",
|
||||||
"s",
|
"s",
|
||||||
steps((None, "green"), (4000, "yellow"), (7500, "red")),
|
steps((None, "green"), (30000, "yellow"), (58000, "red")),
|
||||||
"Kdy naposledy uzel odpověděl. Při výchozím intervalu 1 h je normál do ~3600 s.",
|
"Kdy naposledy uzel odpověděl. Při výchozím intervalu 8 h je normál do ~28800 s.",
|
||||||
),
|
),
|
||||||
stat(
|
stat(
|
||||||
5, "Fronta TX", 16, 0, "meshcore_queue_length{SEL}", "none", steps((None, "green"), (3, "yellow"), (8, "red"))
|
5, "Fronta TX", 16, 0, "meshcore_queue_length{SEL}", "none", steps((None, "green"), (3, "yellow"), (8, "red"))
|
||||||
@@ -346,12 +346,14 @@ dashboard = {
|
|||||||
"name": "window",
|
"name": "window",
|
||||||
"label": "Okno",
|
"label": "Okno",
|
||||||
"type": "custom",
|
"type": "custom",
|
||||||
"query": "1h,3h,6h,12h",
|
"query": "1h,3h,6h,12h,24h,48h",
|
||||||
"current": {"text": "3h", "value": "3h"},
|
"current": {"text": "24h", "value": "24h"},
|
||||||
"options": [{"text": w, "value": w, "selected": w == "3h"} for w in ("1h", "3h", "6h", "12h")],
|
"options": [
|
||||||
|
{"text": w, "value": w, "selected": w == "24h"} for w in ("1h", "3h", "6h", "12h", "24h", "48h")
|
||||||
|
],
|
||||||
"hide": 0,
|
"hide": 0,
|
||||||
"description": "Okno pro rychlosti a duty cycle. Data se mění jen při čtení repeateru, "
|
"description": "Okno pro rychlosti a duty cycle. Data se mění jen při čtení repeateru, "
|
||||||
"takže okno má být aspoň 2–3× interval čtení (výchozí 1 h → 3h).",
|
"takže okno má být aspoň 2–3× interval čtení (výchozí 8 h → 24h).",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "node",
|
"name": "node",
|
||||||
|
|||||||
@@ -41,10 +41,10 @@
|
|||||||
"name": "window",
|
"name": "window",
|
||||||
"label": "Okno",
|
"label": "Okno",
|
||||||
"type": "custom",
|
"type": "custom",
|
||||||
"query": "1h,3h,6h,12h",
|
"query": "1h,3h,6h,12h,24h,48h",
|
||||||
"current": {
|
"current": {
|
||||||
"text": "3h",
|
"text": "24h",
|
||||||
"value": "3h"
|
"value": "24h"
|
||||||
},
|
},
|
||||||
"options": [
|
"options": [
|
||||||
{
|
{
|
||||||
@@ -55,7 +55,7 @@
|
|||||||
{
|
{
|
||||||
"text": "3h",
|
"text": "3h",
|
||||||
"value": "3h",
|
"value": "3h",
|
||||||
"selected": true
|
"selected": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"text": "6h",
|
"text": "6h",
|
||||||
@@ -66,10 +66,20 @@
|
|||||||
"text": "12h",
|
"text": "12h",
|
||||||
"value": "12h",
|
"value": "12h",
|
||||||
"selected": false
|
"selected": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"text": "24h",
|
||||||
|
"value": "24h",
|
||||||
|
"selected": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"text": "48h",
|
||||||
|
"value": "48h",
|
||||||
|
"selected": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"hide": 0,
|
"hide": 0,
|
||||||
"description": "Okno pro rychlosti a duty cycle. Data se mění jen při čtení repeateru, takže okno má být aspoň 2–3× interval čtení (výchozí 1 h → 3h)."
|
"description": "Okno pro rychlosti a duty cycle. Data se mění jen při čtení repeateru, takže okno má být aspoň 2–3× interval čtení (výchozí 8 h → 24h)."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "node",
|
"name": "node",
|
||||||
@@ -304,11 +314,11 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"color": "yellow",
|
"color": "yellow",
|
||||||
"value": 4000
|
"value": 30000
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"color": "red",
|
"color": "red",
|
||||||
"value": 7500
|
"value": 58000
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -338,7 +348,7 @@
|
|||||||
"refId": "A"
|
"refId": "A"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "Kdy naposledy uzel odpověděl. Při výchozím intervalu 1 h je normál do ~3600 s."
|
"description": "Kdy naposledy uzel odpověděl. Při výchozím intervalu 8 h je normál do ~28800 s."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 5,
|
"id": 5,
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ on http://<listen>:9200/metrics: battery, temperature, noise floor, RSSI/SNR,
|
|||||||
packet counters, airtime, uptime, TX queue.
|
packet counters, airtime, uptime, TX queue.
|
||||||
|
|
||||||
Every reading costs airtime on a shared channel (~0.8 s per repeater on the
|
Every reading costs airtime on a shared channel (~0.8 s per repeater on the
|
||||||
Czech preset), so the interval defaults to an hour and cannot go below 15 minutes.
|
Czech preset), so the interval defaults to 8 hours and cannot go below an hour.
|
||||||
How often do you really need the numbers? See
|
How often do you really need the numbers? See
|
||||||
https://meshcore.repeater.cz/nastaveni/telemetrie/
|
https://meshcore.repeater.cz/nastaveni/telemetrie/
|
||||||
|
|
||||||
@@ -33,10 +33,10 @@ import time
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
__version__ = "1.0.1"
|
__version__ = "1.1.0"
|
||||||
|
|
||||||
MIN_INTERVAL = 900
|
MIN_INTERVAL = 3600
|
||||||
DEFAULT_INTERVAL = 3600
|
DEFAULT_INTERVAL = 28800
|
||||||
# A failed repeater is retried once after this, not after the full interval:
|
# A failed repeater is retried once after this, not after the full interval:
|
||||||
# a lost reply on air is common, and a repeater also drops a login whose
|
# a lost reply on air is common, and a repeater also drops a login whose
|
||||||
# timestamp is not newer than the last one from the same client (replay
|
# timestamp is not newer than the last one from the same client (replay
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ serial = "/dev/serial/by-id/usb-REPLACE_ME-if00" # `ls /dev/serial/by-id/`
|
|||||||
# ble = "AA:BB:CC:DD:EE:FF" # BLE companion
|
# ble = "AA:BB:CC:DD:EE:FF" # BLE companion
|
||||||
# ble_pin = "123456"
|
# ble_pin = "123456"
|
||||||
|
|
||||||
interval = 3600 # seconds between rounds (min 900)
|
interval = 28800 # seconds between rounds (min 3600)
|
||||||
# path_hash_bytes = 2 # Czech mesh: 2
|
# path_hash_bytes = 2 # Czech mesh: 2
|
||||||
|
|
||||||
# Default password for the blocks below that have none. Admin or guest:
|
# Default password for the blocks below that have none. Admin or guest:
|
||||||
|
|||||||
+3
-3
@@ -23,10 +23,10 @@ MC_VERSION=latest
|
|||||||
MC_REPEATERS=REPLACE_ME
|
MC_REPEATERS=REPLACE_ME
|
||||||
# Admin or guest password of the repeater(s). Guest: all but external sensors.
|
# Admin or guest password of the repeater(s). Guest: all but external sensors.
|
||||||
MC_PASSWORD=REPLACE_ME
|
MC_PASSWORD=REPLACE_ME
|
||||||
# Seconds between readings (min 900). Each reading takes ~1 s of a channel
|
# Seconds between readings (min 3600). Each reading takes ~1 s of a channel
|
||||||
# everyone shares. A battery does not change in minutes: an hour is plenty;
|
# everyone shares. A battery does not change in minutes: 8 hours is plenty;
|
||||||
# https://meshcore.repeater.cz/nastaveni/telemetrie/
|
# https://meshcore.repeater.cz/nastaveni/telemetrie/
|
||||||
MC_INTERVAL=3600
|
MC_INTERVAL=28800
|
||||||
# Czech mesh: 2 (width of route hashes in packets this radio sends)
|
# Czech mesh: 2 (width of route hashes in packets this radio sends)
|
||||||
MC_PATH_HASH_BYTES=2
|
MC_PATH_HASH_BYTES=2
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
global:
|
global:
|
||||||
# The exporter reads the mesh every 15 min; scraping its page more often
|
# The exporter reads the mesh every few hours; scraping its page more often
|
||||||
# costs nothing on air and just repeats the last values.
|
# costs nothing on air and just repeats the last values.
|
||||||
scrape_interval: 60s
|
scrape_interval: 60s
|
||||||
|
|
||||||
|
|||||||
@@ -38,9 +38,9 @@ def test_cli_minimal(monkeypatch):
|
|||||||
|
|
||||||
def test_env_twins(monkeypatch):
|
def test_env_twins(monkeypatch):
|
||||||
s = settings(
|
s = settings(
|
||||||
[], monkeypatch, {"MC_TCP": "h:5000", "MC_REPEATERS": "rpt", "MC_INTERVAL": "1800", "MC_PATH_HASH_BYTES": "2"}
|
[], monkeypatch, {"MC_TCP": "h:5000", "MC_REPEATERS": "rpt", "MC_INTERVAL": "7200", "MC_PATH_HASH_BYTES": "2"}
|
||||||
)
|
)
|
||||||
assert s.tcp == "h:5000" and s.interval == 1800 and s.path_hash_bytes == 2
|
assert s.tcp == "h:5000" and s.interval == 7200 and s.path_hash_bytes == 2
|
||||||
|
|
||||||
|
|
||||||
def test_interval_floor(monkeypatch):
|
def test_interval_floor(monkeypatch):
|
||||||
@@ -64,16 +64,16 @@ def test_bad_setup(argv, monkeypatch):
|
|||||||
def test_toml(tmp_path, monkeypatch):
|
def test_toml(tmp_path, monkeypatch):
|
||||||
f = tmp_path / "r.toml"
|
f = tmp_path / "r.toml"
|
||||||
f.write_text(
|
f.write_text(
|
||||||
'serial = "/dev/y"\ninterval = 1800\npassword = "common"\n'
|
'serial = "/dev/y"\ninterval = 7200\npassword = "common"\n'
|
||||||
'[[repeater]]\nname = "one"\n'
|
'[[repeater]]\nname = "one"\n'
|
||||||
'[[repeater]]\nname = "two"\npassword = "own"\npath = "5361"\n'
|
'[[repeater]]\nname = "two"\npassword = "own"\npath = "5361"\n'
|
||||||
)
|
)
|
||||||
s = settings(["--config", str(f)], monkeypatch)
|
s = settings(["--config", str(f)], monkeypatch)
|
||||||
assert s.serial == "/dev/y" and s.interval == 1800
|
assert s.serial == "/dev/y" and s.interval == 7200
|
||||||
assert [(t.name, t.password, t.path) for t in s.targets] == [("one", "common", ""), ("two", "own", "5361")]
|
assert [(t.name, t.password, t.path) for t in s.targets] == [("one", "common", ""), ("two", "own", "5361")]
|
||||||
# the command line wins over the file
|
# the command line wins over the file
|
||||||
s = settings(["--config", str(f), "--interval", "2400"], monkeypatch)
|
s = settings(["--config", str(f), "--interval", "10800"], monkeypatch)
|
||||||
assert s.interval == 2400
|
assert s.interval == 10800
|
||||||
|
|
||||||
|
|
||||||
def test_example_toml_loads(monkeypatch):
|
def test_example_toml_loads(monkeypatch):
|
||||||
|
|||||||
Reference in new issue
Block a user