What are your most used and helpful ESXcli commands?

DeathmageDeathmage Banned Posts: 2,496
Hey guys,

since the discussion about vCPU design turned up a interesting following, I'm curious what ESXCLi functions that you use in your daily operations.

These are some that I use way too often.

1. ESXTOP
2. /vmfs/volumes/datastore name/VM_name/
3. ls
4. ls -al
5. vim-cmd vimsvc/task_list
6. vim-cmd getallvms

Comments

  • TheProfTheProf Users Awaiting Email Confirmation Posts: 331 ■■■■□□□□□□
    Other than ESXTOP, not many to be honest. The only time I go into CLI is when I am having issues at the GUI level, such as mounting an existing datastore without formatting it, restarting various agents, etc.

    Maybe I should use it more, but I don't.
  • dave330idave330i Member Posts: 2,091 ■■■■■■■■■■
    None. I don't do Ops.
    2018 Certification Goals: Maybe VMware Sales Cert
    "Simplify, then add lightness" -Colin Chapman
  • DPGDPG Member Posts: 780 ■■■■■□□□□□
  • kj0kj0 Member Posts: 767
    ESXTOP
    lsusb
    watch -d 'ls -luth | grep -E "delta|flat|sesparse"'

    That's pretty much it.
    2017 Goals: VCP6-DCV | VCIX
    Blog: https://readysetvirtual.wordpress.com
  • DeathmageDeathmage Banned Posts: 2,496
    kj0 wrote: »
    ESXTOP
    lsusb
    watch -d 'ls -luth | grep -E "delta|flat|sesparse"'

    That's pretty much it.


    What does "watch -d 'ls -luth | grep -E "delta|flat|sesparse"'" do?
  • aftereffectoraftereffector Member Posts: 525 ■■■■□□□□□□
    https://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1007566
    To monitor the VMDK snapshot and base disks which are currently being updated, run this watch command:

    # watch -d 'ls -luth | grep -E "delta|flat|sesparse"'

    where:

    -d highlights the differences between successive updates
    t sorts by modification time
    l shows a long listing which displays additional file information
    u sorts by and shows access time
    h prints sizes in a readable format such as 1K 234M 2G
    CCIE Security - this one might take a while...
  • blargoeblargoe Member Posts: 4,174 ■■■■■■■■■□
    I use esxcli software vib install occasionally for driver updates, and resxtop from vMA.
    IT guy since 12/00

    Recent: 11/2019 - RHCSA (RHEL 7); 2/2019 - Updated VCP to 6.5 (just a few days before VMware discontinued the re-cert policy...)
    Working on: RHCE/Ansible
    Future: Probably continued Red Hat Immersion, Possibly VCAP Design, or maybe a completely different path. Depends on job demands...
  • kj0kj0 Member Posts: 767
    Deathmage wrote: »
    What does "watch -d 'ls -luth | grep -E "delta|flat|sesparse"'" do?
    Due to the size of our environment and customer VMs and IaaS infrastructure we have a lot of Snapshots taking place during backups, sometimes there are issues removing or consolidating, so this helps keep an eye on things and get an idea of how long it may be away.



    Also use vib install line when needed also.
    2017 Goals: VCP6-DCV | VCIX
    Blog: https://readysetvirtual.wordpress.com
  • DPGDPG Member Posts: 780 ■■■■■□□□□□
    kj0 wrote: »
    Due to the size of our environment and customer VMs and IaaS infrastructure we have a lot of Snapshots taking place during backups, sometimes there are issues removing or consolidating, so this helps keep an eye on things and get an idea of how long it may be away.

    This was a huge pain for us until Veeam added support for storage-level snapshots.
  • DeathmageDeathmage Banned Posts: 2,496
    I'm finding out at my employer the EMC Avamar doesn't always remove, well never, removes snapshots and I'm getting extremely intimate with ESXCli and datastore Storage vMotions to the point that my list of commands has grown immensely in less than a month....

    1. vim-cmd vmsvc/get.tasklist [vim]
    2. vim-cmd vmsvc/getallvms
    3. ls -lah
    4. ls - lh
    5. df -h
    6. ls -la test.txt
    7. services.sh restart
    8. esxcli software vib list | grep -i EMC
    9. esxcli storage nfs list
  • TheProfTheProf Users Awaiting Email Confirmation Posts: 331 ■■■■□□□□□□
    Deathmage wrote: »
    I'm finding out at my employer the EMC Avamar doesn't always remove, well never, removes snapshots and I'm getting extremely intimate with ESXCli and datastore Storage vMotions to the point that my list of commands has grown immensely in less than a month....

    1. vim-cmd vmsvc/get.tasklist [vim]
    2. vim-cmd vmsvc/getallvms
    3. ls -lah
    4. ls - lh
    5. df -h
    6. ls -la test.txt
    7. services.sh restart
    8. esxcli software vib list | grep -i EMC
    9. esxcli storage nfs list


    This is actually very good practice for the VCAP-DCA.. Maybe you should look into it :)
  • techfiendtechfiend Member Posts: 1,481 ■■■■□□□□□□
    So it's not just EMC's VDP that's a headache. I've never been happier to get rid of a piece of software at work. Management should easily be convinced to get a real backup solution given all the man hours of snapshot removal. It can be scripted fairly easily but watch for snapshots that should be kept.
    2018 AWS Solutions Architect - Associate (Apr) 2017 VCAP6-DCV Deploy (Oct) 2016 Storage+ (Jan)
    2015 Start WGU (Feb) Net+ (Feb) Sec+ (Mar) Project+ (Apr) Other WGU (Jun) CCENT (Jul) CCNA (Aug) CCNA Security (Aug) MCP 2012 (Sep) MCSA 2012 (Oct) Linux+ (Nov) Capstone/BS (Nov) VCP6-DCV (Dec) ITILF (Dec)
  • DeathmageDeathmage Banned Posts: 2,496
    TheProf wrote: »
    This is actually very good practice for the VCAP-DCA.. Maybe you should look into it :)

    Well our EPIC ERM is a freaking beast of it's own and with me managing over 2000+ VM's right now, taking down the Isilon and VNX is a chore upon itself. Like i just got done with a 72 hour shutdown because I guess the Isilon has these little credit card sized boot card that are designed to fail after 2 years and we lost tow of them in one node.

    Make matters worse our Avamar failed a 14 TB VM restore and then made a .lck on the 14 TB .vmdk that could only be fixed by a Storage vMotion.... on a 14 TB LUN!!!!!!!

    Long story short, the cluster should have been able to sustain a 1 node lose but it made all of the nodes read only and it broke vBlock....

    ....VCAP is looking more appealing everyday...
  • JBrownJBrown Member Posts: 308
    Deathmage wrote: »
    ....
    Make matters worse our Avamar failed a 14 TB VM restore and then made a .lck on the 14 TB .vmdk that could only be fixed by a Storage vMotion.... on a 14 TB LUN!!!!!!!

    Long story short, the cluster should have been able to sustain a 1 node lose but it made all of the nodes read only and it broke vBlock....

    ....VCAP is looking more appealing everyday...
    what kind of application are you running in that VM?

    I have a file share VM with 3 TB data on it, and use EMC's Networker for backing it up. It was taking forever to release a snapshots after backing it up, so ended up switching from a snapshot level backup to in-guest agent.
  • alias454alias454 Member Posts: 648 ■■■■□□□□□□
    I have a few for doing patches on standalone hosts
    vim-cmd vmsvc/getallvms
    
    for i in `vim-cmd vmsvc/getallvms |grep -v Vmid |awk '{print $1}'`; do if [ "`vim-cmd vmsvc/power.getstate $i |grep on`" == 'Powered on' ]; then vim-cmd vmsvc/power.shutdown $i; echo “$i Powered Down”; fi; done
    
    vim-cmd hostsvc/maintenance_mode_enter
    esxcli software vib update -d '/vmfs/volumes/Storage/Patch/VMware-ESXi-5.5.0-Update3-3568722...Apr2016.zip'
    vim-cmd hostsvc/maintenance_mode_exit
    reboot
    
    “I do not seek answers, but rather to understand the question.”
  • DeathmageDeathmage Banned Posts: 2,496
    JBrown wrote: »
    what kind of application are you running in that VM?

    I have a file share VM with 3 TB data on it, and use EMC's Networker for backing it up. It was taking forever to release a snapshots after backing it up, so ended up switching from a snapshot level backup to in-guest agent.

    EPIC RHEL Database
Sign In or Register to comment.