routeros fix

This commit is contained in:
Graham McIntire 2026-01-23 13:16:02 -06:00
parent a4335a047a
commit 518b49318c
No known key found for this signature in database
3 changed files with 11 additions and 12 deletions

View file

@ -536,15 +536,13 @@ defmodule ToweropsWeb.DeviceLive.Form do
end
end
@dev_env Mix.env() == :dev
defp skip_non_routable_check?(assigns) do
# Skip in dev mode
if Mix.env() == :dev do
true
else
# Skip for specific users
user = assigns[:current_scope] && assigns.current_scope.user
user && user.email == "graham@mcintire.me"
end
# Skip in dev mode or for specific users
@dev_env ||
(assigns[:current_scope] && assigns.current_scope.user &&
assigns.current_scope.user.email == "graham@mcintire.me")
end
# Determine if the device would use cloud poller (no agent at any level)

View file

@ -61,7 +61,6 @@
"ranch": {:hex, :ranch, "2.2.0", "25528f82bc8d7c6152c57666ca99ec716510fe0925cb188172f41ce93117b1b0", [:make, :rebar3], [], "hexpm", "fa0b99a1780c80218a4197a59ea8d3bdae32fbff7e88527d7d8a4787eff4f8e7"},
"redix": {:hex, :redix, "1.5.3", "4eaae29c75e3285c0ff9957046b7c209aa7f72a023a17f0a9ea51c2a50ab5b0f", [:mix], [{:castore, "~> 0.1.0 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:nimble_options, "~> 0.5.0 or ~> 1.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.0 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "7b06fb5246373af41f5826b03334dfa3f636347d4d5d98b4d455b699d425ae7e"},
"req": {:hex, :req, "0.5.17", "0096ddd5b0ed6f576a03dde4b158a0c727215b15d2795e59e0916c6971066ede", [:mix], [{:brotli, "~> 0.3.1", [hex: :brotli, repo: "hexpm", optional: true]}, {:ezstd, "~> 1.0", [hex: :ezstd, repo: "hexpm", optional: true]}, {:finch, "~> 0.17", [hex: :finch, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:mime, "~> 2.0.6 or ~> 2.1", [hex: :mime, repo: "hexpm", optional: false]}, {:nimble_csv, "~> 1.0", [hex: :nimble_csv, repo: "hexpm", optional: true]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "0b8bc6ffdfebbc07968e59d3ff96d52f2202d0536f10fef4dc11dc02a2a43e39"},
"snmpkit": {:hex, :snmpkit, "1.3.19", "b09c38cea619a0a67d4fb0f3bfa3b9b749d42c400c2e7bd9446fef82f0d728a7", [:mix], [{:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: true]}, {:yaml_elixir, "~> 2.9", [hex: :yaml_elixir, repo: "hexpm", optional: true]}], "hexpm", "b05c1f3911204c4d781234187a6f1350c369fcffe2058a85b49735b1259eb973"},
"sobelow": {:hex, :sobelow, "0.14.1", "2f81e8632f15574cba2402bcddff5497b413c01e6f094bc0ab94e83c2f74db81", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "8fac9a2bd90fdc4b15d6fca6e1608efb7f7c600fa75800813b794ee9364c87f2"},
"stream_data": {:hex, :stream_data, "1.2.0", "58dd3f9e88afe27dc38bef26fce0c84a9e7a96772b2925c7b32cd2435697a52b", [:mix], [], "hexpm", "eb5c546ee3466920314643edf68943a5b14b32d1da9fe01698dc92b73f89a9ed"},
"styler": {:hex, :styler, "1.10.1", "9229050c978bfaaab1d94e8673843576d0127d48fe64824a30babde3d6342475", [:mix], [], "hexpm", "d86cbcc70e8ab424393af313d1d885931ba9dc7c383d7dd30f4ab255a8d39f73"},

View file

@ -283,9 +283,10 @@ defmodule Towerops.Snmp.Profiles.Vendors.RouterosTest do
%{oid: "#{@gauge_table}.2.1", value: "psu-voltage"},
%{oid: "#{@gauge_table}.3.1", value: 469},
%{oid: "#{@gauge_table}.4.1", value: 3},
# CPU Temperature: raw value 450, unit type 1 (celsius * 10) -> should be 45.0°C
# CPU Temperature: raw value 45, unit type 1 (celsius) -> should be 45°C
# LibreNMS shows Mikrotik temperature values are in whole degrees, not deci-degrees
%{oid: "#{@gauge_table}.2.2", value: "cpu-temperature"},
%{oid: "#{@gauge_table}.3.2", value: 450},
%{oid: "#{@gauge_table}.3.2", value: 45},
%{oid: "#{@gauge_table}.4.2", value: 1}
]}
end)
@ -304,11 +305,12 @@ defmodule Towerops.Snmp.Profiles.Vendors.RouterosTest do
assert voltage_sensor.last_value == 46.9
# Find the temperature sensor
# LibreNMS shows Mikrotik temperature values are in whole degrees (divisor 1)
temp_sensor = Enum.find(sensors, &(&1.sensor_descr == "cpu-temperature"))
assert temp_sensor
assert temp_sensor.sensor_type == "temperature"
assert temp_sensor.sensor_unit == "°C"
assert temp_sensor.sensor_divisor == 10
assert temp_sensor.sensor_divisor == 1
assert temp_sensor.last_value == 45.0
end