Posts

Showing posts with the label CLI

Parsing HP CLI Output

I've been working on an environment audit for one of my customers (expect to see some of those scripts popping up in the not-too-distant future).  In addition to auditing ESXi host configurations, I've been looking at their HP C7000 Chassis configurations and comparing them against enterprise standards.  Since there are a lot of chassis in this environment, I've been leveraging scripts to collect data via plink. It's not always easy to parse data from an SSH session into PowerShell objects, but HP gave us a great tool in their CLI (way better than adjusting column size, which is what I was looking for when I came across this).  It's already  well documented , but it saved me so much time that I figured that it was worth mentioning anyway... the HP CLI commands support this great option: -output=script2.  There's actually a couple of "script#" options, but I'm particularly fond of #2.  So, what's it do?  Well, it turns this style of human frie...

Brocade 1:1 Fiber Channel Zoning Commands via PowerShell

One of my customers asked me to help out with the zoning configuration on their Brocade fiber switches.  I'm neither a SAN nor a network engineer, but I've created a few fiber zones in my time.  The best practice that I've always heard is to create 1:1 zones.  That means that each zone has 1 initiator (an ESXi host's VMHBA) and 1 target (the storage processor on the SAN).  This is a very simple process, but it's also really arduous and really boring, especially as environments scale up with redundant VMHBAs and multiple SANs with redundant storage processors. So, I spent a little bit of time reading about how to use the Brocade CLI , then moved forward.  I'm not quite confident enough in my scripting to actually enable any changes on the Brocade switches (after all, if you mess something up, storage could simply go away), so what I did was create a PowerCLI script that generates a bunch of Brocade CLI commands.  These commands (after you've read them over...

Validating HA by Inducing a PSOD

After installing an ESXi cluster, of course you want to validate its functionality.  vMotion/DRS are easy to validate, but how about HA?  Just pull the power cable out of the back of one of your ESXi hosts, right? Well, that will do it... but it's also a bit risky.  I've seen host configurations fail to come back from an unexpected power failure and I've heard stories of hardware damage stemming from such an event.  So, a power failure is probably not the best option... so what else can you try? You could always induce a Host Isolation event .  Simply disconnect all of the network cables from the ESXi host, which will trigger the specified HA response.  That works, but it's a bit of a pain, as you're likely going to need to unplug several cables and keep track of exactly where they belong.  If you're remote, you'll need to involve the network team to get them to shut down specific ports (and you'd better hope that there's no miscommunication rega...

Quick and Easy Datastore Usage Discovery

Have you ever had a full datastore and needed to easily discover which folder was the main culprit?  I’m sure that there are a thousand ways to do this, but one easy one is available from the ESXi host command line.  Either pull up the local console (with the local Shell enabled) or open an SSH session remotely (I know, we’re not supposed to do that anymore!).  Then, navigate to the datastore that you wish to examine with a command like: cd /vmfs/volumes/MyDatastore Once you’re on the datastore, use the “du” command to display disk usage.  If you use the command by itself, it will recursively display the disk usage of all folders/subfolders from your current location in kilobytes.  While that’s useful, it’s not the most user friendly thing in the world.  Instead, I like to use this command: du –m –d 1 That will display the disk usage in megabytes (it would be nice if it had a gigabytes option, but oh well) and will only display the total s...

Executing ThinApps from the CLI

Hi – I’m Jason Coleman and have been working in the virtualization industry since 2005. I’ve decided to start this blog in order to document some of the tips and tricks that I’ve picked up and to give back to the community that’s been so helpful to me as a professional. I’m going to start with an easy one: If you’re like me, you enjoy using Putty from a command prompt or at least invoking it from the “run” dialogue. On a laptop or even a dedicated VDI desktop, this is easily accomplished by placing the executable in a folder that is already contained in your PATH variable. In a floating VDI Pool where Putty is only available to a select group of users, it is slightly more complicated. Here’s how I did it. I packaged Putty with ThinApp and used ThinApp to restrict access (using the permittedgroups entry in the package.ini file) and place a shortcut into an appropriate directory. Packaging Putty is about as easy as it gets – it’s a standalone executable. Literally, run your presca...