{% extends 'generic/object.html' %} {% load buttons %} {% load helpers %} {% load plugins %} {% load static %} {% load i18n %} {% load render_table from django_tables2 %} {% block head %} {{ block.super }} {% endblock %} {% block javascript %} {{ block.super }} {% endblock %} {% block breadcrumbs %} {{ block.super }} {% with model_name=object|meta:"model_name" %} {% if model_name == "device" %} {% elif model_name == "virtualmachine" %} {% endif %} {% endwith %} {% endblock %} {% block content %} {% if server_selection_error %} {% endif %} {% if server_selection_warning %} {% endif %} {% if server_selection_blocked and not server_selection_has_usable_mapping %} {% endif %} {% if migrated_to_marker %} {% endif %} {% if all_server_mappings %}
LibreNMS Connections
{% include "netbox_librenms_plugin/inc/_server_selector.html" %} {% if librenms_server_info and not librenms_server_info.is_legacy %} Configure Servers {% endif %}
{% for mapping in all_server_mappings %} {% endfor %}
{% if mapping.is_preferred %} {% endif %} {% if mapping.is_active and mapping.is_selectable %} {% elif mapping.is_configured %} {% else %} {% endif %} {% if mapping.is_configured %} {{ mapping.display_name }} {% else %} {{ mapping.server_key }} Not configured {% endif %} {% if mapping.device_url %} ID {{ mapping.device_id }} {% else %} ID {{ mapping.device_id }} {% endif %} {% if mapping.is_oob_only %} OOB only {% endif %} {% if can_manage_server_preference and mapping.is_selectable %} {% if not mapping.is_preferred %}
{% csrf_token %}
{% endif %} {% endif %} {% if mapping.is_configured and not mapping.is_selectable %} Repair this server in the plugin configuration {% endif %} {% if not mapping.is_configured %} {% if lookup_device_model_name == "device" or lookup_device_model_name == "virtualmachine" %} {% if lookup_device_pk == object.pk %}
{% csrf_token %}
{% else %} Managed by VC sync device {% endif %} {% endif %} {% endif %}
{% elif librenms_server_info %}
Active LibreNMS Server: {% if librenms_server_info.is_legacy %} {{ librenms_server_info.url }} {% else %} {{ librenms_server_info.display_name }} ({{ librenms_server_info.url }}) {% endif %}
{% if not librenms_server_info.is_legacy %} Change Server {% endif %}
{% endif %} {% if not server_selection_blocked %} {% if not migrated_to_marker and not is_vc_member or not migrated_to_marker and object.pk == librenms_sync_device.pk %}
LibreNMS Status {% if mismatched_device %} Mismatch found {% endif %}
{% if found_in_librenms %} {% if librenms_device_serial and librenms_device_serial != "-" %} {% endif %} {% with model_name=object|meta:"model_name" %} {% if model_name == "device" %} {% elif model_name == "virtualmachine" %} {% endif %} {% endwith %} {% elif not device_info_unavailable %} {% endif %}
Status {% if device_info_unavailable %} Details unavailable {% elif found_in_librenms %} Found {% else %} Not found {% endif %}
ID {{ librenms_device_id }} {% if librenms_id_is_legacy %}
{% csrf_token %} {% comment %} Scope the conversion to the tab's server: the view rebinds from the POSTed server_key, so omitting it would verify and write the mapping under the GLOBAL selected server, not the ?server_key tab the user is acting on. {% endcomment %} {% include "netbox_librenms_plugin/inc/_hidden_server_key.html" %} {% if librenms_id_serial_confirmed %} {% else %} {% endif %}
{% endif %}
Hostname {% if librenms_device_hostname and librenms_device_hostname != "-" %} {{ librenms_device_hostname }} {% else %} - {% endif %}
sysName {% if sysName %} {{ sysName }} {% else %} - {% endif %}
Serial {% if object.serial and librenms_device_serial != object.serial %} {% endif %} {{ librenms_device_serial }} {% if object.serial and librenms_device_serial == object.serial %} {% endif %}
OS Version {% if platform_info.librenms_version and platform_info.librenms_version != "-" %} {{ platform_info.librenms_version }} {% else %} - {% endif %}
OS {% if platform_info.librenms_os and platform_info.librenms_os != "-" %} {{ platform_info.librenms_os }} {% else %} - {% endif %}
Version {% if platform_info.librenms_version and platform_info.librenms_version != "-" %} {{ platform_info.librenms_version }} {% else %} - {% endif %}
Hardware {% if librenms_device_hardware and librenms_device_hardware != "-" %} {{ librenms_device_hardware }} {% else %} - {% endif %}
Features {% if librenms_device_features and librenms_device_features != "-" %} {{ librenms_device_features }} {% else %} - {% endif %}
LibreNMS Link View
Action
{% if found_in_librenms %} {% with model_name=object|meta:"model_name" %} {% if model_name == "device" %}
Device Information Sync
{% with model_name=object|meta:"model_name" %} {% if model_name == "device" %} {% endif %} {% endwith %}
Field NetBox Value LibreNMS Value
Name
{{ object.name }}
{% if resolved_name and resolved_name != object.name %}
{% csrf_token %} {% comment %} The view rebinds from the POSTed server_key; without it the sync runs against the global selected server, not this tab's server. {% endcomment %} {% include "netbox_librenms_plugin/inc/_hidden_server_key.html" %}
{% elif resolved_name %} {% endif %}
{{ sysName|default:"—" }}
Device Type
{% if object.device_type %} {{ object.device_type }} {% else %} Not set {% endif %}
{% if librenms_device_hardware_match.matched %} {% if not object.device_type or object.device_type.pk != librenms_device_hardware_match.device_type.pk %}
{% csrf_token %} {% include "netbox_librenms_plugin/inc/_hidden_server_key.html" %}
{% else %} {% endif %} {% endif %}
{{ librenms_device_hardware }} {% if not librenms_device_hardware_match.matched and librenms_device_hardware != "-" %} DeviceTypes {% endif %}
Serial Number
{% if object.serial %} {{ object.serial }} {% else %} Not set {% endif %}
{% if object.virtual_chassis and vc_inventory_serials %} {% elif vc_inventory_not_loaded %} VC Serials not loaded {% else %} {% if librenms_device_serial != "-" %} {% if object.serial != librenms_device_serial %}
{% csrf_token %} {% include "netbox_librenms_plugin/inc/_hidden_server_key.html" %}
{% else %} {% endif %} {% endif %} {% endif %}
{{ librenms_device_serial }}
Platform
{% if platform_info.netbox_platform %} {{ platform_info.netbox_platform }} {% else %} Not set {% endif %}
{% if platform_info.librenms_os and platform_info.librenms_os != "-" %} {% if platform_info.platform_exists %} {% if not platform_info.netbox_platform or platform_info.netbox_platform.pk != platform_info.matching_platform.pk %}
{% csrf_token %} {% include "netbox_librenms_plugin/inc/_hidden_server_key.html" %}
{% else %} {% endif %} {% else %} {% endif %} {% endif %}
{{ platform_info.librenms_os }} {% if not platform_info.platform_exists and platform_info.librenms_os and platform_info.librenms_os != "-" %} Not in NetBox {% endif %}
Location {{ object.site.name }}
{{ librenms_device_location }}
{% if librenms_device_location != object.site.name %}
{% csrf_token %} {% include "netbox_librenms_plugin/inc/_hidden_server_key.html" %}
{% else %} {% endif %}
{% endif %} {% endwith %} {% endif %}
{% endif %} {% if last_fetched %} Last data updated: {{ last_fetched|date:"Y-m-d H:i" }} {% endif %} {% if is_vc_member and not object.cf.librenms_id %} {% if sync_device_has_librenms_id %}
{% if librenms_sync_device %} LibreNMS sync for this virtual chassis is managed by {{ librenms_sync_device }} {% else %} LibreNMS sync for this virtual chassis is managed by another member {% endif %}
{% elif sync_device_has_primary_ip %}
{% if librenms_sync_device %} LibreNMS sync for this virtual chassis should be configured on {{ librenms_sync_device }} {% else %} LibreNMS sync for this virtual chassis should be configured on the designated sync device {% endif %}
{% else %}
{% if librenms_sync_device %} Virtual chassis sync device {{ librenms_sync_device }} requires either a primary IP or a LibreNMS ID (custom field) for sync operations {% else %} Virtual chassis requires at least one member with a primary IP or LibreNMS ID configured for sync operations {% endif %}
{% endif %} {% elif librenms_device_id or migrated_to_marker or librenms_lookup_error %} {% comment %} A migrated donor has its active librenms_id cleared (so it is never found_in_librenms), but the banner above directs the user to the per-row "Move to winner" actions that live in these tabs. Render the tabs in migrated mode too, or those interface/IP move controls are unreachable. {% endcomment %} {% comment %} A failed lookup is not an answer about the device, so it is shown before the branch below rather than as one of its outcomes. Saying "not found" here would send the user to clear a librenms_id that may well be correct. {% endcomment %} {% if librenms_lookup_error %}
LibreNMS lookup failed: {{ librenms_lookup_error.message }} {% if librenms_device_id %} Whether LibreNMS has the device with librenms_id {{ librenms_device_id }} is unknown.
Leave the custom field as it is and retry once LibreNMS answers again. If this continues, check the LibreNMS server and its logs for that device. {% else %}
The discovered mapping was not stored. Resolve the reported conflict, then retry. {% endif %}
{% endif %} {% if found_in_librenms or migrated_to_marker or device_info_unavailable and has_librenms_id %} {% if sync_cache_status_url %}
{{ sync_cache_status|json_script:"librenms-sync-cache-initial" }} {{ sync_cache_contract|json_script:"librenms-sync-cache-contract" }} {% endif %}
{{ sync_cache_status|json_script:"librenms-sync-rendered-status" }}
{% include 'netbox_librenms_plugin/inc/_interface_name_field_selector.html' %}
{% if sync_cache_fragment_urls.interfaces %} {% endif %} {% include 'netbox_librenms_plugin/_interface_sync.html' %}
{% if cable_sync %}
{% if sync_cache_fragment_urls.cables %} {% endif %} {% include 'netbox_librenms_plugin/_cable_sync.html' %}
{% endif %}
{% if sync_cache_fragment_urls.ipaddresses %} {% endif %} {% include 'netbox_librenms_plugin/_ipaddress_sync.html' %}
{% if module_sync and object|meta:"model_name" == "device" %}
{% if sync_cache_fragment_urls.modules %} {% endif %} {% include 'netbox_librenms_plugin/_module_sync.html' %}
{% endif %} {% with model_name=object|meta:"model_name" %} {% if model_name == "device" %}
{% if sync_cache_fragment_urls.vlans %} {% endif %} {% include 'netbox_librenms_plugin/_vlan_sync.html' %}
{% endif %} {% endwith %}
{% else %}
Device not found: Device has custom field librenms_id set to {{ librenms_device_id }} but was not found in LibreNMS.
Options to resolve:
  • Remove the custom field value to enable automatic matching. The plugin will attempt to find the device using:
    • Primary IP address
    • Primary IP DNS name (FQDN)
    • Device name
  • Update the custom field with the correct LibreNMS device ID
  • Verify the device exists in LibreNMS at the configured server
{% endif %} {% else %}
Device not found in LibreNMS. To match a device, use one of these methods:
{% endif %} {% if mismatched_device %} {% endif %} {% if not found_in_librenms and not device_info_unavailable %} {% endif %} {% if object.virtual_chassis and vc_inventory_serials %} {% endif %} {% if object_model_name == "device" and not platform_info.platform_exists and platform_info.platform_name and found_in_librenms %} {% endif %} {% endif %} {% endblock %}