venerdì, Aprile 19, 2024

VMware vSphere CLI – esxcli command

Giovanni "Jinko" Uccio
Giovanni "Jinko" Ucciohttps://ie.linkedin.com/in/giovanniuccio
- Software Engineer - Debian Evangelist - Escalation Engineer - Debianizzati.org

Introduzione

Questa più che è una guida è solamente l’esposizione di un modo utile ed alcune volte necessario per poter forzare lo stop (logicamente anche start e reset) di una VM che è li impantanata.
Esxcli per chi non lo conoscesse è un framework che fornisce un approccio architetturale ad alcuni elementi (i namespaces).

Usage

escli <conn_options> <namespaces> <app> <cmd> [cmd options]

soft: parametri di connessione utilizzati per effettuare la connessione all’host di ESXi per reperire le informazioni che ci necessitano..

hard: serve a reperire le informazioni su diverse tipologie di path:

nmp: i multipath, che tramite questo plugin servono per gestire le Pluggable Storage Architecture

swiscsi: per i comandi legato agli storage iSCI.

corestorage: per i comandi legati allo storage

VMs listing

* Ipotizziamo che l’ip del nostro host ESXi sia uguale a 10.0.0.1

esxcli.exe –server 10.0.0.1 vms vm list

Enter username: root
Enter password:
Windows Vista 32 bit
  World ID: 405588
  Process ID: 0
  VMX Cartel ID: 405587
  UUID: 56 4d b5 ab 33 7f 48 08-12 a2 0b d9 cc b9 a1 a7
  Display Name: Windows Vista 32 bit
  Config File: /vmfs/volumes/4c45ae8e-648bf297-1c75-0024811f5501/Windows Vista 32 bit/Windows Vista 32

Windowx Xp-32bit
  World ID: 17061
  Process ID: 0
  VMX Cartel ID: 17060
  UUID: 56 4d 70 86 f8 fe 08 cb-79 c0 ff be bc 1c 76 46
  Display Name: Windowx Xp-32bit
  Config File: /vmfs/volumes/4c45ae8e-648bf297-1c75-0024811f5501/Windowx Xp-32bit/Windowx Xp-32bit.vmx

Debian 5.0 64bit
  World ID: 551224
  Process ID: 0
  VMX Cartel ID: 551055
  UUID: 56 4d 27 22 01 7d 42 76-a2 ba 0f d3 65 7c 8e 6f
  Display Name: Debian 5.0 64bit
  Config File: /vmfs/volumes/4c45ae8e-648bf297-1c75-0024811f5501/Debian 5.0 64bit/Debian 5.0 64bit.vmx

CentOS 5.5 32bit
  World ID: 162354
  Process ID: 0
  VMX Cartel ID: 162353
  UUID: 56 4d f6 35 c6 c2 b9 34-98 87 e8 f2 67 75 e2 30
  Display Name: CentOS 5.5 32bit
  Config File: /vmfs/volumes/4c45ae8e-648bf297-1c75-0024811f5501/CentOS 5.5 32bit/CentOS 5.5 32bit.vmx

Fedora 13 64bit
  World ID: 15447
  Process ID: 0
  VMX Cartel ID: 15446
  UUID: 56 4d fd 8e c9 88 66 cb-02 30 0b ec 22 21 fc c9
  Display Name: Fedora 13 64bit
  Config File: /vmfs/volumes/4c45ae8e-648bf297-1c75-0024811f5501/Fedora 13 64bit/Fedora 13 64bit.vmx

Kill di una VM

Vi informo che questo tipo di stop potrebbe causare il data-loss quindi prima di effettuare un qualcosa del genere cercate nei modi “convenzionali” di portare in modo pulito la vostra VM in uno stato di powered off.

esxcli.exe --server 10.0.0.1 vms vm kill --type force --world-id 551224
Enter username: root
Enter password:
true

quando non funzona nulla vi potrei quasi assicurare (:P) che questo butta giù di tutto anche vero che prima di provare con “force” che equivale alla forza bruta, potreste provare con:

quando non funzona nulla vi potrei quasi assicurare (:P) che questo butta giù di tutto anche vero che prima di provare con “force”
che equivale alla forza bruta, potreste provare con le opzioni:

soft: che da la possibilità di effettuare uno shutdown clean quindi mandando ai processi un kill o kill –SIGTERM

hard: che invece sarebbe l’equivalente di un KILL -9 o kill -SIGKILL

Se ciò non funziona non vi resta che effettuare il reboot del vostro host ESXi.

Network

Usage: esxcli.exe network {app} {cmd} [cmd options]

Fornisce la possibilità di reperire informazioni circa l’attuale stato della rete. Prima cosa andiamo a visualizzare l’help per vedere che valori possiamo andare a recuperare, quindi:

esxcli.exe –server 10.0.0.1 network –help
Enter username: root
Enter password:
Usage: esxcli.exe network {app} {cmd} [cmd options]

App:
connection List active tcpip connections
neighbor Operations that can be performed on arp tables

esxcli.exe –server 10.0.0.1 network connection list -t all

Enter username: root
Enter password:

 

Visualizzare la lista dei device di storage

esxcli.exe --username root --password passwd --server 10.0.0.1 corestorage device list

t10.ATA_____ST3250318AS_____________________________9VY2S35G____________
  Display Name: Local ATA Disk (t10.ATA_____ST3250318AS_____________________________9VY2S35G____________)
  Size: 238475
  Device Type: Direct-Access
  Multipath Plugin: NMP
  Devfs Path: /vmfs/devices/disks/t10.ATA_____ST3250318AS_____________________________9VY2S35G____________
  Vendor: ATA
  Model: ST3250318AS
  Revision: HP34
  SCSI Level: 5
  Is Pseudo: false
  Status: on
  Is RDM Capable: false
  Is Local: true
  Is Removable: false
  Attached Filters: []
  VAAI Status: unknown
  Other UIDs: vml.01000000003956593253333547202020202020202020202020535433323530

mpx.vmhba32:C0:T0:L0
  Display Name: Local hp CD-ROM (mpx.vmhba32:C0:T0:L0)
  Size: 3023
  Device Type: CD-ROM
  Multipath Plugin: NMP
  Devfs Path: /vmfs/devices/cdrom/mpx.vmhba32:C0:T0:L0
  Vendor: hp
  Model: DVD-RAM GH40L
  Revision: RB0E
  SCSI Level: 5
  Is Pseudo: false
  Status: on
  Is RDM Capable: false
  Is Local: true
  Is Removable: true
  Attached Filters: []
  VAAI Status: unknown
  Other UIDs: vml.0005000000766d68626133323a303a30

Filtro per la view di un singolo device

esxcli.exe --username root --password passwd --server 10.0.0.1 corestorage device list -d mpx.vmhba32:C0:T0:L0"mpx.vmhba32:C0:T0:L0"
  Display Name: Local hp CD-ROM (mpx.vmhba32:C0:T0:L0)
  Size: 3023
  Device Type: CD-ROM
  Multipath Plugin: NMP
  Devfs Path: /vmfs/devices/cdrom/mpx.vmhba32:C0:T0:L0
  Vendor: hp
  Model: DVD-RAM GH40L
  Revision: RB0E
  SCSI Level: 5
  Is Pseudo: false
  Status: on
  Is RDM Capable: false
  Is Local: true
  Is Removable: true
  Attached Filters: []
  VAAI Status: unknown
  Other UIDs: vml.0005000000766d68626133323a303a30

Un saluto,
Giovanni Uccio

Articoli correlati

Non perdere il lancio online della Community GDPR Day: 26 marzo 2024

La sicurezza dei dati e delle informazioni non è più un'opzione, ma una necessità imprescindibile. Lo dimostrano i tanti attacchi informatici che, con frequenza...

Digital Transformation


 

Noleggia una Tesla per il tuo evento ICT!

Categorie