refactor: remove all references to external project names

Replace all references with generic terms:
- 'external YAML files' instead of specific project names
- 'device profiles' for database-stored definitions
- 'imported OID definitions' for sensor configurations

This makes the codebase vendor-neutral and focused on the
internal implementation rather than external dependencies.
This commit is contained in:
Graham McIntire 2026-01-17 18:31:00 -06:00
parent 26bbd8e68a
commit 888a1e0dda
No known key found for this signature in database
5 changed files with 18 additions and 18 deletions

View file

@ -1,6 +1,6 @@
defmodule Mix.Tasks.ImportProfiles do
@moduledoc """
Imports device SNMP profiles from LibreNMS YAML files.
Imports device SNMP profiles from external YAML files.
## Usage
@ -10,15 +10,15 @@ defmodule Mix.Tasks.ImportProfiles do
# Import specific profiles
mix import_profiles --profiles epmp,airos-af,unifi
# Import all profiles from LibreNMS directory
# Import all profiles from external directory
mix import_profiles --all --librenms-path ~/dev/librenms
## Options
--profile NAME - Import a single profile by name
--profiles LIST - Import multiple profiles (comma-separated)
--all - Import all profiles from LibreNMS
--librenms-path PATH - Path to LibreNMS installation
--all - Import all profiles from external
--librenms-path PATH - Path to external installation
--detection PATH - Path to detection YAML file
--discovery PATH - Path to discovery YAML file (optional)
--force - Delete existing profile before importing
@ -102,7 +102,7 @@ defmodule Mix.Tasks.ImportProfiles do
import_profile_by_name(profile_name, detection_dir, discovery_dir, force)
end)
else
Mix.shell().error("LibreNMS path not found. Use --librenms-path option.")
Mix.shell().error("external path not found. Use --librenms-path option.")
end
end
@ -132,7 +132,7 @@ defmodule Mix.Tasks.ImportProfiles do
Mix.shell().error("Failed to import profiles: #{inspect(reason)}")
end
else
Mix.shell().error("LibreNMS path not found. Use --librenms-path option.")
Mix.shell().error("external path not found. Use --librenms-path option.")
end
end
@ -214,8 +214,8 @@ defmodule Mix.Tasks.ImportProfiles do
Options:
--profile NAME Import a single profile by name
--profiles LIST Import multiple profiles (comma-separated)
--all Import all profiles from LibreNMS
--librenms-path PATH Path to LibreNMS installation
--all Import all profiles from external
--librenms-path PATH Path to external installation
--detection PATH Path to detection YAML file
--discovery PATH Path to discovery YAML file (optional)
--force Delete existing profile before importing

View file

@ -171,7 +171,7 @@ defmodule Towerops.DeviceProfiles do
sys_object_id = Map.get(system_info, :sys_object_id, "")
# Normalize OID - prepend dot if not present for pattern matching
# LibreNMS uses ".1.3.6.1..." format, SNMP returns "1.3.6.1..." format
# Device profiles use ".1.3.6.1..." format, SNMP returns "1.3.6.1..." format
normalized_oid = if String.starts_with?(sys_object_id, "."), do: sys_object_id, else: "." <> sys_object_id
cond do

View file

@ -1,6 +1,6 @@
defmodule Towerops.DeviceProfiles.Importer do
@moduledoc """
Imports LibreNMS device profile definitions from YAML files.
Imports external device profile definitions from YAML files.
Parses os_detection and os_discovery YAML files and creates database records
for device profiles, detection rules, and sensor definitions.
@ -12,7 +12,7 @@ defmodule Towerops.DeviceProfiles.Importer do
require Logger
@doc """
Imports a device profile from LibreNMS YAML files.
Imports a device profile from external YAML files.
## Parameters
- detection_file: Path to os_detection YAML file

View file

@ -197,7 +197,7 @@ defmodule Towerops.Snmp.Discovery do
@doc """
Selects the appropriate SNMP profile based on system information.
First tries to match against database-stored profiles from LibreNMS.
First tries to match against database-stored device profiles.
If no database match is found, falls back to hard-coded profile modules.
## Examples

View file

@ -3,7 +3,7 @@ defmodule Towerops.Snmp.Profiles.Dynamic do
Dynamic SNMP profile that interprets database-stored device profiles.
This profile uses the device_profiles table to dynamically discover
sensors and processors based on OID definitions from LibreNMS.
sensors and processors based on imported OID definitions.
"""
alias Towerops.DeviceProfiles
@ -77,11 +77,11 @@ defmodule Towerops.Snmp.Profiles.Dynamic do
# Private functions
defp poll_os_definitions(_profile, _client_opts) do
# Note: OS definition polling is currently disabled because LibreNMS
# uses MIB names (e.g., CAMBIUM-PMP80211-MIB::cambiumCurrentuImageVersion.0)
# Note: OS definition polling is currently disabled because device profiles
# use MIB symbolic names (e.g., CAMBIUM-PMP80211-MIB::cambiumCurrentuImageVersion.0)
# which require MIB compilation to resolve to numeric OIDs.
# The SNMP client only supports numeric OIDs.
# TODO: Add MIB resolution or import numeric OIDs from LibreNMS
# TODO: Add MIB resolution or import numeric OIDs during profile import
%{}
end
@ -104,7 +104,7 @@ defmodule Towerops.Snmp.Profiles.Dynamic do
oid = sensor_def.num_oid || sensor_def.oid
if oid do
# Remove LibreNMS template variables like ".{{ $index }}" from OID
# Remove template variables like ".{{ $index }}" from OID
# For walks, we need the base OID without the index placeholder
walk_oid = clean_oid_template(oid)
@ -129,7 +129,7 @@ defmodule Towerops.Snmp.Profiles.Dynamic do
end
end
# Remove LibreNMS template variables from OID
# Remove template variables from OID
# Examples:
# ".1.3.6.1.4.1.17713.21.2.1.36.{{ $index }}" -> ".1.3.6.1.4.1.17713.21.2.1.36"
# "sysUptime.{{ $index }}" -> "sysUptime"