Devices get a CPU & RAM panel: CPU model from a built-in catalogue of over 700 Intel Xeon and AMD Opteron/EPYC server CPUs since 2012 (cores, threads, base/turbo clock, TDP, socket, year, max sockets; checked against Intel ARK, AMD and server vendor data), CPU count and RAM with modules, type and speed. The catalogue is loaded by migration 0011, can be edited and extended in the UI and refreshed with netbox_utilities_cpu_catalog. Virtualization: clusters show their capacity (cores, threads and RAM of the hosts against the vCPUs and memory of the VMs, vCPU:core ratio, RAM allocation, N+1 reserve) with a per-host table, hosts list their VMs and VMs show the CPU of their host. Optional columns for the device and cluster lists, CSV import, REST API, GraphQL and search are included. The plugin menu is now called "Hardware". Co-Authored-By: Claude Opus 5.5 <[email protected]>
120 lines
3.7 KiB
Python
120 lines
3.7 KiB
Python
import django_tables2 as tables
|
|
from netbox.tables import NetBoxTable, columns
|
|
|
|
from . import hardware
|
|
from .models import CPUModel, DeviceHardware
|
|
|
|
|
|
class ClockColumn(tables.Column):
|
|
def render(self, value):
|
|
return hardware.format_clock(value)
|
|
|
|
|
|
class MemoryColumn(tables.Column):
|
|
def render(self, value):
|
|
return hardware.format_memory(value)
|
|
|
|
|
|
class CPUModelTable(NetBoxTable):
|
|
name = tables.Column(linkify=True, verbose_name="Modell")
|
|
manufacturer = columns.ChoiceFieldColumn(verbose_name="Hersteller")
|
|
family = tables.Column(verbose_name="Familie")
|
|
cores = tables.Column(verbose_name="Kerne")
|
|
threads = tables.Column(verbose_name="Threads")
|
|
base_clock_ghz = ClockColumn(verbose_name="Basistakt")
|
|
boost_clock_ghz = ClockColumn(verbose_name="Turbo")
|
|
tdp_watts = tables.Column(verbose_name="TDP (W)")
|
|
socket = tables.Column(verbose_name="Sockel")
|
|
launch_year = tables.Column(verbose_name="Jahr")
|
|
max_sockets = tables.Column(verbose_name="Max. Sockel")
|
|
builtin = columns.BooleanColumn(verbose_name="Katalog")
|
|
device_count = columns.LinkedCountColumn(
|
|
viewname="plugins:netbox_utilities:devicehardware_list",
|
|
url_params={"cpu_id": "pk"},
|
|
verbose_name="Geräte",
|
|
)
|
|
tags = columns.TagColumn(url_name="plugins:netbox_utilities:cpumodel_list")
|
|
|
|
class Meta(NetBoxTable.Meta):
|
|
model = CPUModel
|
|
fields = (
|
|
"pk",
|
|
"id",
|
|
"name",
|
|
"manufacturer",
|
|
"family",
|
|
"cores",
|
|
"threads",
|
|
"base_clock_ghz",
|
|
"boost_clock_ghz",
|
|
"tdp_watts",
|
|
"socket",
|
|
"launch_year",
|
|
"max_sockets",
|
|
"builtin",
|
|
"device_count",
|
|
"description",
|
|
"tags",
|
|
"created",
|
|
"last_updated",
|
|
)
|
|
default_columns = (
|
|
"name",
|
|
"family",
|
|
"cores",
|
|
"threads",
|
|
"base_clock_ghz",
|
|
"boost_clock_ghz",
|
|
"socket",
|
|
"launch_year",
|
|
"device_count",
|
|
)
|
|
|
|
|
|
class DeviceHardwareTable(NetBoxTable):
|
|
device = tables.Column(linkify=True, verbose_name="Gerät")
|
|
cluster = tables.Column(accessor=tables.A("device__cluster"), linkify=True, verbose_name="Cluster")
|
|
cpu = tables.Column(linkify=True, verbose_name="CPU-Modell")
|
|
cpu_count = tables.Column(verbose_name="CPUs")
|
|
total_cores = tables.Column(verbose_name="Kerne", orderable=False)
|
|
total_threads = tables.Column(verbose_name="Threads", orderable=False)
|
|
memory_gb = MemoryColumn(verbose_name="RAM")
|
|
memory_type = columns.ChoiceFieldColumn(verbose_name="RAM-Typ")
|
|
memory_detail = tables.Column(verbose_name="Bestückung", orderable=False)
|
|
comments = columns.MarkdownColumn()
|
|
tags = columns.TagColumn(url_name="plugins:netbox_utilities:devicehardware_list")
|
|
|
|
class Meta(NetBoxTable.Meta):
|
|
model = DeviceHardware
|
|
fields = (
|
|
"pk",
|
|
"id",
|
|
"device",
|
|
"cluster",
|
|
"cpu",
|
|
"cpu_count",
|
|
"total_cores",
|
|
"total_threads",
|
|
"memory_gb",
|
|
"memory_type",
|
|
"memory_modules",
|
|
"memory_module_gb",
|
|
"memory_speed_mts",
|
|
"memory_detail",
|
|
"description",
|
|
"comments",
|
|
"tags",
|
|
"created",
|
|
"last_updated",
|
|
)
|
|
default_columns = (
|
|
"device",
|
|
"cluster",
|
|
"cpu",
|
|
"cpu_count",
|
|
"total_cores",
|
|
"total_threads",
|
|
"memory_gb",
|
|
"memory_detail",
|
|
)
|