moduledocs

This commit is contained in:
Graham McIntire 2026-01-17 15:08:49 -06:00
parent 22f81acfa6
commit b6f4946385
No known key found for this signature in database
22 changed files with 131 additions and 25 deletions

View file

@ -1,5 +1,5 @@
* change "revoke" agent to delete
* change "revoke" agent to delete and have it actually delete the agent and ensure it's removed from everything it's been assigned and change them to cloud polling if they were previously set to that agent being deleted
* add ability to rename an agent in a new edit page
* When adding a new device, allow the community string to be empty so it will inherit from the parent
* add and track ICMP pings for each device
* add and track ICMP pings for each device. it should also put a latency graph on the device page that links to the universal graph like the other graphs
* when adding a new device, make it a tab selector to show the default SNMP & ICMP or ICMP only

View file

@ -1,5 +1,12 @@
defmodule Towerops.Accounts.User do
@moduledoc false
@moduledoc """
User schema for authentication and authorization.
Users can own or be members of multiple organizations and authenticate via:
- Email/password
- WebAuthn passkeys
- Session tokens
"""
use Ecto.Schema
import Ecto.Changeset

View file

@ -1,5 +1,9 @@
defmodule Towerops.Accounts.UserNotifier do
@moduledoc false
@moduledoc """
Email notification service for user authentication workflows.
Sends emails for password reset, email confirmation, and other user events.
"""
import Swoosh.Email

View file

@ -1,5 +1,10 @@
defmodule Towerops.Accounts.UserToken do
@moduledoc false
@moduledoc """
User token schema for session and authentication tokens.
Manages session tokens, email confirmation tokens, and password reset tokens
with expiration and hashing.
"""
use Ecto.Schema
import Ecto.Query

View file

@ -1,5 +1,10 @@
defmodule Towerops.Alerts.Alert do
@moduledoc false
@moduledoc """
Alert schema for device monitoring alerts.
Tracks device_up, device_down, and sensor threshold alerts with
acknowledgement status and auto-resolution.
"""
use Ecto.Schema
import Ecto.Changeset

View file

@ -1,7 +1,9 @@
defmodule Towerops.Application do
# See https://hexdocs.pm/elixir/Application.html
# for more information on OTP Applications
@moduledoc false
@moduledoc """
OTP Application module for Towerops.
Supervises the Repo, PubSub, Telemetry, Endpoint, and monitoring workers.
"""
use Application

View file

@ -1,5 +1,13 @@
defmodule Towerops.Devices.Device do
@moduledoc false
@moduledoc """
Device schema for network devices being monitored.
Devices belong to a site and organization, and can have:
- SNMP configuration (community strings, polling settings)
- Associated SNMP device record (interfaces, sensors)
- Agent assignments for remote polling
- Monitoring checks and alerts
"""
use Ecto.Schema
import Ecto.Changeset

View file

@ -1,4 +1,8 @@
defmodule Towerops.Mailer do
@moduledoc false
@moduledoc """
Swoosh mailer for sending emails.
Configured via runtime.exs with adapter (local, SMTP, AWS SES, etc.).
"""
use Swoosh.Mailer, otp_app: :towerops
end

View file

@ -1,5 +1,9 @@
defmodule Towerops.Monitoring.Check do
@moduledoc false
@moduledoc """
Monitoring check schema for device reachability status.
Records the result of each monitoring check (success/failure) with latency.
"""
use Ecto.Schema
import Ecto.Changeset

View file

@ -1,5 +1,9 @@
defmodule Towerops.Organizations.Invitation do
@moduledoc false
@moduledoc """
Invitation schema for inviting users to join an organization.
Tracks invitation tokens, email, role, expiration, and acceptance status.
"""
use Ecto.Schema
import Ecto.Changeset

View file

@ -1,5 +1,9 @@
defmodule Towerops.Organizations.Membership do
@moduledoc false
@moduledoc """
Membership schema representing user-organization relationships.
Defines user roles and permissions within an organization (owner, admin, member).
"""
use Ecto.Schema
import Ecto.Changeset

View file

@ -1,5 +1,14 @@
defmodule Towerops.Organizations.Organization do
@moduledoc false
@moduledoc """
Organization schema for multi-tenant workspace management.
Organizations contain:
- Members (users with roles)
- Sites (physical locations)
- Devices (network equipment)
- Default SNMP configuration
- Default agent token for polling
"""
use Ecto.Schema
import Ecto.Changeset

View file

@ -1,5 +1,9 @@
defmodule Towerops.Repo do
@moduledoc false
@moduledoc """
Ecto repository for PostgreSQL database access.
Configured for TimescaleDB with hypertables for time-series data.
"""
use Ecto.Repo,
otp_app: :towerops,

View file

@ -1,5 +1,9 @@
defmodule Towerops.Sites.Site do
@moduledoc false
@moduledoc """
Site schema representing physical locations within an organization.
Sites contain devices and can have site-level SNMP configuration defaults.
"""
use Ecto.Schema
import Ecto.Changeset

View file

@ -1,5 +1,10 @@
defmodule Towerops.Snmp.Device do
@moduledoc false
@moduledoc """
SNMP device schema containing discovered device information.
Stores system details (sysDescr, sysObjectID), vendor information,
and relationships to interfaces, sensors, and neighbors.
"""
use Ecto.Schema
import Ecto.Changeset

View file

@ -1,5 +1,10 @@
defmodule Towerops.Snmp.Interface do
@moduledoc false
@moduledoc """
SNMP interface schema for network interfaces discovered via IF-MIB.
Stores interface details (name, description, type, speed, MAC address)
and has many interface statistics.
"""
use Ecto.Schema
import Ecto.Changeset

View file

@ -1,5 +1,10 @@
defmodule Towerops.Snmp.InterfaceStat do
@moduledoc false
@moduledoc """
Time-series interface statistics schema.
Stores interface counter values (octets, errors, discards) collected
during SNMP polling. Stored in TimescaleDB hypertable.
"""
use Ecto.Schema
import Ecto.Changeset

View file

@ -1,5 +1,10 @@
defmodule Towerops.Snmp.Neighbor do
@moduledoc false
@moduledoc """
SNMP neighbor schema for network topology discovered via LLDP/CDP.
Stores neighbor information (chassis ID, port ID, system name)
and links to matched devices in the organization.
"""
use Ecto.Schema
import Ecto.Changeset

View file

@ -1,5 +1,10 @@
defmodule Towerops.Snmp.Sensor do
@moduledoc false
@moduledoc """
SNMP sensor schema for monitoring environmental sensors.
Tracks temperature, fan speed, voltage, power, and other sensors
discovered via ENTITY-SENSOR-MIB or vendor-specific MIBs.
"""
use Ecto.Schema
import Ecto.Changeset

View file

@ -1,5 +1,10 @@
defmodule Towerops.Snmp.SensorReading do
@moduledoc false
@moduledoc """
Time-series sensor reading schema.
Stores individual sensor readings (value, status, timestamp) collected
during SNMP polling cycles. Stored in TimescaleDB hypertable.
"""
use Ecto.Schema
import Ecto.Changeset

View file

@ -2,6 +2,9 @@ defmodule ToweropsWeb.AgentChannel do
@moduledoc """
Phoenix channel for bidirectional agent communication.
Handles WebSocket connections from remote SNMP polling agents, distributing
polling jobs and collecting metrics via Protocol Buffers binary encoding.
## Messages from Server → Agent (binary protobuf)
- "jobs" - List of SNMP jobs to execute
@ -13,7 +16,7 @@ defmodule ToweropsWeb.AgentChannel do
- "heartbeat" - Agent metadata (version, hostname, uptime)
- "error" - Job execution errors
All messages use Protocol Buffers binary encoding.
All messages use Protocol Buffers binary encoding for efficiency.
"""
use ToweropsWeb, :channel

View file

@ -1,5 +1,14 @@
defmodule ToweropsWeb.UserAuth do
@moduledoc false
@moduledoc """
Authentication plugs and helpers for user session management.
Provides Plug functions for:
- Fetching current user from session
- Requiring authenticated users
- Redirecting guests and authenticated users
- Managing remember-me tokens
- User session lifecycle (login, logout)
"""
use ToweropsWeb, :verified_routes
import Phoenix.Controller