Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a796b92056 | ||
|
|
5514c974f1 |
No files matched your search
@@ -18,7 +18,7 @@ Before exporting, the technician selects which content the document contains:
|
|||||||
| Group | Content |
|
| Group | Content |
|
||||||
|---|---|
|
|---|---|
|
||||||
| General | Overview & site data (address, location tree, key figures), contacts |
|
| General | Overview & site data (address, location tree, key figures), contacts |
|
||||||
| Infrastructure | Racks by site → location with rack elevation (front/rear, optionally with device images as in NetBox) and occupancy list, devices by **selectable device roles** (servers, switches, APs, routers …) with **selectable columns**, power, VMs |
|
| Infrastructure | Racks by site → location with rack elevation (front/rear, optionally with device images as in NetBox) and occupancy list, devices by **selectable device roles** (servers, switches, APs, routers …) with **selectable columns**, power, VMs, **disks & RAID** from [Netbox-Utilities](https://git.mrblake.cc/MrBlake/Netbox-Utilities) (if installed) |
|
||||||
| Network | VRFs (incl. RTs), prefixes by VRF, VLANs, IP addresses (detailed), WLANs/SSIDs, circuits, **network topology** |
|
| Network | VRFs (incl. RTs), prefixes by VRF, VLANs, IP addresses (detailed), WLANs/SSIDs, circuits, **network topology** |
|
||||||
| Contracts & licenses | Licenses from [NetBox-SLM](https://git.mrblake.cc/MrBlake/NetBox-SLM) (detected automatically) or another license plugin (e.g. `netbox-lifecycle`) |
|
| Contracts & licenses | Licenses from [NetBox-SLM](https://git.mrblake.cc/MrBlake/NetBox-SLM) (detected automatically) or another license plugin (e.g. `netbox-lifecycle`) |
|
||||||
|
|
||||||
@@ -285,6 +285,15 @@ days before expiry, *expired*, *perpetual*), support, installation and tenant.
|
|||||||
The **license key** only appears with the "Export secrets" option (requires
|
The **license key** only appears with the "Export secrets" option (requires
|
||||||
`allow_secrets: True`). Additionally configured `license_sources` are still output.
|
`allow_secrets: True`). Additionally configured `license_sources` are still output.
|
||||||
|
|
||||||
|
### Disks & RAID (Netbox-Utilities)
|
||||||
|
|
||||||
|
If [Netbox-Utilities](https://git.mrblake.cc/MrBlake/Netbox-Utilities) with disk management is installed, the
|
||||||
|
**Disks & RAID** section (off by default) lists for each device in scope: occupied slots, raw capacity, hot spares and
|
||||||
|
failed disks, the RAID groups (level, count, usable capacity, fault tolerance) and a table of all installed disks with
|
||||||
|
slot, status, type, model, size, serial number, firmware, RAID group, warranty and warnings (failed, warranty
|
||||||
|
expired/expiring soon, too old – thresholds from the Utilities configuration). Removed disks (history) are not shown.
|
||||||
|
Without the plugin the section stays empty.
|
||||||
|
|
||||||
### Rack elevations
|
### Rack elevations
|
||||||
|
|
||||||
By default the plugin uses NetBox's own `dcim.svg.RackElevationSVG` in-process
|
By default the plugin uses NetBox's own `dcim.svg.RackElevationSVG` in-process
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ class CustomerExportConfig(PluginConfig):
|
|||||||
name = "netbox_customer_export"
|
name = "netbox_customer_export"
|
||||||
verbose_name = "Kunden-Export"
|
verbose_name = "Kunden-Export"
|
||||||
description = "Kundendokumentation als PDF oder Word exportieren"
|
description = "Kundendokumentation als PDF oder Word exportieren"
|
||||||
version = "0.9.0"
|
version = "0.10.0"
|
||||||
author = "Claude"
|
author = "Claude"
|
||||||
base_url = "customer-export"
|
base_url = "customer-export"
|
||||||
min_version = "4.6.8"
|
min_version = "4.6.8"
|
||||||
|
|||||||
@@ -0,0 +1,100 @@
|
|||||||
|
"""Datenträger und RAID-Gruppen aus dem Plugin Netbox-Utilities (netbox_utilities.Disk)."""
|
||||||
|
from django.apps import apps
|
||||||
|
|
||||||
|
from .blocks import EMPTY, H, KV, T
|
||||||
|
|
||||||
|
ACTIVE_STATUSES = ("active", "spare", "failed", "planned") # ohne „ausgebaut/ersetzt“
|
||||||
|
|
||||||
|
|
||||||
|
def is_installed():
|
||||||
|
if not apps.is_installed("netbox_utilities"):
|
||||||
|
return False
|
||||||
|
try:
|
||||||
|
apps.get_model("netbox_utilities", "Disk")
|
||||||
|
except LookupError: # ältere Version ohne Datenträger
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
def _helpers():
|
||||||
|
from netbox_utilities import disks
|
||||||
|
|
||||||
|
return disks
|
||||||
|
|
||||||
|
|
||||||
|
def _date(value):
|
||||||
|
return value.strftime("%d.%m.%Y") if value else None
|
||||||
|
|
||||||
|
|
||||||
|
def _slot(disk):
|
||||||
|
bay = disk.bay.name if disk.bay_id and disk.device.netbox_utilities_disk_bays.count() > 1 else ""
|
||||||
|
return f"{bay} {disk.slot}".strip()
|
||||||
|
|
||||||
|
|
||||||
|
def disk_blocks(scope, opts):
|
||||||
|
"""Je Gerät: Kennzahlen, RAID-Gruppen und Datenträger. Leer, wenn keine Datenträger im Scope."""
|
||||||
|
Disk = apps.get_model("netbox_utilities", "Disk")
|
||||||
|
RAIDGroup = apps.get_model("netbox_utilities", "RAIDGroup")
|
||||||
|
DiskBayLayout = apps.get_model("netbox_utilities", "DiskBayLayout")
|
||||||
|
helpers = _helpers()
|
||||||
|
fmt = helpers.format_capacity
|
||||||
|
warn_cfg = helpers.warning_settings()
|
||||||
|
|
||||||
|
disks = list(
|
||||||
|
scope.restrict(Disk.objects.filter(device__in=scope.devices(), status__in=ACTIVE_STATUSES))
|
||||||
|
.select_related("device", "bay", "raid_group")
|
||||||
|
.order_by("device__name", "bay__weight", "bay__name", "slot")
|
||||||
|
)
|
||||||
|
if not disks:
|
||||||
|
return []
|
||||||
|
|
||||||
|
by_device = {}
|
||||||
|
for disk in disks:
|
||||||
|
by_device.setdefault(disk.device, []).append(disk)
|
||||||
|
|
||||||
|
headers = ["Steckplatz", "Status", "Typ", "Hersteller / Modell", "Größe", "Seriennummer", "Firmware", "RAID", "Garantie bis", "Hinweise"]
|
||||||
|
blocks = []
|
||||||
|
for device, items in by_device.items():
|
||||||
|
slots = sum(b.slot_count for b in DiskBayLayout.objects.filter(device=device))
|
||||||
|
summary = helpers.disk_summary(items, slots)
|
||||||
|
blocks.append(H(2, device.name or str(device)))
|
||||||
|
blocks.append(KV([
|
||||||
|
("Steckplätze belegt", f"{summary['used']} / {slots}" if slots else summary["used"]),
|
||||||
|
("Rohkapazität", fmt(summary["raw_capacity_gb"])),
|
||||||
|
("Hot Spares", summary["spares"]),
|
||||||
|
("Defekt", summary["failed"]),
|
||||||
|
]))
|
||||||
|
|
||||||
|
groups = list(RAIDGroup.objects.filter(device=device).order_by("name"))
|
||||||
|
if groups:
|
||||||
|
rows = []
|
||||||
|
for group in groups:
|
||||||
|
members = [d for d in items if d.raid_group_id == group.pk and d.status in ("active", "failed")]
|
||||||
|
usable, tolerated, _err = helpers.raid_usable_capacity(group.level, [d.capacity_gb for d in members], group.spans)
|
||||||
|
rows.append([
|
||||||
|
group.name,
|
||||||
|
group.get_level_display(),
|
||||||
|
len(members),
|
||||||
|
fmt(usable) if usable else EMPTY,
|
||||||
|
tolerated if tolerated is not None else EMPTY,
|
||||||
|
group.description,
|
||||||
|
])
|
||||||
|
blocks.append(T(["RAID-Gruppe", "Level", "Datenträger", "Nutzbar", "Ausfalltoleranz", "Beschreibung"], rows))
|
||||||
|
|
||||||
|
rows = []
|
||||||
|
for d in items:
|
||||||
|
hints = "\n".join(text for _lvl, text in helpers.disk_warnings(d, **warn_cfg))
|
||||||
|
rows.append([
|
||||||
|
_slot(d),
|
||||||
|
d.get_status_display(),
|
||||||
|
" / ".join(x for x in (d.get_disk_type_display(), d.get_interface_display()) if x),
|
||||||
|
" ".join(x for x in (d.manufacturer, d.model) if x),
|
||||||
|
fmt(d.capacity_gb) if d.capacity_gb else None,
|
||||||
|
d.serial,
|
||||||
|
d.firmware,
|
||||||
|
d.raid_group,
|
||||||
|
_date(d.warranty_end),
|
||||||
|
hints,
|
||||||
|
])
|
||||||
|
blocks.append(T(headers, rows))
|
||||||
|
return blocks
|
||||||
@@ -253,6 +253,17 @@ def devices(scope, opts):
|
|||||||
return blocks if found else _empty(opts, blocks)
|
return blocks if found else _empty(opts, blocks)
|
||||||
|
|
||||||
|
|
||||||
|
@section("disks", "Datenträger & RAID", "Infrastruktur", default=False, hint="Aus Netbox-Utilities (falls installiert)")
|
||||||
|
def disks(scope, opts):
|
||||||
|
from . import disks_utilities
|
||||||
|
|
||||||
|
blocks = [H(1, "Datenträger & RAID")]
|
||||||
|
if not disks_utilities.is_installed():
|
||||||
|
return _empty(opts, blocks, "Netbox-Utilities mit Datenträger-Verwaltung ist nicht installiert – siehe README.")
|
||||||
|
blocks += disks_utilities.disk_blocks(scope, opts)
|
||||||
|
return blocks if len(blocks) > 1 else _empty(opts, blocks)
|
||||||
|
|
||||||
|
|
||||||
@section("power", "Stromversorgung", "Infrastruktur", default=False, hint="Power Panels & Feeds")
|
@section("power", "Stromversorgung", "Infrastruktur", default=False, hint="Power Panels & Feeds")
|
||||||
def power(scope, opts):
|
def power(scope, opts):
|
||||||
qs = scope.power_feeds().select_related("power_panel", "rack").order_by("power_panel__name", "name")
|
qs = scope.power_feeds().select_related("power_panel", "rack").order_by("power_panel__name", "name")
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "netbox-customer-export"
|
name = "netbox-customer-export"
|
||||||
version = "0.9.0"
|
version = "0.10.0"
|
||||||
description = "NetBox-Plugin: Kundendokumentation (PDF/Word) für Standorte, Lokationen, Mandanten und Mandantengruppen"
|
description = "NetBox-Plugin: Kundendokumentation (PDF/Word) für Standorte, Lokationen, Mandanten und Mandantengruppen"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.10"
|
requires-python = ">=3.10"
|
||||||
|
|||||||
Reference in new issue
Block a user