prop/lib/microwaveprop/commercial.ex
Graham McIntire 10e8feb486
Add commercial link monitoring via SNMP polling
Poll UBNT AirFiber radios (AF11X + AF60-LR) every 5 minutes via
net-snmp CLI, storing signal metrics in commercial_samples. Fetches
ASOS weather alongside each cycle for propagation correlation.

Includes 7 seeded link definitions, Oban cron worker, and net-snmp
in the Docker image.
2026-03-30 13:02:59 -05:00

35 lines
673 B
Elixir

defmodule Microwaveprop.Commercial do
@moduledoc false
import Ecto.Query
alias Microwaveprop.Commercial.Link
alias Microwaveprop.Commercial.Sample
alias Microwaveprop.Repo
def enabled_links do
Link
|> where([l], l.enabled == true)
|> Repo.all()
end
def create_link(attrs) do
%Link{}
|> Link.changeset(attrs)
|> Repo.insert()
end
def create_sample(attrs) do
%Sample{}
|> Sample.changeset(attrs)
|> Repo.insert()
end
def weather_stations do
Link
|> where([l], l.enabled == true and not is_nil(l.weather_station))
|> select([l], l.weather_station)
|> distinct(true)
|> Repo.all()
end
end