Monitoring 34 NTP Synchronized Clocks from a Cron Job
Описание и применение
Создан скрипт на Python, который через cron проверяет 34 NTP‑синхронизированных часовых дисплеев, собирает их статус по HTTP и оповещает при отклонении времени более 1 с.
Задача
34 wall‑clock displays across three buildings were not being monitored for time accuracy, risking incorrect time display.
Результат
All 34 displays are now monitored; alerts fire when a display’s offset exceeds ~1 s or when it becomes unreachable, preventing unnoticed drift.
Рабочий процесс
- 1. Verify upstream NTP server sanity with ntplib.
- 2. Define human‑perceivable offset threshold (~1 s).
- 3. Load fleet list from JSON.
- 4. Concurrently poll each device’s /status endpoint.
- 5. Normalize JSON response to internal schema.
- 6. Evaluate offset, last_sync_age, and online status.
- 7. Trigger alerts if offset > threshold or device offline.
- 8. Schedule script via cron for regular monitoring.
Доказательства
Each unit exposes an HTTP status endpoint.
I initially monitored each display's offset from the NTP server and alerted at > 500 ms.
The shape I normalize to internally looks like this: {"id":"BLD-A-F2-REG-01",...}
- Дата записи: 2026-10-26T10:26:08.460Z