Commit graph

585 commits

Author SHA1 Message Date
1af381b5bf
snmp tests and docker attempt to build locally 2026-01-27 10:16:54 -06:00
421f2e05f3
faster tests 2026-01-27 09:30:18 -06:00
c694d452de
fix: add vendor directory and snmp package to k8s Dockerfile 2026-01-27 09:21:55 -06:00
124d68d28d
credo fixes 2026-01-27 09:12:22 -06:00
e94cae3435
add vendor dir to dockerfile 2026-01-26 17:22:31 -06:00
6c238c52e5
fix a few things and fix device discovery 2026-01-26 17:17:31 -06:00
bb86dec559
add oban pro 2026-01-26 17:07:42 -06:00
19a818647b
documentation updates 2026-01-26 16:36:52 -06:00
6782309682
add default temp unit 2026-01-26 15:39:36 -06:00
a05b125600
update cloud poller icon 2026-01-26 15:38:09 -06:00
b20a58aec4
test fixes 2026-01-26 15:27:59 -06:00
756a6b4cd4
poller agent fix and trigger device rediscovery 2026-01-26 14:51:32 -06:00
5e7576bc3f
api token whitespace fix and magic link login fix 2026-01-26 14:05:44 -06:00
0b72b47ae6
better logs for discovery and polling 2026-01-26 13:43:17 -06:00
492dc74c9a
fix network map 2026-01-26 13:39:46 -06:00
74f2970664
ui tweaks 2026-01-26 13:34:52 -06:00
06fde717c0
accessibility and poller updates 2026-01-26 13:02:03 -06:00
902d21eeee
poller detail screen fix 2026-01-26 12:46:14 -06:00
fb42e93f7a
cloud poller fixes 2026-01-26 12:00:55 -06:00
5f1bbab420
cloud poller fixes 2026-01-26 11:57:32 -06:00
51a73b3a44
allow superuser impersonation 2026-01-26 11:37:50 -06:00
c41b479ed8
more tests 2026-01-26 11:01:47 -06:00
99414459d3
device reorder 2026-01-26 10:22:12 -06:00
e781a70c7e
device list update 2026-01-26 09:44:08 -06:00
2f24489ecb
add privacy page 2026-01-25 17:12:34 -06:00
c36b1873eb
routeros fix 2026-01-25 16:59:32 -06:00
7cf59a88ab
require superuser for livedashboard 2026-01-25 16:17:25 -06:00
7b6298f5dc
ecto ssl tweaks 2026-01-25 16:00:48 -06:00
33c5b977b0
ssl ecto 2026-01-25 15:53:28 -06:00
984b1b38c7
add pg_stat_statements 2026-01-25 15:44:59 -06:00
76854479c9
update deployment 2026-01-25 15:29:38 -06:00
d2abe9a14d
add network map 2026-01-25 15:24:35 -06:00
21802eede4
adjust timestamps to be relative 2026-01-25 14:52:13 -06:00
9c5b4096f9
discovery working 2026-01-25 14:48:57 -06:00
a30d6b8219
unit fixes 2026-01-25 13:59:09 -06:00
9cd3d57433
live reload yaml in dev 2026-01-25 13:38:17 -06:00
6e86f54aa0
mikrotik sensor fixes 2026-01-25 13:24:28 -06:00
a23296ea34
fix: add missing sensor units to existing sensors
Sets sensor_unit for all sensors that are missing it, fixing sensors
created before the discovery code was updated to set units properly.

Updates:
- Temperature sensors: set to '°C'
- Voltage sensors: set to 'V'
- Current sensors: set to 'mA'
- Power sensors: set to 'W'
- dBm sensors: set to 'dBm'

This ensures the device detail page displays units correctly for all
sensor types (e.g., "27 °C" instead of "27" for temperature).

The discovery code already sets these units for new sensors, so this
migration only affects existing data.

Related to:
- lib/towerops/snmp/profiles/vendors/routeros.ex:690 (°C)
- lib/towerops/snmp/profiles/vendors/routeros.ex:709 (V)
- lib/towerops/snmp/profiles/base.ex:1473-1480 (sensor_type_to_unit)

🤖 Generated with Claude Code

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-25 12:38:23 -06:00
9c2efec473
test: add coverage for MikroTik wrong unit type override
Adds test case for the real-world scenario where MikroTik devices
report incorrect mtxrGaugeUnit values (e.g., reporting unit type 1
for celsius/temperature when the sensor is actually a voltage sensor).

This test verifies that the name-based override logic in
maybe_override_sensor_type/2 correctly handles this case:
- Sensor name: "psu1-voltage" or "psu2-voltage"
- Reported unit type: 1 (celsius/temperature)
- Expected result: voltage sensor with divisor 10

The override code was added in commit f402dcb (Jan 22, 2026) and
works correctly for new discoveries. Existing sensors created before
this date need the migration from commit 68a4ebf to fix their values.

Related: 20260125182836_fix_misclassified_mikrotik_voltage_sensors.exs

🤖 Generated with Claude Code

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-25 12:34:19 -06:00
68a4ebf601
fix: correct misclassified MikroTik voltage sensors
Fixes voltage sensors that were incorrectly classified as temperature
sensors due to MikroTik devices reporting wrong mtxrGaugeUnit values.

Problem:
- Sensors with names like "psu1-voltage" and "psu2-voltage" were
  classified as temperature sensors with divisor=1
- This caused voltage readings to display as 469V instead of 46.9V
- The RouterOS profile already has name-based override logic for new
  discoveries, but existing sensors needed fixing

Solution:
- Migration identifies sensors by:
  - OID pattern: 1.3.6.1.4.1.14988.1.1.3.100.1.3.%
  - Type mismatch: sensor_type = 'temperature' but name contains 'voltage'
  - Incorrect divisor: sensor_divisor = 1
- Updates sensor metadata: type, unit, divisor
- Corrects historical sensor_reading values by dividing by 10

Future discoveries are already protected by the name-based override
logic in lib/towerops/snmp/profiles/vendors/routeros.ex:620-630

🤖 Generated with Claude Code

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-25 12:30:26 -06:00
277d3be2bd
remove agent version display 2026-01-25 12:22:47 -06:00
d12ffda8b0
show unit 2026-01-25 12:18:41 -06:00
8158042220
fix: correct Mikrotik voltage sensor divisor from 1 to 10
Mikrotik/RouterOS voltage sensors were showing incorrect values (469.0
instead of 46.9) because existing sensors in the database have
sensor_divisor=1 instead of the correct value of 10.

The RouterOS profile code was fixed in a previous commit to set
divisor=10 for new sensors, but existing sensors need to be updated.

Migration changes:
- Updates sensor_divisor from 1 to 10 for Mikrotik voltage sensors
- Identifies Mikrotik sensors by OID prefix: 1.3.6.1.4.1.14988.1.1.3.100.1.3
- Divides all historical sensor_reading values by 10 to correct the data
- Both up and down migrations included for full reversibility

After this migration:
- Voltage will show as 46.9V instead of 469.0V
- Historical graphs will show correct voltage values
2026-01-25 12:11:48 -06:00
86cac2b567
docker tweak 2026-01-25 11:20:46 -06:00
dc32e16c68
fix: allow cloud pollers to access devices from any organization
Cloud pollers (is_cloud_poller = true, organization_id = nil) were
being blocked from polling devices because verify_device_organization
was checking if the device's organization matched the agent's
organization.

Since cloud pollers don't belong to any organization (organization_id
is nil), they should be allowed to poll devices from any organization.

Changes:
- verify_device_organization now allows access if organization_id is nil
- This fixes "Device not in agent's organization" errors for cloud pollers

Error before:
  Device b7e8dd99-0b19-496d-97ae-9f2601d16464 not in agent's organization
2026-01-25 11:15:19 -06:00
81f13f789b
revert: remove custom base image dependency from main Dockerfile
Reverted k8s/Dockerfile back to using official hexpm/elixir and debian
images directly instead of custom gmcintire/towerops-base images.

This restores the original Dockerfile behavior where all dependencies
are installed during each build. The base image work in k8s/base-image/
remains available but is not used by the main application build.
2026-01-25 11:12:37 -06:00
788004cb97
fix: handle :global agent source in device form template
Production was crashing with CaseClauseError when viewing device edit
form for devices using the global default cloud poller.

Added missing :global case branch to the agent source case statement
in form.html.heex line 127.

Displays: 'Using global default cloud poller: <agent_name>'
2026-01-25 11:04:29 -06:00
564caed3e5
refactor: rename base images to gmcintire/towerops-base
Changed image naming scheme from separate builder/runtime images to a
single image name with different tags:

- docker.io/gmcintire/towerops-base:builder
- docker.io/gmcintire/towerops-base:runtime
- docker.io/gmcintire/towerops-base:latest (alias for runtime)

This simplifies the naming and makes it clearer that both images are
part of the same towerops-base image family.

Changes:
- build.sh: Use IMAGE_NAME with BUILDER_TAG/RUNTIME_TAG
- Makefile: Update all targets to use new naming
- k8s/Dockerfile: Point to gmcintire/towerops-base:builder and :runtime
2026-01-25 09:33:42 -06:00
edd64479df
feat: create builder and runtime base images for faster deploys
Instead of installing system packages and tools on every deploy, we now
have two base images that pre-bake all the slow setup steps.

Base Images Created:
1. elixir-builder:latest - Builder stage base
   - hexpm/elixir with build-essential and git pre-installed
   - hex and rebar pre-installed
   - Saves ~40 seconds per deploy

2. debian-runtime:latest - Runtime stage base
   - Debian with all runtime packages pre-installed
   - Locale pre-configured (en_US.UTF-8)
   - /app directory pre-created
   - Saves ~60 seconds per deploy

Main Dockerfile Changes:
- Use elixir-builder:latest instead of hexpm/elixir
- Use debian-runtime:latest instead of debian:trixie-slim
- Remove apt-get install steps (now in base images)
- Remove hex/rebar install (now in builder base)
- Remove locale setup (now in runtime base)

Build System:
- build.sh builds both images with podman/docker auto-detect
- Pushes to both GitLab registry and Docker Hub
- Makefile targets for build/test/push/clean

Total Time Saved Per Deploy: ~100 seconds (1m40s)

Benefits:
- Faster CI/CD builds (no repeated apt-get install)
- Faster local development builds
- Consistent build environment across all deploys
- Security updates centralized in base image rebuilds
2026-01-25 09:29:22 -06:00
26a3b39edd
fix: correct paths for hexpm/elixir image structure
The hexpm images install Erlang and Elixir in /usr/local instead of /usr/lib.

Changes:
- Copy from /usr/local/lib/erlang instead of /usr/lib/erlang
- Copy all Erlang/Elixir binaries from /usr/local/bin
- Remove manual symlink creation (binaries already exist)
- Binaries are symlinks to ../lib/erlang/bin and ../lib/elixir/bin
2026-01-25 09:22:45 -06:00