- nix.md: TimescaleDB now enabled for both dev and test databases - nix.md: added troubleshooting section for TimescaleDB reinitialization - New: docs/features/organization-settings.md (tabbed interface, all tabs documented) - New: docs/features/device-monitoring.md (schema field reference, activity feed fields, SNMP socket management)
47 lines
1.9 KiB
Markdown
47 lines
1.9 KiB
Markdown
# Device Monitoring
|
|
|
|
## Device Schema
|
|
|
|
Key fields on the `Device` schema (`Towerops.Devices.Device`):
|
|
|
|
| Field | Type | Description |
|
|
|-------|------|-------------|
|
|
| `device_role` | string | Device role classification (router, switch, ap, etc.) |
|
|
| `last_checked_at` | utc_datetime | Last time any check ran against this device |
|
|
| `last_discovery_at` | utc_datetime | Last SNMP discovery scan |
|
|
| `last_snmp_poll_at` | utc_datetime | Last SNMP metrics poll |
|
|
|
|
> **Note**: The schema does NOT have `device_type` or `last_seen_at` — these were removed/renamed. Use `device_role` and `last_checked_at` respectively.
|
|
|
|
## Device Health Indicators
|
|
|
|
The device index shows health status based on check results:
|
|
|
|
- **Status badge**: up/down/warning based on latest check
|
|
- **Role icon**: visual indicator based on `device_role`
|
|
- **Last checked**: relative timestamp from `last_checked_at`
|
|
|
|
## Activity Feed
|
|
|
|
Dashboard activity feed items (from `ActivityFeed.list_org_activity/2`) use:
|
|
|
|
| Field | Type | Description |
|
|
|-------|------|-------------|
|
|
| `summary` | string | Short description of the activity |
|
|
| `detail` | string | Extended detail (optional) |
|
|
| `timestamp` | utc_datetime | When the activity occurred |
|
|
| `severity` | string | info, warning, error, critical |
|
|
| `icon` | string | Hero icon name |
|
|
| `link` | string | URL to related resource |
|
|
| `device_name` | string | Associated device name |
|
|
| `site_name` | string | Associated site name |
|
|
|
|
> **Note**: Activity items do NOT have `description` or `inserted_at` — use `summary` and `timestamp`.
|
|
|
|
## SNMP Socket Management
|
|
|
|
The SNMP manager (`SnmpKit.SnmpLib.Manager`) uses UDP sockets for device communication. Key implementation details:
|
|
|
|
- Sockets are opened per-request and cleaned up via `try/after` blocks
|
|
- `get_bulk`, `set`, and `get_multi` all guarantee socket cleanup in all code paths
|
|
- Previously, socket leaks could cause EMFILE (too many open files) errors that would crash the BEAM VM
|