feat: CPU & RAM per server with a catalogue of Intel and AMD server CPUs
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]>
This commit is contained in:
1 parent
8396b7c64a
commit
c8b581089c
31 files changed
+2849
-17
No files matched your search
@@ -0,0 +1,48 @@
|
||||
<div class="card">
|
||||
<h2 class="card-header d-flex align-items-center">
|
||||
<span class="me-auto"><i class="mdi mdi-chip me-1" aria-hidden="true"></i>Kapazität (CPU & RAM)</span>
|
||||
<a href="{{ hardware_list_url }}" class="btn btn-sm btn-outline-secondary">Hardware-Liste</a>
|
||||
</h2>
|
||||
{% if not rows %}
|
||||
<div class="card-body text-muted">Dem Cluster sind keine Hosts (Geräte) zugeordnet.</div>
|
||||
{% else %}
|
||||
<div class="row g-0">
|
||||
<div class="col-12 col-xl-5 border-end">
|
||||
{% include 'netbox_utilities/inc/hardware_capacity.html' %}
|
||||
</div>
|
||||
<div class="col-12 col-xl-7">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover table-sm align-middle mb-0">
|
||||
<thead>
|
||||
<tr><th>Host</th><th>CPU</th><th>Kerne / Threads</th><th>RAM</th><th>VMs</th><th>vCPU : Kern</th><th>RAM belegt</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for row in rows %}
|
||||
<tr>
|
||||
<td><a href="{{ row.device.get_absolute_url }}">{{ row.device }}</a></td>
|
||||
<td class="small">
|
||||
{% if row.record and row.record.cpu %}{{ row.record.cpu_display }}
|
||||
{% elif can_add %}<a href="{% url 'plugins:netbox_utilities:devicehardware_add' %}?device={{ row.device.pk }}&return_url={{ request.path|urlencode }}" class="text-warning">erfassen</a>
|
||||
{% else %}<span class="text-warning">fehlt</span>{% endif %}
|
||||
</td>
|
||||
<td>{% if row.host.cores %}{{ row.host.cores }} / {{ row.host.threads }}{% else %}—{% endif %}</td>
|
||||
<td>{{ row.memory }}</td>
|
||||
<td>{{ row.host.vm_count }} <span class="text-muted small">({{ row.host.vcpus|floatformat:"-1" }} vCPU, {{ row.vm_memory }})</span></td>
|
||||
<td>{{ row.vcpu_per_core }}</td>
|
||||
<td>
|
||||
{% if row.memory_percent is not None %}
|
||||
<span class="badge {% if row.memory_percent > 100 %}text-bg-danger{% elif row.memory_percent > 85 %}text-bg-warning{% else %}text-bg-success{% endif %}">{{ row.memory_percent }} %</span>
|
||||
{% else %}—{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer small text-muted">
|
||||
Gezählt werden alle VMs außer „Offline“ und „Außer Betrieb“. VMs ohne festen Host zählen nur zur Cluster-Summe.
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
@@ -0,0 +1,46 @@
|
||||
{% extends 'generic/object.html' %}
|
||||
{% load helpers %}
|
||||
{% load render_table from django_tables2 %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row mb-3">
|
||||
<div class="col col-12 col-xl-6">
|
||||
<div class="card">
|
||||
<h2 class="card-header">CPU-Modell</h2>
|
||||
<table class="table table-hover attr-table">
|
||||
<tr><th scope="row">Hersteller</th><td>{{ object.get_manufacturer_display }}</td></tr>
|
||||
<tr><th scope="row">Modell</th><td>{{ object.name }}</td></tr>
|
||||
<tr><th scope="row">Familie</th><td>{{ object.family|placeholder }}</td></tr>
|
||||
<tr><th scope="row">Sockel</th><td>{{ object.socket|placeholder }}</td></tr>
|
||||
<tr><th scope="row">Erscheinungsjahr</th><td>{{ object.launch_year|placeholder }}</td></tr>
|
||||
<tr><th scope="row">Max. Sockel</th><td>{{ object.max_sockets }}</td></tr>
|
||||
<tr><th scope="row">Beschreibung</th><td>{{ object.description|placeholder }}</td></tr>
|
||||
<tr>
|
||||
<th scope="row">Herkunft</th>
|
||||
<td>
|
||||
{% if object.builtin %}Katalog{% if object.customized %} <span class="badge text-bg-warning">angepasst</span>{% endif %}
|
||||
{% else %}Selbst angelegt{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
{% include 'inc/panels/tags.html' %}
|
||||
{% include 'inc/panels/custom_fields.html' %}
|
||||
</div>
|
||||
<div class="col col-12 col-xl-6">
|
||||
<div class="card">
|
||||
<h2 class="card-header">Leistung</h2>
|
||||
<table class="table table-hover attr-table">
|
||||
<tr><th scope="row">Kerne</th><td>{{ object.cores }}</td></tr>
|
||||
<tr><th scope="row">Threads</th><td>{{ object.threads }}</td></tr>
|
||||
<tr><th scope="row">Takt (Basis / Turbo)</th><td>{{ object.clock_display }}</td></tr>
|
||||
<tr><th scope="row">TDP</th><td>{% if object.tdp_watts %}{{ object.tdp_watts }} W{% else %}{{ ""|placeholder }}{% endif %}</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card">
|
||||
<h2 class="card-header">Geräte mit diesem Modell <span class="badge text-bg-secondary">{{ device_count }}</span></h2>
|
||||
<div class="table-responsive">{% render_table devices_table 'inc/table.html' %}</div>
|
||||
</div>
|
||||
{% endblock content %}
|
||||
@@ -0,0 +1,24 @@
|
||||
<div class="card">
|
||||
<h2 class="card-header d-flex align-items-center">
|
||||
<span class="me-auto"><i class="mdi mdi-chip me-1" aria-hidden="true"></i>CPU & RAM</span>
|
||||
{% if record and can_change %}
|
||||
<a href="{% url 'plugins:netbox_utilities:devicehardware_edit' pk=record.pk %}?return_url={{ request.path|urlencode }}" class="btn btn-sm btn-outline-secondary">
|
||||
<i class="mdi mdi-pencil" aria-hidden="true"></i> Bearbeiten
|
||||
</a>
|
||||
{% elif not record and can_add %}
|
||||
<a href="{{ add_url }}" class="btn btn-sm btn-primary"><i class="mdi mdi-plus-thick" aria-hidden="true"></i> Erfassen</a>
|
||||
{% endif %}
|
||||
</h2>
|
||||
{% if record %}
|
||||
{% include 'netbox_utilities/inc/hardware_record.html' %}
|
||||
{% else %}
|
||||
<div class="card-body text-muted">Noch keine CPU und kein RAM erfasst.</div>
|
||||
{% endif %}
|
||||
{% if capacity %}
|
||||
<h3 class="card-header border-top h5 d-flex align-items-center">
|
||||
<span class="me-auto">Virtualisierung</span>
|
||||
<a href="{{ vm_list_url }}" class="btn btn-sm btn-outline-secondary">VMs anzeigen</a>
|
||||
</h3>
|
||||
{% include 'netbox_utilities/inc/hardware_capacity.html' %}
|
||||
{% endif %}
|
||||
</div>
|
||||
@@ -0,0 +1,31 @@
|
||||
{% extends 'generic/object.html' %}
|
||||
{% load helpers %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row mb-3">
|
||||
<div class="col col-12 col-xl-6">
|
||||
<div class="card">
|
||||
<h2 class="card-header">Gerät</h2>
|
||||
<table class="table table-hover attr-table mb-0">
|
||||
<tr><th scope="row">Gerät</th><td>{{ object.device|linkify }}</td></tr>
|
||||
<tr><th scope="row">Cluster</th><td>{{ object.device.cluster|linkify|placeholder }}</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="card">
|
||||
<h2 class="card-header">CPU & RAM</h2>
|
||||
{% include 'netbox_utilities/inc/hardware_record.html' with record=object %}
|
||||
</div>
|
||||
{% include 'inc/panels/tags.html' %}
|
||||
{% include 'inc/panels/custom_fields.html' %}
|
||||
{% include 'inc/panels/comments.html' %}
|
||||
</div>
|
||||
<div class="col col-12 col-xl-6">
|
||||
{% if capacity %}
|
||||
<div class="card">
|
||||
<h2 class="card-header">Virtualisierung</h2>
|
||||
{% include 'netbox_utilities/inc/hardware_capacity.html' %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock content %}
|
||||
@@ -0,0 +1,44 @@
|
||||
{# Capacity of one host or a whole cluster versus its VMs; expects the context of hardware_views.capacity_context. #}
|
||||
{% for level, text in capacity_warnings %}
|
||||
<div class="alert alert-{{ level }} py-2 mb-2 small"><i class="mdi mdi-alert" aria-hidden="true"></i> {{ text }}</div>
|
||||
{% endfor %}
|
||||
<table class="table table-hover attr-table mb-0">
|
||||
<tr>
|
||||
<th scope="row">Physisch</th>
|
||||
<td>
|
||||
{% if capacity.cores %}{{ capacity.cores }} Kerne / {{ capacity.threads }} Threads{% else %}<span class="text-muted">—</span>{% endif %}
|
||||
· {{ memory }} RAM
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">VMs</th>
|
||||
<td>
|
||||
{{ capacity.vm_count }} VM{{ capacity.vm_count|pluralize:",s" }} · {{ capacity.vcpus|floatformat:"-1" }} vCPUs · {{ vm_memory }} RAM
|
||||
{% if capacity.unplaced_vm_count %}<div class="small text-muted">davon {{ capacity.unplaced_vm_count }} ohne festen Host</div>{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">vCPU : Kern</th>
|
||||
<td>{{ vcpu_per_core }} <span class="text-muted small">({{ vcpu_per_thread }} je Thread)</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">RAM zugewiesen</th>
|
||||
<td>
|
||||
{% if capacity.memory_percent is not None %}
|
||||
<div class="progress" role="progressbar" aria-valuenow="{{ capacity.memory_percent }}" aria-valuemin="0" aria-valuemax="100" style="height: 1.1rem">
|
||||
<div class="progress-bar {% if capacity.memory_percent > 100 %}bg-danger{% elif capacity.memory_percent > 85 %}bg-warning{% else %}bg-success{% endif %}"
|
||||
style="width: {% if capacity.memory_percent > 100 %}100{% else %}{{ capacity.memory_percent }}{% endif %}%">{{ capacity.memory_percent }} %</div>
|
||||
</div>
|
||||
{% else %}<span class="text-muted">—</span>{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% if capacity.failover_memory_gb is not None %}
|
||||
<tr>
|
||||
<th scope="row">RAM bei Host-Ausfall</th>
|
||||
<td>
|
||||
{{ failover_memory }}
|
||||
{% if capacity.failover_ok %}<span class="badge text-bg-success">N+1 OK</span>{% else %}<span class="badge text-bg-warning">N+1 nicht erfüllt</span>{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
</table>
|
||||
@@ -0,0 +1,23 @@
|
||||
{# CPU and RAM rows of one DeviceHardware record. #}
|
||||
<table class="table table-hover attr-table mb-0">
|
||||
<tr>
|
||||
<th scope="row">CPU</th>
|
||||
<td>
|
||||
{% if record.cpu %}
|
||||
{% if record.cpu_count > 1 %}{{ record.cpu_count }} × {% endif %}<a href="{{ record.cpu.get_absolute_url }}">{{ record.cpu }}</a>
|
||||
<div class="small text-muted">{{ record.cpu.summary }}{% if record.cpu.socket %} · {{ record.cpu.socket }}{% endif %}</div>
|
||||
{% else %}<span class="text-muted">—</span>{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% if record.cpu %}
|
||||
<tr><th scope="row">Gesamt</th><td>{{ record.total_cores }} Kerne / {{ record.total_threads }} Threads</td></tr>
|
||||
{% endif %}
|
||||
<tr>
|
||||
<th scope="row">RAM</th>
|
||||
<td>
|
||||
{{ record.memory_display }}
|
||||
{% if record.memory_detail %}<div class="small text-muted">{{ record.memory_detail }}</div>{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% if record.description %}<tr><th scope="row">Beschreibung</th><td>{{ record.description }}</td></tr>{% endif %}
|
||||
</table>
|
||||
@@ -0,0 +1,29 @@
|
||||
<div class="card">
|
||||
<h2 class="card-header"><i class="mdi mdi-chip me-1" aria-hidden="true"></i>Host-Hardware</h2>
|
||||
{% if not records %}
|
||||
<div class="card-body text-muted">
|
||||
{% if device %}Für den Host <a href="{{ device.get_absolute_url }}">{{ device }}</a> ist noch keine CPU erfasst.
|
||||
{% else %}Die VM hat keinen Host und ihr Cluster keine Hosts mit erfasster CPU.{% endif %}
|
||||
</div>
|
||||
{% else %}
|
||||
<table class="table table-hover attr-table mb-0">
|
||||
<tr>
|
||||
<th scope="row">{% if device %}Host{% else %}Cluster-Hosts{% endif %}</th>
|
||||
<td>
|
||||
{% for record in records %}<a href="{{ record.device.get_absolute_url }}">{{ record.device }}</a>{% if not forloop.last %}, {% endif %}{% endfor %}
|
||||
</td>
|
||||
</tr>
|
||||
<tr><th scope="row">CPU</th><td>{{ cpus|join:", "|default:"—" }}</td></tr>
|
||||
{% if smallest_threads %}
|
||||
<tr>
|
||||
<th scope="row">vCPUs</th>
|
||||
<td>
|
||||
{{ vcpus|floatformat:"-1"|default:"—" }} von {{ smallest_threads }} Threads{% if not device %} (kleinster Host){% endif %}
|
||||
{% if vcpu_share is not None %}<span class="text-muted small">· {{ vcpu_share }} %</span>{% endif %}
|
||||
{% if oversized %}<div class="text-danger small">Die VM hat mehr vCPUs, als der Host Threads hat.</div>{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
</table>
|
||||
{% endif %}
|
||||
</div>
|
||||
Reference in new issue
Block a user