second
This commit is contained in:
23
Makefile
Normal file
23
Makefile
Normal file
@@ -0,0 +1,23 @@
|
||||
# Makefile pour bench-client
|
||||
|
||||
BINARY_NAME=bench-client
|
||||
VERSION=1.0.0
|
||||
LDFLAGS=-ldflags "-X main.version=$(VERSION) -s -w"
|
||||
|
||||
.PHONY: all build clean run
|
||||
|
||||
all: clean build
|
||||
|
||||
build:
|
||||
@echo "Compilation Linux AMD64 statique..."
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a $(LDFLAGS) -o $(BINARY_NAME) main.go
|
||||
@echo "Terminé : ./$(BINARY_NAME)"
|
||||
|
||||
clean:
|
||||
@echo "Nettoyage..."
|
||||
@rm -f $(BINARY_NAME)
|
||||
@go clean
|
||||
|
||||
run: build
|
||||
@echo "Lancement test..."
|
||||
sudo ./$(BINARY_NAME) --dry-run --debug
|
||||
BIN
bench-client
Executable file
BIN
bench-client
Executable file
Binary file not shown.
902
bench_payload_last.json
Executable file
902
bench_payload_last.json
Executable file
File diff suppressed because one or more lines are too long
497
config.yaml
Normal file
497
config.yaml
Normal file
@@ -0,0 +1,497 @@
|
||||
# bench-client config.yaml
|
||||
# Objectif: décrire précisément
|
||||
# - les outils à utiliser (et exigences d'installation)
|
||||
# - les informations à collecter
|
||||
# - les benchmarks à exécuter
|
||||
# - les paramètres (timeouts, limites, endpoints, debug)
|
||||
#
|
||||
# Le binaire (Go/Rust) charge ce fichier depuis HTTP(S), valide les bornes, applique des defaults sûrs,
|
||||
# et peut fallback sur une config locale si indisponible.
|
||||
|
||||
config_version: 1
|
||||
profile: default
|
||||
|
||||
backend:
|
||||
# URL finale du POST (le programme peut aussi accepter server_base_url + path)
|
||||
url: "http://10.0.0.50:8007/api/benchmark"
|
||||
# Auth: idéalement injecté par variable d'env sur le client; éviter de mettre le token dans la config distante.
|
||||
auth:
|
||||
mode: bearer_env
|
||||
env_var: "test_hardware_perf"
|
||||
http:
|
||||
timeout_s: 15
|
||||
retries: 2
|
||||
retry_backoff_s: 2
|
||||
tls:
|
||||
verify: true
|
||||
|
||||
remote_config:
|
||||
# Options de cache/ETag si le binaire gère le rafraîchissement
|
||||
cache_path: "/var/cache/bench-client/config.yaml"
|
||||
use_etag: true
|
||||
refresh_max_age_s: 86400
|
||||
|
||||
runtime:
|
||||
# Timeouts globaux de sécurité
|
||||
max_total_runtime_s: 480
|
||||
command_timeout_s: 30
|
||||
command_timeout_overrides:
|
||||
dmidecode_s: 20
|
||||
smartctl_s: 10
|
||||
lsblk_s: 10
|
||||
sysbench_cpu_s: 120
|
||||
sysbench_mem_s: 60
|
||||
fio_s: 120
|
||||
iperf3_s: 20
|
||||
temp_dir: "/tmp"
|
||||
locale: "C"
|
||||
path_prepend:
|
||||
- "/usr/sbin"
|
||||
- "/sbin"
|
||||
|
||||
logging:
|
||||
level: info # trace|debug|info|warn|error
|
||||
progress: true # affichage étapes (1/N) + items
|
||||
show_command_lines: false
|
||||
capture_raw_output: true # remonte dans raw_info (attention taille)
|
||||
raw_output_max_kb: 5120
|
||||
save_payload_to_tmp: true
|
||||
payload_tmp_dir: "/tmp"
|
||||
payload_filename_prefix: "bench_payload_"
|
||||
interactive_pause_on_debug: true
|
||||
|
||||
payload:
|
||||
dir: "."
|
||||
prefix: "bench_payload_"
|
||||
always_save: true
|
||||
|
||||
device_identity:
|
||||
# device_identifier envoyé au backend
|
||||
prefer:
|
||||
- hostname
|
||||
- machine_id
|
||||
hostname_command: "hostname"
|
||||
machine_id_path: "/etc/machine-id"
|
||||
|
||||
dependencies:
|
||||
# Liste des programmes externes (installés par le script shell)
|
||||
# Le binaire doit pouvoir:
|
||||
# - détecter présence/version (optionnel)
|
||||
# - marquer chaque "feature" comme disponible ou non
|
||||
required_base:
|
||||
- name: "curl"
|
||||
purpose: "Téléchargements/diagnostics (souvent côté script)"
|
||||
- name: "jq"
|
||||
purpose: "Optionnel: debug/validation (souvent côté script, pas nécessaire au binaire)"
|
||||
- name: "lscpu"
|
||||
purpose: "Infos CPU"
|
||||
- name: "free"
|
||||
purpose: "Infos mémoire"
|
||||
- name: "lsblk"
|
||||
purpose: "Infos stockage/partitions"
|
||||
- name: "ip"
|
||||
purpose: "Interfaces réseau, adresses IP"
|
||||
- name: "bc"
|
||||
purpose: "Optionnel: calculs (si pas fait en code)"
|
||||
- name: "dmidecode"
|
||||
purpose: "Infos BIOS/carte mère/RAM/DMI"
|
||||
requires_root: true
|
||||
- name: "smartctl"
|
||||
package: "smartmontools"
|
||||
purpose: "Infos disques SMART"
|
||||
requires_root: true
|
||||
- name: "ethtool"
|
||||
purpose: "Vitesse réseau, Wake-on-LAN, driver"
|
||||
requires_root: true
|
||||
- name: "lspci"
|
||||
package: "pciutils"
|
||||
purpose: "Liste périphériques PCI (GPU/Audio/etc.)"
|
||||
- name: "lsusb"
|
||||
package: "usbutils"
|
||||
purpose: "Liste périphériques USB"
|
||||
- name: "aplay"
|
||||
package: "alsa-utils"
|
||||
purpose: "Inventaire audio ALSA"
|
||||
- name: "arecord"
|
||||
package: "alsa-utils"
|
||||
purpose: "Inventaire capture ALSA"
|
||||
- name: "pactl"
|
||||
package: "pulseaudio-utils"
|
||||
purpose: "Infos audio PulseAudio/PipeWire (si dispo)"
|
||||
- name: "iw"
|
||||
package: "iw"
|
||||
purpose: "SSID + bitrate Wi-Fi"
|
||||
- name: "loginctl"
|
||||
package: "systemd"
|
||||
purpose: "Type de session (x11/wayland/tty)"
|
||||
- name: "xrandr"
|
||||
package: "x11-xserver-utils"
|
||||
purpose: "Résolution écran (X11)"
|
||||
- name: "xdpyinfo"
|
||||
package: "x11-utils"
|
||||
purpose: "Résolution écran (fallback X11)"
|
||||
- name: "swaymsg"
|
||||
package: "sway"
|
||||
purpose: "Résolution écran (Wayland/Sway)"
|
||||
- name: "nvidia-smi"
|
||||
package: "nvidia-utils"
|
||||
purpose: "Infos GPU NVIDIA (si présent)"
|
||||
- name: "systemd-detect-virt"
|
||||
package: "systemd"
|
||||
purpose: "Détection virtualisation/proxmox"
|
||||
- name: "pveversion"
|
||||
package: "pve-manager"
|
||||
purpose: "Détection hôte Proxmox (si présent)"
|
||||
benchmark_tools:
|
||||
- name: "sysbench"
|
||||
purpose: "Bench CPU et mémoire"
|
||||
- name: "fio"
|
||||
purpose: "Bench disque"
|
||||
- name: "iperf3"
|
||||
purpose: "Bench réseau"
|
||||
- name: "ping"
|
||||
package: "iputils-ping"
|
||||
purpose: "Vérifier accessibilité iperf server"
|
||||
- name: "nc"
|
||||
package: "netcat-openbsd"
|
||||
purpose: "Tester port 5201 iperf3"
|
||||
|
||||
collection:
|
||||
# Liste des infos à récupérer, structurées comme dans ton script.
|
||||
system:
|
||||
enabled: true
|
||||
items:
|
||||
- hostname
|
||||
- os_id
|
||||
- os_version
|
||||
- kernel_version
|
||||
- architecture
|
||||
- session_type # XDG_SESSION_TYPE / loginctl / DISPLAY / WAYLAND_DISPLAY
|
||||
- screen_resolution # xrandr/xdpyinfo/swaymsg
|
||||
- last_boot_time # who -b
|
||||
- uptime_seconds # /proc/uptime
|
||||
- battery_percentage # /sys/class/power_supply/BAT*/capacity
|
||||
- battery_status # /sys/class/power_supply/BAT*/status
|
||||
- battery_health # /sys/class/power_supply/BAT*/health ou uevent
|
||||
- virtualization # systemd-detect-virt + proxmox hints
|
||||
virtualization_detection:
|
||||
enabled: true
|
||||
proxmox:
|
||||
detect_host_by:
|
||||
- pveversion
|
||||
- "/etc/pve"
|
||||
detect_guest_by:
|
||||
- systemd_detect_virt
|
||||
- qemu_guest_agent
|
||||
- dmidecode_manufacturer_product_matches: ["qemu", "proxmox"]
|
||||
capture:
|
||||
- is_proxmox_host
|
||||
- is_proxmox_guest
|
||||
- proxmox_version
|
||||
- virtualization_type
|
||||
|
||||
cpu:
|
||||
enabled: true
|
||||
source:
|
||||
primary: lscpu
|
||||
supplement_dmidecode: true
|
||||
items:
|
||||
- vendor
|
||||
- model
|
||||
- cores_physical # cores_per_socket * sockets
|
||||
- threads # nproc
|
||||
- base_freq_ghz # lscpu CPU MHz -> GHz
|
||||
- max_freq_ghz # lscpu CPU max MHz -> GHz
|
||||
- cache_l1_kb
|
||||
- cache_l2_kb
|
||||
- cache_l3_kb
|
||||
- flags # CPU flags list
|
||||
- microarchitecture # depuis dmidecode type 4 (Family) si manquant
|
||||
raw_capture:
|
||||
- lscpu_output
|
||||
|
||||
ram:
|
||||
enabled: true
|
||||
sources:
|
||||
- free
|
||||
- dmidecode
|
||||
items:
|
||||
- total_mb
|
||||
- used_mb
|
||||
- free_mb
|
||||
- shared_mb
|
||||
- slots_total # dmidecode -t 16
|
||||
- slots_used # dmidecode -t 17
|
||||
- max_capacity_mb # dmidecode -t 16 Maximum Capacity
|
||||
- ecc # dmidecode -t memory Error Correction Type
|
||||
- layout # par slot: locator, size, type, speed, configured_speed, form_factor, type_detail, rank, manufacturer, part_number
|
||||
raw_capture:
|
||||
- dmidecode_full
|
||||
|
||||
gpu:
|
||||
enabled: true
|
||||
sources:
|
||||
- lspci
|
||||
- nvidia_smi_optional
|
||||
items:
|
||||
- vendor # NVIDIA/AMD/Intel/Unknown
|
||||
- model # lspci vga/3d ou nvidia-smi name
|
||||
- memory_dedicated_mb # nvidia-smi (si dispo)
|
||||
- driver_version # nvidia-smi (si dispo)
|
||||
|
||||
motherboard_bios:
|
||||
enabled: true
|
||||
source: dmidecode
|
||||
items:
|
||||
- baseboard_manufacturer
|
||||
- baseboard_product_name
|
||||
- bios_vendor
|
||||
- bios_version
|
||||
- bios_release_date
|
||||
|
||||
pci_devices:
|
||||
enabled: true
|
||||
source: lspci
|
||||
items:
|
||||
- slot
|
||||
- class
|
||||
- vendor
|
||||
- device
|
||||
|
||||
usb_devices:
|
||||
enabled: true
|
||||
source: lsusb
|
||||
items:
|
||||
- bus
|
||||
- device
|
||||
- vendor_id
|
||||
- product_id
|
||||
- name
|
||||
|
||||
audio:
|
||||
enabled: true
|
||||
sources:
|
||||
- lspci
|
||||
- alsa
|
||||
- pactl_optional
|
||||
items:
|
||||
hardware:
|
||||
- pci_audio_devices # lspci audio
|
||||
- alsa_playback # aplay -l
|
||||
- alsa_capture # arecord -l
|
||||
- pcm_devices # aplay -L
|
||||
software:
|
||||
- backend # pipewire/pulseaudio/alsa
|
||||
- server_name
|
||||
- server_version
|
||||
- default_sink
|
||||
- default_source
|
||||
- sinks
|
||||
- sources
|
||||
|
||||
storage:
|
||||
enabled: true
|
||||
sources:
|
||||
- lsblk
|
||||
- smartctl
|
||||
devices:
|
||||
enumerate_by: "lsblk_disks" # lsblk -d -n -o NAME,TYPE
|
||||
include_removable: false
|
||||
items:
|
||||
- device # /dev/sda
|
||||
- model # smartctl -i
|
||||
- serial # smartctl -i
|
||||
- size # lsblk
|
||||
- type # rota -> ssd/hdd
|
||||
- interface # tran
|
||||
- temperature_c # smartctl -A
|
||||
- smart_health # smartctl -H
|
||||
partitions:
|
||||
enabled: true
|
||||
source: lsblk_json
|
||||
items:
|
||||
- name
|
||||
- mount_point
|
||||
- fs_type
|
||||
- total_gb
|
||||
- used_gb
|
||||
- free_gb
|
||||
raw_capture:
|
||||
- lsblk_output
|
||||
|
||||
network_shares:
|
||||
enabled: true
|
||||
source: "/proc/mounts"
|
||||
detect_fs_types:
|
||||
- nfs
|
||||
- nfs4
|
||||
- cifs
|
||||
- smbfs
|
||||
- fuse.cifs
|
||||
- fuse.smbfs
|
||||
- afp
|
||||
- afpfs
|
||||
- fuse.afpfs
|
||||
- sshfs
|
||||
- fuse.sshfs
|
||||
- ftpfs
|
||||
- curlftpfs
|
||||
- fuse.ftpfs
|
||||
- davfs
|
||||
- davfs2
|
||||
- fuse.webdavfs
|
||||
items:
|
||||
- protocol
|
||||
- source
|
||||
- mount_point
|
||||
- fs_type
|
||||
- options
|
||||
- total_gb
|
||||
- used_gb
|
||||
- free_gb
|
||||
|
||||
network:
|
||||
enabled: true
|
||||
sources:
|
||||
- ip
|
||||
- ethtool
|
||||
- iw_optional
|
||||
interface_filter:
|
||||
# reprise logique script: UP|UNKNOWN sauf interfaces virtuelles connues
|
||||
include_states: ["UP", "UNKNOWN"]
|
||||
exclude_name_prefixes: ["lo", "docker", "br-", "veth", "tap", "fw"]
|
||||
items:
|
||||
- name
|
||||
- type # bridge|ethernet|wifi|unknown
|
||||
- mac
|
||||
- ip_address
|
||||
- speed_mbps # ethtool speed ou iw tx bitrate
|
||||
- driver # ethtool -i ou /sys/.../driver
|
||||
- ssid # iw dev link
|
||||
- wake_on_lan # ethtool Wake-on
|
||||
|
||||
raw_info:
|
||||
enabled: true
|
||||
include:
|
||||
- lscpu
|
||||
- lsblk
|
||||
- dmidecode
|
||||
max_size_kb: 5120
|
||||
|
||||
benchmarks:
|
||||
enabled: true
|
||||
# Pondérations identiques à ton script (si résultat dispo)
|
||||
weights:
|
||||
cpu: 0.40
|
||||
memory: 0.20
|
||||
disk: 0.20
|
||||
network: 0.10
|
||||
gpu: 0.10
|
||||
|
||||
cpu_sysbench:
|
||||
enabled: true
|
||||
tool: sysbench
|
||||
params:
|
||||
cpu_max_prime: 20000
|
||||
single_thread: 1
|
||||
multi_threads: "all" # all -> nproc
|
||||
outputs:
|
||||
- events_per_sec_single
|
||||
- events_per_sec_multi
|
||||
- duration_s
|
||||
- score_single
|
||||
- score_multi
|
||||
- score_global
|
||||
|
||||
memory_sysbench:
|
||||
enabled: true
|
||||
tool: sysbench
|
||||
params:
|
||||
total_size: "1G"
|
||||
outputs:
|
||||
- throughput_mib_s
|
||||
- score
|
||||
|
||||
disk_fio:
|
||||
enabled: true
|
||||
tool: fio
|
||||
safety:
|
||||
# Empêcher un bench destructif ou trop long
|
||||
max_runtime_s: 60
|
||||
max_size: "1G"
|
||||
direct: 1
|
||||
params:
|
||||
name: "bench"
|
||||
ioengine: "libaio"
|
||||
rw: "randrw"
|
||||
bs: "4k"
|
||||
size: "500M"
|
||||
numjobs: 1
|
||||
runtime_s: 30
|
||||
time_based: true
|
||||
output_format: "json"
|
||||
outputs:
|
||||
- read_mb_s
|
||||
- write_mb_s
|
||||
- iops_read
|
||||
- iops_write
|
||||
- latency_ms
|
||||
- score
|
||||
|
||||
network_iperf3:
|
||||
enabled: true
|
||||
tool: iperf3
|
||||
server: "10.0.0.50"
|
||||
port: 5201
|
||||
prechecks:
|
||||
ping:
|
||||
enabled: true
|
||||
count: 1
|
||||
timeout_s: 1
|
||||
port_check:
|
||||
enabled: true
|
||||
tool: nc
|
||||
timeout_s: 2
|
||||
params:
|
||||
duration_s: 10
|
||||
bidir: true
|
||||
json: true
|
||||
outputs:
|
||||
- upload_mbps
|
||||
- download_mbps
|
||||
- ping_ms
|
||||
- score
|
||||
# placeholders (comme ton script)
|
||||
- jitter_ms
|
||||
- packet_loss_percent
|
||||
|
||||
gpu:
|
||||
enabled: false
|
||||
note: "GPU bench non implémenté dans le script d'origine (placeholder)."
|
||||
|
||||
payload_mapping:
|
||||
# Le binaire peut mapper ses structures internes vers le schéma backend actuel.
|
||||
# Utile si ton backend attend des champs précis.
|
||||
device_identifier: "system.hostname"
|
||||
bench_script_version_field: "bench_client_version"
|
||||
include_sections:
|
||||
- hardware
|
||||
- results
|
||||
- raw_info
|
||||
|
||||
limits:
|
||||
# Bornes générales de sécurité (validation côté client)
|
||||
max_payload_kb: 1024
|
||||
max_raw_info_kb: 5120
|
||||
max_fio_runtime_s: 60
|
||||
max_fio_size_bytes: 1073741824 # 1 GiB
|
||||
max_sysbench_cpu_prime: 50000
|
||||
max_iperf_duration_s: 30
|
||||
|
||||
features:
|
||||
# Permet d'activer/désactiver rapidement des blocs selon machines
|
||||
enable_screen_resolution_detection: true
|
||||
enable_battery_detection: true
|
||||
enable_network_share_detection: true
|
||||
enable_audio_detection: true
|
||||
enable_proxmox_detection: true
|
||||
18018
debug.log
Executable file
18018
debug.log
Executable file
File diff suppressed because one or more lines are too long
26
go.mod
26
go.mod
@@ -1,7 +1,27 @@
|
||||
module github.com/example/bench-client
|
||||
|
||||
go 1.21
|
||||
go 1.24.0
|
||||
|
||||
toolchain go1.24.4
|
||||
|
||||
require (
|
||||
gopkg.in/yaml.v3 v3.0.1
|
||||
)
|
||||
github.com/anatol/smart.go v0.0.0-20241126061019-f03d79b340d2
|
||||
github.com/klauspost/cpuid v1.3.1
|
||||
github.com/mt-inside/go-lmsensors v0.0.3
|
||||
github.com/shirou/gopsutil/v4 v4.25.12
|
||||
github.com/u-root/u-root v0.15.0
|
||||
gopkg.in/yaml.v3 v3.0.1
|
||||
)
|
||||
|
||||
replace github.com/openebs/node-disk-manager => github.com/openebs/node-disk-manager v1.9.0
|
||||
|
||||
require (
|
||||
github.com/ebitengine/purego v0.9.1 // indirect
|
||||
github.com/go-ole/go-ole v1.2.6 // indirect
|
||||
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
|
||||
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
|
||||
github.com/tklauser/go-sysconf v0.3.16 // indirect
|
||||
github.com/tklauser/numcpus v0.11.0 // indirect
|
||||
github.com/yusufpapurcu/wmi v1.2.4 // indirect
|
||||
golang.org/x/sys v0.38.0 // indirect
|
||||
)
|
||||
|
||||
76
go.sum
Normal file
76
go.sum
Normal file
@@ -0,0 +1,76 @@
|
||||
github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2 h1:+vx7roKuyA63nhn5WAunQHLTznkw5W8b1Xc0dNjp83s=
|
||||
github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2/go.mod h1:HBCaDeC1lPdgDeDbhX8XFpy1jqjK0IBG8W5K+xYqA0w=
|
||||
github.com/anatol/smart.go v0.0.0-20241126061019-f03d79b340d2 h1:ha5+W2OHFJOEY4uTne98HGD9vQltSYtdyzNCbyhp7rY=
|
||||
github.com/anatol/smart.go v0.0.0-20241126061019-f03d79b340d2/go.mod h1:NoOw2eVExhZPtVxpYJzEvdRc5OSbCQZJT2vSe3dflPg=
|
||||
github.com/anatol/vmtest v0.0.0-20230711210602-87511df0d4bc h1:xMQuzBhj6hXQZufedPQM2OiGX2UcQHSptXtG3+28S8Q=
|
||||
github.com/anatol/vmtest v0.0.0-20230711210602-87511df0d4bc/go.mod h1:NC+g66bgkUjV1unIJXhHO35RHxVViWUzNeeKAkkO7DU=
|
||||
github.com/creack/pty v1.1.24 h1:bJrF4RRfyJnbTJqzRLHzcGaZK1NeM5kTC9jGgovnR1s=
|
||||
github.com/creack/pty v1.1.24/go.mod h1:08sCNb52WyoAwi2QDyzUCTgcvVFhUzewun7wtTfvcwE=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/ebitengine/purego v0.9.1 h1:a/k2f2HQU3Pi399RPW1MOaZyhKJL9w/xFpKAg4q1s0A=
|
||||
github.com/ebitengine/purego v0.9.1/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ=
|
||||
github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY=
|
||||
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
|
||||
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
||||
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
|
||||
github.com/hugelgupf/go-shlex v0.0.0-20200702092117-c80c9d0918fa h1:s3KPo0nThtvjEamF/aElD4k5jSsBHew3/sgNTnth+2M=
|
||||
github.com/hugelgupf/go-shlex v0.0.0-20200702092117-c80c9d0918fa/go.mod h1:I1uW6ymzwsy5TlQgD1bFAghdMgBYqH1qtCeHoZgHMqs=
|
||||
github.com/hugelgupf/vmtest v0.0.0-20240307030256-5d9f3d34a58d h1:nP8SfQJqruIVSWYJTuYc37jLHEY1Z0fF+zKSrs3K/C8=
|
||||
github.com/hugelgupf/vmtest v0.0.0-20240307030256-5d9f3d34a58d/go.mod h1:B63hDJMhTupLWCHwopAyEo7wRFowx9kOc8m8j1sfOqE=
|
||||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs=
|
||||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
|
||||
github.com/klauspost/cpuid v1.3.1 h1:5JNjFYYQrZeKRJ0734q51WCEEn2huer72Dc7K+R/b6s=
|
||||
github.com/klauspost/cpuid v1.3.1/go.mod h1:bYW4mA6ZgKPob1/Dlai2LviZJO7KGI3uoWLd42rAQw4=
|
||||
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4=
|
||||
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I=
|
||||
github.com/mt-inside/go-lmsensors v0.0.3 h1:bevKKCgQHW5qIY6rWtwWVNC/OxPF/tg2FmJH68NL0Pc=
|
||||
github.com/mt-inside/go-lmsensors v0.0.3/go.mod h1:LReO2RCiAqZ5lx0Ox7IGNnc8A/Vb1sqAerIf21zw08o=
|
||||
github.com/pierrec/lz4/v4 v4.1.22 h1:cKFw6uJDK+/gfw5BcDL0JL5aBsAFdsIT18eRtLj7VIU=
|
||||
github.com/pierrec/lz4/v4 v4.1.22/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU=
|
||||
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE=
|
||||
github.com/shirou/gopsutil/v4 v4.25.12 h1:e7PvW/0RmJ8p8vPGJH4jvNkOyLmbkXgXW4m6ZPic6CY=
|
||||
github.com/shirou/gopsutil/v4 v4.25.12/go.mod h1:EivAfP5x2EhLp2ovdpKSozecVXn1TmuG7SMzs/Wh4PU=
|
||||
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
|
||||
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
|
||||
github.com/tklauser/go-sysconf v0.3.16 h1:frioLaCQSsF5Cy1jgRBrzr6t502KIIwQ0MArYICU0nA=
|
||||
github.com/tklauser/go-sysconf v0.3.16/go.mod h1:/qNL9xxDhc7tx3HSRsLWNnuzbVfh3e7gh/BmM179nYI=
|
||||
github.com/tklauser/numcpus v0.11.0 h1:nSTwhKH5e1dMNsCdVBukSZrURJRoHbSEQjdEbY+9RXw=
|
||||
github.com/tklauser/numcpus v0.11.0/go.mod h1:z+LwcLq54uWZTX0u/bGobaV34u6V7KNlTZejzM6/3MQ=
|
||||
github.com/tmc/scp v0.0.0-20170824174625-f7b48647feef h1:7D6Nm4D6f0ci9yttWaKjM1TMAXrH5Su72dojqYGntFY=
|
||||
github.com/tmc/scp v0.0.0-20170824174625-f7b48647feef/go.mod h1:WLFStEdnJXpjK8kd4qKLwQKX/1vrDzp5BcDyiZJBHJM=
|
||||
github.com/u-root/gobusybox/src v0.0.0-20250101170133-2e884e4509c7 h1:dtiVT4SeBUc/vHtwI2HjDZN+FCKTstQBxugIxJEGo9g=
|
||||
github.com/u-root/gobusybox/src v0.0.0-20250101170133-2e884e4509c7/go.mod h1:PW3wGFCHjdHxAhra5FKvcARbCGqGfentYuPKmuhv8DY=
|
||||
github.com/u-root/mkuimage v0.0.0-20250701161901-6a9871f2e64f h1:TYTO6Hvj2BrRRpWOqL/K2A8tIelVyP+wTbpkWygGRkg=
|
||||
github.com/u-root/mkuimage v0.0.0-20250701161901-6a9871f2e64f/go.mod h1:qzJqwYSsU0kBkl1bX/s93hfd64WbL+CP7AobQdvJb9A=
|
||||
github.com/u-root/u-root v0.15.0 h1:8JXfjAA/Vs8EXfZUA2ftvoHbiYYLdaU8umJ461aq+Jw=
|
||||
github.com/u-root/u-root v0.15.0/go.mod h1:/0Qr7qJeDwWxoKku2xKQ4Szc+SwBE3g9VE8jNiamsmc=
|
||||
github.com/u-root/uio v0.0.0-20240224005618-d2acac8f3701 h1:pyC9PaHYZFgEKFdlp3G8RaCKgVpHZnecvArXvPXcFkM=
|
||||
github.com/u-root/uio v0.0.0-20240224005618-d2acac8f3701/go.mod h1:P3a5rG4X7tI17Nn3aOIAYr5HbIMukwXG0urG0WuL8OA=
|
||||
github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0=
|
||||
github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
|
||||
golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34=
|
||||
golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc=
|
||||
golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 h1:nDVHiLt8aIbd/VzvPWN6kSOPE7+F/fNFDSXLVYkE/Iw=
|
||||
golang.org/x/exp v0.0.0-20250305212735-054e65f0b394/go.mod h1:sIifuuw/Yco/y6yb6+bDNfyeQ/MdPUy/hKEMYQV17cM=
|
||||
golang.org/x/mod v0.24.0 h1:ZfthKaKaT4NrhGVZHO1/WDTwGES4De8KtWO0SIbNJMU=
|
||||
golang.org/x/mod v0.24.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww=
|
||||
golang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw=
|
||||
golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
||||
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc=
|
||||
golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
|
||||
golang.org/x/tools v0.31.0 h1:0EedkvKDbh+qistFTd0Bcwe/YLh4vHwWEkiI0toFIBU=
|
||||
golang.org/x/tools v0.31.0/go.mod h1:naFTU+Cev749tSJRXJlna0T3WxKvb1kWEx15xA4SdmQ=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
mvdan.cc/sh/v3 v3.11.0 h1:q5h+XMDRfUGUedCqFFsjoFjrhwf2Mvtt1rkMvVz0blw=
|
||||
mvdan.cc/sh/v3 v3.11.0/go.mod h1:LRM+1NjoYCzuq/WZ6y44x14YNAI0NK7FLPeQSaFagGg=
|
||||
874
old_version.json
Normal file
874
old_version.json
Normal file
File diff suppressed because one or more lines are too long
136
readme.md
136
readme.md
@@ -0,0 +1,136 @@
|
||||
Documentation utilisateur et technique pour le déploiement de bench-client.
|
||||
|
||||
Bench-Client
|
||||
Agent de benchmarking autonome pour Linux x86_64 (Go). Cet outil remplace l'ancien script Bash en offrant une meilleure robustesse, une exécution parallèle sécurisée et une configuration distante pilotable.
|
||||
|
||||
📋 Table des matières
|
||||
Fonctionnalités
|
||||
Prérequis
|
||||
Installation
|
||||
Utilisation
|
||||
Configuration
|
||||
Sortie JSON
|
||||
✨ Fonctionnalités
|
||||
Inventaire Matériel Complet : CPU, RAM, Disques, Réseau, Carte Mère, Audio.
|
||||
Benchmarks Sécurisés :
|
||||
CPU (Sysbench : Single & Multi-thread).
|
||||
RAM (Sysbench : Bande passante).
|
||||
Disque (FIO : Aléatoire mixte, non-destructif).
|
||||
Réseau (Iperf3 : Débit bidirectionnel).
|
||||
Pilotage par Configuration Distante : Récupère les paramètres et les pondérations via HTTP(S).
|
||||
Mode Débogage Intégré : Logs verbeux, sauvegarde locale des payloads.
|
||||
Sécurité : Timeouts stricts, pas d'injection de commande, pas de secrets dans le binaire.
|
||||
🛠️ Prérequis
|
||||
Le binaire nécessite un environnement Linux x86_64 avec les droits root (sudo) pour accéder aux informations matérielles complètes (dmidecode, smartctl).
|
||||
|
||||
Dépendances système
|
||||
Le script d'installation doit s'assurer que les outils suivants sont présents dans le $PATH :
|
||||
|
||||
# Baselsblk, lscpu, free, ip, lspci, lsusb, dmidecode, systemd-detect-virt# Réseauethtool, iw, iperf3, curl, nc (netcat)# Audioaplay, arecord, pactl# Benchmarkssysbench, fio
|
||||
🚀 Installation
|
||||
L'installation est gérée par un script shell externe (non inclus dans le binaire) qui doit effectuer les actions suivantes :
|
||||
|
||||
Télécharger le binaire bench-client (statique de préférence).
|
||||
Télécharger le fichier config.yaml et le placer dans /var/cache/bench-client/ (ou le laisser être téléchargé par le client).
|
||||
Donner les droits d'exécution : chmod +x bench-client.
|
||||
S'assurer que les dépendances listées ci-dessus sont installées.
|
||||
Exporter le token d'authentification.
|
||||
💻 Utilisation
|
||||
Syntaxe de base
|
||||
bash
|
||||
|
||||
sudo API_TOKEN="votre_secret_token" ./bench-client [OPTIONS]
|
||||
Options disponibles
|
||||
Option
|
||||
Description
|
||||
--config-url <URL> URL HTTP(S) pour télécharger la config.yaml à jour. Si omis, utilise le cache local ou les défauts internes.
|
||||
--debug Active le mode verbeux. Affiche les commandes exécutées, les sorties brutes, et sauvegarde le JSON final dans /tmp.
|
||||
--dry-run Simulation. Exécute la collecte d'infos mais ne lance pas les benchmarks (sauf inventaire) et n'envoie pas les données au serveur.
|
||||
|
||||
Exemples
|
||||
Lancement standard (production) :
|
||||
|
||||
bash
|
||||
|
||||
sudo API_TOKEN="eyJhbGciOiJIUz..." ./bench-client --config-url "http://mon-intranet/configs/bench.yaml"
|
||||
Test de collecte (sans bench) :
|
||||
|
||||
bash
|
||||
|
||||
sudo ./bench-client --dry-run --debug
|
||||
⚙️ Configuration
|
||||
Le fichier config.yaml (voir section précédente) contrôle le comportement du client.
|
||||
|
||||
Points clés de la configuration :
|
||||
|
||||
Backend : L'URL de réception des données.
|
||||
Pondérations (weights) : Définissent l'importance de chaque bench dans le score final (par ex : CPU 40%, Disk 20%).
|
||||
Sécurité (safety) : FIO est configuré pour être non-destructif (direct: true, fichier temporaire).
|
||||
Timeouts : Chaque outil a une limite de temps stricte pour éviter que le client ne se bloque.
|
||||
📤 Sortie JSON
|
||||
Le client envoie une requête POST avec l'en-tête Authorization: Bearer <TOKEN>.
|
||||
|
||||
Structure du JSON
|
||||
json
|
||||
|
||||
{
|
||||
"device_identifier": "srv-web-01",
|
||||
"bench_client_version": "1.0.0",
|
||||
"hardware": {
|
||||
"cpu": {
|
||||
"model": "Intel(R) Xeon(R) CPU E5-2670 v3 @ 2.30GHz",
|
||||
"cores": 24,
|
||||
"threads": 48
|
||||
},
|
||||
"ram": {
|
||||
"total_mb": 65536
|
||||
},
|
||||
"storage": [
|
||||
{
|
||||
"name": "sda",
|
||||
"size_gb": "500G",
|
||||
"type": "ssd"
|
||||
}
|
||||
],
|
||||
"network": [
|
||||
{
|
||||
"name": "eth0",
|
||||
"ip_address": "192.168.1.10",
|
||||
"speed_mbps": "1000"
|
||||
}
|
||||
]
|
||||
},
|
||||
"results": {
|
||||
"cpu": {
|
||||
"score_single": 105.4,
|
||||
"score_multi": 2400.8
|
||||
},
|
||||
"memory": {
|
||||
"throughput_mib_s": 5500.2,
|
||||
"score": 55.0
|
||||
},
|
||||
"disk": {
|
||||
"read_mb_s": 420.5,
|
||||
"write_mb_s": 380.2,
|
||||
"score": 40.0
|
||||
},
|
||||
"network": {
|
||||
"upload_mbps": 940.0,
|
||||
"download_mbps": 945.0,
|
||||
"score": 94.2
|
||||
},
|
||||
"global_score": 85.4
|
||||
},
|
||||
"raw_info": {
|
||||
"lscpu_output": "..."
|
||||
}
|
||||
}
|
||||
🔧 Dépannage
|
||||
Erreur "Configuration unreachable"
|
||||
Le client n'a pas pu joindre l'URL --config-url. Il tentera d'utiliser le fichier de cache local situé dans /var/cache/bench-client/config.yaml.
|
||||
|
||||
Benchmarks marqués "SKIPPED"
|
||||
Si un outil n'est pas trouvé (ex: iperf3 manquant), le client affichera un WARN et continuera. Vérifiez les dépendances système.
|
||||
|
||||
Permissions refusées
|
||||
Ce binaire doit être lancé en root (via sudo) pour pouvoir exécuter dmidecode, smartctl et fio en mode direct.
|
||||
Reference in New Issue
Block a user