Project

General

Profile

Actions

Feature #1344

open

Hardware/Inventarisierung: Masterplan

Added by Simon Rettberg about 4 years ago. Updated almost 3 years ago.

Status:
In Progress
Priority:
Normal
Start date:
03/19/2020
Due date:
07/01/2020 (over 3 years late)
% Done:

82%

Estimated time:
(Total: 20.00 h)

Description

Oberticket für die Vereinheitlichung des ganzen.

Plan: Auf dem Client einen Datenreichtum in JSON-Form erzeugen. Das möglichst so, dass nicht selber mit bash JSON zusammengemüllt wird, sondern Tools verwendet werden die JSON können, oder Tools verwendet werden, die eine andere Form maschinenlesbar/parsbar als Ausgabe haben, die dann in JSON tansformiert werden kann.


Subtasks 7 (5 open2 closed)

Feature #1345: smartctl JSONFeedbackSimon Rettberg03/19/2020

Actions
Feature #1346: dmidecodeClosedJannik Schönartz03/19/202007/01/2020

Actions
Feature #1347: Festplattenpartitionierung als JSONFeedbackSimon Rettberg03/19/2020

Actions
Feature #1348: lspci als JSONFeedbackSimon Rettberg03/19/2020

Actions
Feature #1349: Bildschirme als JSONFeedbackSimon Rettberg03/19/2020

Actions
Feature #1350: Netzwerkkarten InventarisierungNewBAS-Crew03/20/202005/29/2020

Actions
Feature #1357: lshw als JSONRejectedBAS-Crew04/08/2020

Actions
Actions #1

Updated by Dirk von Suchodoletz about 4 years ago

Das Ganze korrespondiert auch mit diesem Ticket -> https://git.bwcloud.uni-freiburg.de/idoit/idoit-organisation/issues/39

Actions #2

Updated by Simon Rettberg about 4 years ago

  • Tracker changed from Bug to Feature
Actions #3

Updated by Simon Rettberg about 4 years ago

  • Assignee set to BAS-Crew
Actions #4

Updated by Dirk von Suchodoletz almost 4 years ago

  • Assignee changed from BAS-Crew to Jannik Schönartz

Es wird wohl erstmal auf Bash (oder andere geeignete (Skript-)Sprache) hinauslaufen müssen, da die Alternativen nix taugen oder noch nicht so weit sind ... Dabei wäre die Idee, dass das Ganze nicht sofort beim Booten passiert, sondern mit leichter Verzögerung (z.B. 5 Minuten, das kann man gut mit einem Systemd-Timer regeln). Ebenso sollte aus dem Skript heraus ein Push in die verschiedenen Zielsysteme (BAS, SAT, ...) erfolgen.

Actions #5

Updated by Jannik Schönartz almost 4 years ago

Benötigte Tools (bisher):
python 3
python 3 lib dmiparser
dmidecode
smartmontools ab Version 7.0 (smartctl --json)
sfdisk
lspci

+ Tools für Bildschirme (Edid) und Netzwerkkarten

Wo soll ich denn dann mal das Python Skript hinpacken, dass die Daten sammelt?
(Bisher nur dmidecode aber rest kommt noch)

Actions #6

Updated by Jannik Schönartz over 3 years ago

Das Python script liegt aktuell im Git vom Minilinux in einem eigenen bas branch.
Python Daten Sammel Script

Actions #7

Updated by Jannik Schönartz over 3 years ago

Ich habe jetzt mal noch ein Fallback für IP- und MAC-Addresse hinzugefügt commit.
lshw habe ich einfach mal noch drin gelassen.
Hier sind mal Beispiel-Outputs, die das script erzeugt hat.

Example Output collect_hw_info_json.py

Arbeitsrechner Jannik ...

Bei dem Windows-Pool-PC war sowohl die smartctl Version zu alt (6.6, erst ab 7 gibts --json) als auch kein lshw drauf.

Windows-Pool-PC (10.21.9.101) ...

Actions #8

Updated by Dirk von Suchodoletz over 3 years ago

  • Status changed from New to In Progress

Das mit den Versionen: Für die Pool-PCs sollte sich das recht einfach machen lassen, eine neuere Version zu installieren. Ließe sich das für die Compute-Systeme (CentOS, Cloud, HPC) halbwegs problemlos kompilieren?

Actions #9

Updated by Jannik Schönartz almost 3 years ago

Requirements for the hw-collection script


Required programs:
  • dmidecode 3.0+
  • iproute2 4.14.0+ (ip --json)
  • pciutils 3+ (lspci -mmn)
  • python 3.7+
  • smartmontools 7+ (smartctl --json)
  • util-linux 2.27.rc1+ (sfdisk --json && lsblk --json -b --output-all)
  • (lshw)
  • Benutzte default Python libs:
Files: (https://git.openslx.org/openslx-ng/systemd-init.git/tree/modules.d/bas-hw-collect/scripts?h=bas)
  • collect_hw_info_json.py
  • dmiparser.py

Usage:

usage: collect_hw_info_json.py [-h] [-d] [-u URL] [-uu UUIDURL] [-p] [-l LOCATION] [-s SLOT] [-b BAY] [-c CONTACT] [-n NAME] [-S]

Collects hardware data from different tools and returns it as json.

optional arguments:
  -h, --help            show this help message and exit
  -d, --debug           Prints all STDERR messages. (Non critical included)
  -u URL, --url URL     [multiple] If given, a post request with the generated JSON is sent to the given URLs
  -uu UUIDURL,
    --uuidurl UUIDURL   [multiple] Same as -u but UUID in the url is replaced with the actual uuid of the client
  -p, --print           Prints the generated JSON
  -l LOCATION,
    --location LOCATION Room-/Rackname where the client is located
  -s SLOT, --slot SLOT  The slot number (int) where the client is located in the rack
  -b BAY, --bay BAY     The bay number (int) where the client is located in the slot (segment)
  -c CONTACT,
    --contact CONTACT   [multiple] The idoit_username of the person responsible for this machine
  -n NAME, --name NAME  Name of the client
  -S, --SERVER          Defines the type of the client to be a server

Ein Beispiel-Call wäre also:

sudo python3 collect_hw_info_json.py -u https://bas.intra.uni-freiburg.de:7000/api/registration/clients -c js1456 -n TestClient

Ihr könnt auch erstmal -u weglassen und das outputjson mit -p printen.
Für den BAS muss, wenn das Objekt bereits existiert, zum Updaten an die URL noch die /UUID gehängt werden.


Server

Für Server gibt es noch die zusätzlichen Optionen
  • -l für die location (Rackname) z.B. Knuerr_2.3.7
  • -s für den slot z.B. 42
  • -b für den bay z.B. 0
  • -S damit der Type Server gesetzt wird. Sonst wird es im idoit als normaler Client erstellt

Ein call für das hinzufügen eines Server wäre dann also so:

sudo python3 collect_hw_info_json.py -u https://bas.intra.uni-freiburg.de/api/registration/clients -S -c js1456 -n TestServer -l Knuerr_2.3.7 -s 42 -b 0


So sieht dann mal der fertige output eines normalen pool-clients aus:

Beispielouput Hiwi-Testrechner:

Actions #10

Updated by Jannik Schönartz almost 3 years ago

So, ab jetzt muss dann bei contacts der Username, welcher im iDoIT benutzt wird, angeben werden.
Ich hab den post oben drüber mal entsprechend angepasst.

So sieht der Server dann aktuell im iDoIT aus:
https://wedoit.hs-mannheim.de/index.php?objID=109887

Bis auf die Location, sieht das doch schon mal ganz gut aus.
Die Location ist dabei etwas kaputt gegangen, weil da einfach nur "44" drin stand.
Aber sehr interessant, dass er da einfach ein Rack Segment für das RZ erstellt hat.

Actions

Also available in: Atom PDF