Category: Automation


Monday Morning PowerCLI & Veeam Goodness!

Its been a busy weekend – not only have I been to a most excellent Chilli Festival but I’ve been migrating the backend storage for my 2 Veeam Proxies from a temporary LUN on our main IBM XIV over to a dedicated MSA p2000 . Its cost effective and will allow us to replicate the backup data offsite for some extra resiliency. Its taken me a while but now that I have plenty of storage , I wanted to be able to crank up the retention time for the backups from the current 14 days.

 

If you’ve read the previous posts about the setup I have , you’ll remember that its split into a fair number of jobs , which I didn’t particularly fancy having to mod via the GUI. I remembered that there was a Powershell plug-in for Veeam backup installed with the application , so thought I’d open up the help file and see if this could be scripted.

 

You’ll be glad to know it can. With the following command I was able to add an extra 5 days retention to all backup jobs on the server. I’ll keep an eye on the consumed storage by this and hopefully be able to up retention to a target of 30 days.

 

Get-VBRJob|Set-VBRJobOptions -RetainCycles 20

I’m the furthest thing from a  powershell guru that you’ll ever imagine , but can still string a 1 liner together when I have to :)

image

In a series of briefings from VKernel over the last few months we’ve seen upgrades to their core products , and a number of entry point free applications designed to give you taster of the power of the core products.

One of the points that I bought up every time I engaged with the vendor was that there was a fairly low level of integration between the products , and I felt that VKernel was really missing out by not blending these apps together , not only at the front end , but at the back end , as its clear there was a good level of duplication of data between them.

I’ve come to realise over the last 24 months that VKernel is pretty good at listening to its end users and the feed back I got was that an integrated platform was on its way. Wait no more , as its finally arrived.

Introducing the VKernel Capacity Management Suite 2.0

The Product is currently in private beta , but should be available to play with if you are lucky to get to go to VMworld in San Francisco – the rest of us will just have to hope for a beta invite pre GA , or Trial it on release. The CMS combines a number of the core VKernel product lines into a single appliance and claims to give improvements in 3 Keys areas , namely Scalability , Analytics & automation. The Suit integrates Capacity Analyser 5.0 , Optimization Pack 2.0 , Chargeback 2.0 and Inventory 2.0. The features are licensed individually and start at $299 per socket.

By combining the back end database requirements of the Capacity Analyser , & Optimisation Pack and Modeller ( due for roll into the CMS at a later date ) – the load on the vCenter API is considerably reduced. I’ve seem problems caused by too many requests to vCenter at once and will be glad to be able to reduce this where possible.

VKernel seem to have borrowed a page from Veeam’s business view homework and integrated an ability to create a more customised view of your environment , not just the vCenter hierarchy . Group can be organised by business unit , SLA or any particular way you define them. This is particularly handy where you implement a chargeback model as different groups may have different rates of chargeback. Previous incarnations of the VKernel products did allow this to happen , but the grouping were not shared between appliances , which made it a bit of a pointless exercise. With common grouping between each appliance that can contain VM’s from a number of vCenter instances , you are able to really see things through that mythical single pane of glass. The levels of capacity analysis can be varied between groups including implementing a custom vm model at each stage ( Data centre , Cluster , resource group or custom group )

Any capacity management solution is only as good as its analytics and its where VKernel believe they are best in class within the Virtual World. with CMS 2.0 the VKernel have made some key improvements to the main analytics engine , this includes the use of storage throughput data in capacity calculations so that you are not longer just looking at CPU/ RAM / Drive Space when it comes to capacity calculation. Thin provisioning support is also provided, I personally haven’t seen the types of recommendation for this but would like to see recommendations on which VM’s can be safely thin provisioned due to a lo rate of drive space consumption. As previously mentioned , the “model” vm can be tweaked for different groups so you are not limited to a once size fits all recommendation for available capacity. You are also able to graph a number of VM parameters against each other so you can see what has changed over time and how its affected other parameters. An example of this is shown here.

image

A feature missing from a number of other available solutions is the remediation side. Its all very well and good telling me where I should make the changes to a number of vm configurations , but in a large installation , its going to take me a long time to implement those recommendations. with CMS 2.0 its possible to remediate virtual machines based on the recommendations made ( some changes will require a virtual machine reboot, and these can be scheduled for off peak times ) The remediation screen will look something like below.

image

The notable exception to this is the “storage Allocation” option. I can see this being a tricky one , as it would involve shrinking of the guest drive , which might present a few issues on older windows guests. In the future perhaps an option could be implemented to migrate the VM to being thin provisioned ?

I was able to go through a live demo of a pre beta version of the product and the first thing you notice is the new Dashboard – a lot of work has gone into the redesigned UI and its a welcome improvement !

image

Users of the Optimization pack will find the layout quite familiar , with the Vm tree on the right hand side and the available appliances along the top. The The dashboard gives you a good at a glance view of the environment , before you start to drill down. What is a new features is being able to drill across – selecting a given branch of your environment , be it a traditional VI view or a custom grouping , then moving across the top icons you can click to view Capacity Bottle necks and available capacity , then move to the optimization features and see when in that branch you are not making the most effective use of your resources. As with previous versions of the product , any report you generate can be scheduled & emailed.

In some ways the unsung hero of the older versions of the optimization pack , the Inventory product has matured to a fully standalone offering. In use , its a great way to get detailed information on your virtual estate. Its essentially an indexed view of all of the virtual machines in your environment that you can organise , sort and export as you wish. In a previous life I used to use inventory to automatically mail summary list of VM’s by application to our financials teams to use in their static chargeback model as is gave a very easy way of showing total resource allocated to a VM ( including a sum of storage allocated ) . I’m sure you could find a number of extra uses – how about generating an XML export that your CMDB could pick up from ? In addition to the tabular information , its also possible to extract some pretty detailed information on a VM as shown below.

image

When CMS 2.0 is released – you’ll be able to grab a trial and see for your self. I’m looking forward to it :)

little foot note – speaking of rings , I proposed to my partner on Friday and am happy to report that she said yes ! :)

One of the great things about working in a large environment is the budget for tools to make your life easier , or run more smoothly. However this isn’t always the case – sometimes that budget gets pulled mysterious from under your feet ( and the Director gets a new Jag.. no connection ;) )or sometimes its just not there. Nomatter what the size of your shop , there are still challenges which are not going to go away overnight. There is however a light at the end of the tunnel in the form of freeware tools , which I’ve blogged about on numerous occasions. My efforts in reporting these free tools are nothing compared with a fellow tweep @KendrickColeman who has put together pretty much the most comprehensive guide to what you can get for free to help you out.

 

Not a gent to rest on his laurels , he’s gone one better than that and put together a great bundle of these in an iso which really should make its way onto a datastore near you now.

 

First thinks first, get downloading the file – while thats happening , take a look at what awaits.

http://www.kendrickcoleman.com/images/documents/VM_Advanced.iso

 

The ISO is split into 6 folders , each covering an aspect of your day to day work.

1. P2V Cleanup

Always a fun thing to do but a few very handy little scripts & tools to make it nice and smooth. It’ll save me having to copy the HP PSP Cleaner to every box for a start.

2. Hal upgrade / Downgrade

Sometimes you have to do this as part of a post P2V operation or when you’ve finally caved into that application team naggin for the extra vCPU ( Man up and learn to say no next time , okay ! ) and then found out it makes no difference to the app performance , so have to downgrade the HAL again after removing the vCPU.

3. Partition Alignment

sadly Kendrick wasn’t able to include all the tools he wanted to on this ( while they are free , he wasn’t allowed to redistribute ) – but to get your Windows 2003 VM’s running as best as they can, you really want to work through a few of these.

4. Reclaim Space

Thin provisioning is a wonderful thing , but  all it takes is some bright spark to try and defrag the VM or copy a large file temporarily and the drive fills out quicker than my jeans on a trip to the US. Use Sdelete to zero out the deleted space and svmotion to thin the VM back out again.

5. Analysis

At some point in life , it will be necessary to do a little bit of benchmarking , be it on new storage or hardware. using iometer to generate comparative results of a VM’s performance pre & post aligning , or on a new datastore , or Loadstorm to stress test that new cluster should help you achieve that.

6. Sysprep files

Last but not least , these will save you the download for when you deploy a new vCenter and need to set up guest customisation.

 

If anyone would like to create a pretty front end menu for these – then get in contract with Kendrick – his mail address is in the post.

 

http://www.kendrickcoleman.com/index.php?/Tech-Blog/vm-advanced-iso-free-tools-for-advanced-tasks.html

I’ve recently had to put some documentation together on bringing our patching of ESX hosts into line with patching procedures for other inventory items in our estate. While the actual patching is straight forward, getting data out of the process to show the compliance level of the hosts is not so straight forward.

Yet again , powerCLI to the rescue , with its champion Alan Renouf has discovered that an additional download to the powerCLI package allows us to interrogate VUM , as well as scan and remediate hosts. Hopefully with bribary of a number of beers an external report that I can pass to our security teams with baseline compliance for any number of hosts may well appear on his site soon….

vesi.jpg

One of the nicer wins for us in vSphere was that Round-Robin multipathing support was taken from experimental to full support. In order to take advantage of this my colleague had a large number of pathing policies to change – something of the order of 700 individual operations if done through the VI Client.

This is of course a big stack of work that’s error prone and something we’d want to avoid. On the previous VI3.5 environment this would have been done with scripting at the service console, however our new environment is based on ESXi – of course we could possibly use The vSphere Management Assistant however I felt there may well be a more elegant solution based on powershell.

Powershell adoption in a team of GUI-Jockeys can be a bit of a challenge but Quest have provided an ideal tool and for free too in the form of the Virtualisation EcoShell Initiative Which compiles a number of powershell scripts into an easy to use interface – it also allows you to import “Powerpacks” of scripts from other Powershell gurus such as  Alan Renouf to do all multitude of actions with your Virtual Infrastructure.

That said , I couldn’t find a way of bringing up the pathing policy for a given datastore on a host. I thought it would be a handy list to have in the VESI window.

A couple of twitter posts  later and a fresh, crisp email from Scott Herold arrived with some neatly written scripts and a how-to , which is below.

First thing to note is that you MUST be using PowerCLI 4.0 Update 1 for these scripts to work.  I didn’t write them with all the Gold 4.0 EcoShell session management requirements.

1)      Once you get connected up to a vCenter server, choose the top-level Hosts node.

2)      Right-Click on the “Links” heading in the Actions pane and choose New -> Script Action

3)      Give it a fancy name at the top like “SCSI LUNs” and paste the following code block into the code window

$input | ForEach-Object {
$vmh = $_.Name
$sl = $_ | Get-ScsiLun
$ds = $_ | Get-Datastore | Get-View
$sl | ForEach-Object {
$assocVMFS = "No VMFS/RDM"
$slcn = $_.CanonicalName
$ds | ForEach-Object {
$vmfs = $_
$_.Info.Vmfs.Extent | ForEach-Object {
if ($_.DiskName -eq $slcn) {
$assocVMFS = $vmfs.Name
}
}
}
$_ `
| Add-Member -MemberType NoteProperty -Name VMHost -Value $vmh -PassThru `
| Add-Member -MemberType NoteProperty -Name AssocVMFS -Value $assocVMFS -PassThru
}
}

4. The above block does a bunch of extra intelligence that applies the Host Name as well as the VMFS mapping, assuming it is mapped to a VMFS.  This is not the case for RDMs or LUNs that have not yet been formatted.
5.Before clicking OK and exiting the code window, Click on the “Display Configuration” button in the top-left corner under the action title bar.
6.Under the “Display Results” section, choose “Display the results in a nested view”.  This will tell EcoShell to use the breadcrumbs across the top so you see your navigation from Hosts -> SCSI LUNs. Failure to do this step will give off the appearance that the script doesn’t work.
7. Once you’ve made the change, Click OK to exit the Configuration Properties and again to save and exit the new script.In the Admin Console, select one or more hosts and choose the new SCSI LUNs link.  You should be returned a list of results

Step 1 is now complete.  You should get a list of SCSI LUNs mapped to the particular Host or Hosts you selected.  You will want to Right-Click on one of the column headings and show some additional columns to add additional value to the view.  My view looks like the following.


You will notice I have columns for Associated VMFS and the VMHost.  These are properties that VMware does NOT apply to the default cmdlet output.  This is where EcoShell shines over standalone console.  You can now export this data view in XML, CSV or HTML and have a report of all multipath policies across all ESX Hosts in your infrastructure.  You can even use filters to highlight and narrow down results that meet a certain criteria, like when MultipathPolicy doesn’t equal RoundRobin.

1. Right Click anywhere in the blank space in the Actions bar on the right side and again choose a new  script action.

2. Give this one a name of “Set Multipath Policy” and paste the following code

switch (Read-Choice 'Mulitpath Policy' 'What would you like the new multipath policy for the selected LUNs to be? (Note, this is a per HOST per LUN setting)' 'Fixed','Round Robin','Most Recently Used' 0) {
0 { $mpPolicy = "Fixed" }
1 { $mpPolicy = "RoundRobin" }
2 { $mpPolicy = "MostRecentlyUsed" }
}

$input | ForEach-Object {
if ($mpPolicy -eq “Fixed”) {
$cn = $_.CanonicalName
$slp = @()
$slp += Get-VMHost $_.VMHost | Get-ScsiLun | where {$_.CanonicalName -eq $cn} | Get-ScsiLunPath
Get-VMHost $_.VMHost | Get-ScsiLun | where {$_.CanonicalName -eq $cn} | Set-ScsiLun -MultipathPolicy “Fixed” -PreferredPath $slp[0]
}
else {
$_ | Set-ScsiLun -MultipathPolicy $mpPolicy
}
}

3. Again, click on the Display Configuration button.  This time, change the dropdown under the “Category” section to be listed under “Actions”.  Click OK Twice to exit to the Admin console and save the new script.  Note, that in the script above, I am creating a user input selection to allow you to choose Fixed, RR, or MRU.  In order to choose Fixed, VMware forces you to select a Preferred Path value, so I have the conditional statement set up to trap the Fixed parameter.  I then have to create a collection object and add each SCSILunPath object to it.  I force create it as a collection $slp = $() so that even if only one object is returned, the set-scsilun command will work against $slp[0], which is just the first path returned in the llist.  Generic and a total cop out, but it works no matter what the situation is.

4. Once you are in the Admin console you can now single or multi-select your SCSI LUN paths armed with the knowledge of what Host they are on and what VMFS they are mapped to in order to make the most educated choices in bulk multipath management….and it’s a HECK of a lot easier than using vCenter.

I worked through Scott’s document this morning and can say it works an absolute treat , will definatly be using it for any pathing changes in the future.

All credit for the script goes to Scott Herald at Quest – I just thought of the idea….

Powered by WordPress | Theme: Motion by 85ideas.