In this sixth episode, we talk to William Lam, Senior Staff Architect in the Cloud Infrastructure Business Group at VMware about event-driven automation. William explains what event-driven automation is, how customers are using it today, and why you should also consider trying out the VMware Event Broker Appliance! (https://flings.vmware.com/vmware-event-broker-appliance) Enjoy the episode, and if you haven’t done so yet, make sure to subscribe! You can also listen via your podcast apps of course for Apple: apple.co/3pxet9P Spotify: spoti.fi/3mW19dt Google: bit.ly/3pDoUJ3
automation
Automation is scary!
Last couple of months I noticed something which led me to believe that automation is scary… And I am sure that my friends William Lam, Luc Dekens and Alan Renouf are on top of their desk right now and yelling at me but when they finished reading this post I am sure they agree.
I have been blogging for a while and when I started blogging, more than 6 years back, I posted a couple of simple scripts I wrote. The scripts allowed you to do simple things like checking the available disk space, finding snapshots, committing snapshots, find unregistered VMs, clean unregistered VMs etc. Basically the kind of scripts I used when I was a consultant to clean up the mess I typically found a couple of months after a new environment was deployed.
Many people downloaded these scripts and ran them in their environment, back then I didn’t think much of it to be honest… I mean I wrote some simple scripts and people were using those to their advantage right? Well… yes and no. Yes I did write scripts, and yes they were using them to their advantage and yes they were simple for sure. (I am not a scripting god.) So what is the problem then?
The problem is simple, 6+ years after I wrote those scripts I still receive questions about how to use them. Now note this: Those scripts were written when ESX was still the core hypervizor to use. Those scripts were written to run within the service console. Those scripts were written for ESX version 2.5.x and 3.x. Today we use ESXi and majority of folks will be on version 5.x. More than 6 years have passed, but people are still downloading them and putting them in places where they don’t belong and try to run them; without thinking about.
That is why I think Automation is Scary! (Yes in this case capital S is warranted.) If you are looking to automate operational procedures / tasks. (Automation is NOT a replacement for proper operational procedures by the way!) If you are looking to create or re-use (simple) reporting scripts, or scripts which execute simple tasks for you make sure you:
- Read the script, and make sure you understand every line of code
- Test the script in a test environment
- Check for which version the script was written and validate it against your version
- Don’t trust ANYONE blindly, and when changes are introduced in your environment or to the script go to step 1 again!
Automation isn’t really scary of course, automation can make your life easier. Just make sure you don’t become that person who has to restore 80 VMs because that script which was cleaning up unregistered VMs unintentionally deleted production VMs… Make sure you understand what your scripts are doing and assess the potential risk.
Automating ESXi host level changes without opening SSH
I have been asked by many if it is possible automating ESXi host level changes without opening SSH. In many organizations people are prohibited to open SSH however they do have the need to make certain changes on a host level. One of those changes for instance is in a stretched cluster environment where “disk.terminateVMOnPDLDefault” needs to be set to true. This setting can only be configured in /etc/vmware/settings unfortunately. So how do you automate this?
Andreas Peetz from V-Front.de came up with an awesome solution. He created a plugin to esxcli allowing you to run commands on an ESXi host. So in other words, when you install his plugin (it is a vib) you can remotely fire off a command on an ESXi host as if you are sitting behind that host.
How does that work? Well first of all you install the vib Andreas created. (Or include it in your image.) When it is installed you can simply run the following on any machine that has the vSphere CLI installed:
esxcli -s hostname -u username -p password shell cmd -c "command"
Awesome right?! I think so, this is probably one of the coolest things I have seen in a while. Very clever solution, once again… awesome work Andreas and head over to V-Front.de to get more details and the actually download of this plugin!
** Disclaimer: implementing this solution could result in an unsupported configuration. This article was published to demonstrate the capabilities of esxcli and for educational purposes **
Scripts release for Storage vMotion / HA problem
Last week when the Storage vMotion / HA problem went public I asked both William Lam and Alan Renouf if they could write a script to detect the problem. I want to thank both of them for their quick response and turnaround, they cranked the script out in literally hours. The scripts were validated multiple times in a VDS environment and worked flawless. Note that these scripts can detect the problem in an environment using a regular Distributed vSwitch and a Nexus 1000v, the script can only mitigate the problem though in a Distributed vSwitch environment. Here are the links to the scripts:
- Perl: Identifying & Fixing Virtual Machines Affected By SvMotion / VDS Issue (William Lam)
- PowerCLI – Identifying and fixing VMs Affected By SvMotion / VDS Issue (Alan Renouf)
Once again thanks guys!
PowerCLI Reference Book, the review
I was checking Amazon during the weekend, just like I do everyday, to see if we had new reviews and how the book was selling until I noticed the reviews on the PowerCLI book. The reviews were mainly about the fact that there’s a formatting issue with the ebook which I agree with should be fixed by the publisher but rating it with a 3 / 4 stars just doesn’t cut it in my opinion. Here’s my review of the book, please note that I know the authors really well and they gave me a free copy nevertheless I have been completely honest about what I think about the book. If I would think it was crap I would let you know, before I copy/paste the review here I would like to ask the Authors to pressure their publisher to lower the price of the ebook as right now it is more expensive than the paper version which is just nonsense. Mr or Mrs Sybex, it is time to change your strategy.
Anyway, I gave the PowerCLI Reference Book 5 stars as I truly believe it is one of a kind, here’s my justification for it:
I received the paper-version of the book last week and started reading it straight away. The authors are THE number one PowerCLI experts in the world and take you through the trenches of vSphere automation.
Although I know vSphere inside out I am a novice when it comes to PowerCLI. The main reason being that I never gave myself the time to actually learn PowerCLI as I figured I could do things faster using the UI. Although this might be true in some cases the first thing the book tought me was that my perception was wrong. The book shows you how to optimize your day-to-day operations by taking advantage of what PowerCLI has to offer out of the box, but it also teaches you how to create your own functions. The amount of examples in there in terms of PowerCLI scripts are such a valuable asset that I would highly recommend it to anyone who is interested in learning PowerCLI and/or optimizing their operational procedures. We are not talking about reporting only, for instance configuring vSwitches or restricting the amount of snapshots is all shown in this book. Be warned though, don’t expect a step-by-step Learning PowerCLI Guide, this is 700+ pages of pure PowerCLI automation at its best which will enable you to get the most out of your environment.
Not included on Amazon, but I do feel it would have been nice if the structure of the book was slightly different. I would have personally started with an Introduction chapter, followed “in-box” reporting functionality and finishing it off with deepdive functions and pages of script. But than again, this is a reference book and not course material. All in all, this book is more than worth it.
You can buy it here if you are interested.
(yes it contains an affiliate link)