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.
33 lines
898 B
Elixir
33 lines
898 B
Elixir
defmodule Microwaveprop.Commercial.Link do
|
|
@moduledoc false
|
|
use Ecto.Schema
|
|
|
|
import Ecto.Changeset
|
|
|
|
@primary_key {:id, :binary_id, autogenerate: true}
|
|
@foreign_key_type :binary_id
|
|
|
|
schema "commercial_links" do
|
|
field :label, :string
|
|
field :host, :string
|
|
field :community, :string
|
|
field :radio_type, :string, default: "af11x"
|
|
field :endpoint_a, :map
|
|
field :endpoint_b, :map
|
|
field :weather_station, :string
|
|
field :enabled, :boolean, default: true
|
|
|
|
timestamps(type: :utc_datetime)
|
|
end
|
|
|
|
@required_fields ~w(label host community radio_type)a
|
|
@optional_fields ~w(endpoint_a endpoint_b weather_station enabled)a
|
|
|
|
def changeset(link, attrs) do
|
|
link
|
|
|> cast(attrs, @required_fields ++ @optional_fields)
|
|
|> validate_required(@required_fields)
|
|
|> validate_inclusion(:radio_type, ~w(af11x af60))
|
|
|> unique_constraint(:label)
|
|
end
|
|
end
|