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.
44 lines
1.2 KiB
Elixir
44 lines
1.2 KiB
Elixir
defmodule Microwaveprop.Repo.Migrations.CreateCommercialSamples do
|
|
use Ecto.Migration
|
|
|
|
def change do
|
|
create table(:commercial_samples, primary_key: false) do
|
|
add :id, :binary_id, primary_key: true
|
|
|
|
add :link_id, references(:commercial_links, type: :binary_id, on_delete: :delete_all),
|
|
null: false
|
|
|
|
add :sampled_at, :utc_datetime_usec, null: false
|
|
|
|
# Local radio
|
|
add :rx_power_0, :float
|
|
add :rx_power_1, :float
|
|
add :tx_power, :float
|
|
add :tx_freq_mhz, :integer
|
|
add :rx_freq_mhz, :integer
|
|
add :radio_temp_0_c, :float
|
|
add :radio_temp_1_c, :float
|
|
|
|
# Modulation & capacity
|
|
add :cur_tx_mod_rate, :integer
|
|
add :remote_tx_mod_rate, :integer
|
|
add :rx_capacity, :integer
|
|
add :tx_capacity, :integer
|
|
|
|
# Remote radio
|
|
add :remote_tx_power, :float
|
|
add :remote_rx_power_0, :float
|
|
add :remote_rx_power_1, :float
|
|
|
|
# Link status
|
|
add :link_state, :integer
|
|
add :link_uptime, :integer
|
|
add :link_distance_m, :integer
|
|
|
|
timestamps(type: :utc_datetime)
|
|
end
|
|
|
|
create index(:commercial_samples, [:link_id, :sampled_at])
|
|
create index(:commercial_samples, [:sampled_at])
|
|
end
|
|
end
|