Saturday, June 21, 2008

ESX LUN Load balance

After having fighting my way through the Virtual Client setting the active and preferred path for all my currently 22 Lun's on my 24 ESX servers to load balance the load over as many HBA's as possible i looked at the script i could find on the net and saw that the scripts all set the paths to the same for all hosts.
 
I was looking at different scripts out there and found the one below. I need an idea on how to randomize some of this because otherwise it will always be the same om all hosts and if there are 4 hba' as in my case the fourth one will newer be used. I need to set the counter to some random number between 1 and the PATHS value for the hba assignment to start somwhere..   :
#! /bin/bash
#
# by Allan Christiansen/2008 on esx 3.5.0 Update 1
#
for PATHS in 2 4 6 8 10 12 14 16
do
   STPATHS=${PATHS}
   COUNTER=${RANDOM}
   while [[ ${COUNTER} -gt ${PATHS} ]];
   do
      COUNT=`expr ${COUNTER} / ${PATHS}`
      COUNTER=${COUNT}
   done
   for LUN in $(esxcfg-mpath -l | grep "Disk" | grep "has ${STPATHS} paths" | awk '{print $2}')
   do
      esxcfg-mpath --lun=${LUN} --path=$(esxcfg-mpath -q --lun=${LUN} | grep FC | awk '{print $4}' | awk '{print NR "S\t " $0}' | grep ${COUNTER}S | awk '{print $2}') --preferred
      COUNT=`expr ${COUNTER} + 1`
      COUNTER=${COUNT}
      if [[ ${COUNTER} -gt ${STPATHS} ]]
      then
         COUNTER="1"
      fi
   done
done
 
 

Thursday, June 19, 2008

Windows Vista Power Button

After a couple of month with Windows Vista i found that the default behavior of the start menu Power button anoyed me alot, especialy on my Desktop pc. I was researching and playing around and found how to change what the start buttons do.. You can change how the shutdown/sleep buttons function in local group policies (gpedit.msc) COMPUTER CONFIGURATION > ADMINISTRATIVE TEMPLATES > SYSTEM > POWER MANAGEMENT > BUTTON SETTINGS

Changing these values will resolve this idiotic default idea that MS came up with of pressing the power button and it going to sleep....

Another way is in the advanced power settings.


I hope that this can help you out a bit.

Tuesday, June 17, 2008

Vmware ESX

I have for some time been using vmware ESX and found that the software from them is perfect for the growing IT environment that exists in a majority of companies. But i also discovered that managing an environment that is growing fast needs a lot of care and strict procedures. e.g. with vmware there is a possibility to move a vm from one host to another host without user interruption. This is sadly only possible if the cdrom drives are not locked to a iso or otherwise occupied.

I found that running this small powershell script helps alot on that.

Get-VM Get-CDDrive ? { $_.ConnectionState.Connected -eq "true" } Set-CDDrive -Connected:$false -Confirm:$false

This also is a great small script to have in mind when evacuating an ESX. there's nothing more annoying than the last vm will not evacuate because of a mounted cdrom drive or a not ended tools install.

BTW. Thanks alot to Microsoft for the powershell. And for vmware for implementing it in such a great fashion.

Thursday, June 5, 2008

Just another IT Blog? or

Is this just another IT blog?

Yes and no. Yes its a IT blog. and no this is one where i will share the small scripts, gadgets and sniplets i create or piece together from my daily work and travels around the net.

So who am I:

Name : Allan Christiansen
Age : 37 at the moment (Born 1970)

Experience : 20 years of Professional IT. Mostly with Microsoft products but i have also worked some time with Linux. Lately I have worked alot with vmware.

Exams : MCSE 2003 : Messaging / MCSE 2003 : Security / MCTS SQL 2005 / MCP

Hope to see you all around and please have fun while working. It makes it easier to relax.