8 augustus 2007
How To: Setup MGE Network Shutdown Module V3 op het service console binnen VMware ESX 3.0.2
Arne Fokkema Ictfreak.wordpress.com
MGE Network Shutdown Module V3
In deze korte how to lees je hoe je de network shutdown module van MGE installeerd op het Service Console van VMware ESX 3.0.x. De software die je nodig hebt is de Network Shutdown Module Linux x86 Console. De software kun je hier downloaden: http://www.mgeups.com/. Verder vindt je hier een Whitepaper: http://www.mgeups.com/.
Zodra de software binnen is kunnen we beginnen.
Stap 1. De software installeren. Upload het bestand nsm_linux_cli_3_02_09.run naar de /tmp folder op een ESX server die als basis gaat dienen. Vervolgens installeer je de software met het volgende commando: ./nsm_linux_3_02_09_kvk.run -install -silent Open nu de benodigde poorten op de firewall met de volgende commando’s:
8 augustus 2007
esxcfg-firewall -o 4679,tcp,in,MGEhttp esxcfg-firewall -o 4680,tcp,in,MGEhttps esxcfg-firewall -o 80,tcp,out,http
MGE Network Shutdown Module V3
Stap 2. De basis configuratie maken. Vervolgens start je een browser op vanaf een Windows of Linux machine en navigeer je naar de volgende pagina: http://<esxserver>:4679/mgeups/ of via https://<esxserver>:4680/mgeups/ Het onderstaande scherm komt te voorschijn.
Configureer hier al je settings (wil je hulp kijk dan hier nsm_user_guide_en_30.pdf). Zodra je hiermee klaar bent druk je op de optie packaging.
8 augustus 2007
Hiermee maak je een custom installatie pakketje aan. Deze kun je later over je andere esx servers verspreiden met daarin jouw settings.
MGE Network Shutdown Module V3
Shutdownscript shutdown.sh. #!/bin/sh # -----------------------------------------------------------------------------------------# Unix Unified Shutdown Script for Network Shutdown Module # -----------------------------------------------------------------------------------------# $1 = An optional shutdown delay in milliseconds to keep care of other action execution # $2 = The shutdown type # $3 = An optional shutdown option # -----------------------------------------------------------------------------------------# Customisable Vmware ESX shutdown stopVMWare() { # Test if we have a Vmware ESX v3 setup if [ -x /usr/bin/vmware ] then ESXV3=`/usr/bin/vmware -v | grep "ESX Server 3"` if [ -n "$ESXV3" ] then # Get the VM list VMLIST=`/usr/bin/vmware-cmd -l` for VM in $VMLIST do # Get the VM state VMSTATE=`/usr/bin/vmware-cmd "$VM" getstate -q` # Guest OS shutdown if VMSTATE is equal to "on" if [ "$VMSTATE" == "on" ] then /usr/bin/vmware-cmd "$VM" stop trysoft # delay a bit the next sequence sleep 2 fi done # Delay for 1 minute to give the VMs more time # to cleanly shutdown sleep 60 fi fi
8 augustus 2007
} # determine Unix version System="`uname`" # switch to root folder not to block partition umounting cd / # Process the shutdown delay # Unix shutdown take a delay in minutes!
MGE Network Shutdown Module V3
if [ -z "$1" ]; then # default to 0 second if nothing specified SD_DELAY="0" else SD_DELAY="`expr $1 / 1000 / 60`" fi # Process the shutdown type # FIXME: everything default to shutdown for the moment case $2 in # "-shutdown"|"shutdown") # "-poweroff"|"poweroff") # "-standby"|"standby") # "-noforce"|"noforce") *) SD_TYPE="shutdown" esac # switch on System to determine shutdown command # FIXME: Process the shutdown option ($3) # and use $SD_TYPE if [ $System = "SunOS" ]; then SHUTDOWN_CMD="/usr/sbin/shutdown -y -g0 -i0" STANDBY_CMD=$SHUTDOWN_CMD elif [ $System = "Linux" ]; then if [ -f /sbin/shutdown ]; then SHUTDOWN_CMD="/sbin/shutdown -h +$SD_DELAY" STANDBY_CMD=$SHUTDOWN_CMD elif [ -f /usr/sbin/shutdown ]; then SHUTDOWN_CMD="/usr/sbin/shutdown -h +$SD_DELAY" STANDBY_CMD=$SHUTDOWN_CMD fi elif [ $System = "HP-UX" ]; then SHUTDOWN_CMD="/etc/shutdown -y -h +$SD_DELAY" STANDBY_CMD=$SHUTDOWN_CMD elif [ $System = "AIX" ]; then SHUTDOWN_CMD="/usr/sbin/shutdown -h +$SD_DELAY" STANDBY_CMD=$SHUTDOWN_CMD fi
8 augustus 2007
# Stop VMware guest OSs stopVMWare # Do the actual system shutdown action case $SD_TYPE in standby) `$STANDBY_CMD` ;; shutdown) `$SHUTDOWN_CMD` ;; esac MGE Network Shutdown Module V3
Stap 3. Dit alles door middel van UDA. Maak het onderstaande script aan en plaats deze samen met de nsm_linux_3_02_09_custom.run (gemaakt in stap 2) ergens op een nfs share. installmge.sh ## Open Firewall ports for MGE UPS esxcfg-firewall -o 4679,tcp,in,MGEhttp esxcfg-firewall -o 4680,tcp,in,MGEhttps esxcfg-firewall -o 80,tcp,out,http ## Copy and Install the software cp /vmfs/volumes/iso/mge/nsm_linux_3_02_09_kvk.run /tmp cd /tmp chmod 755 nsm_linux_3_02_09_kvk.run ./nsm_linux_3_02_09_kvk.run -install -silent # The software is installed in the following folder: /usr/local/MGE/NetworkShutdownModule Voeg vervolgens de volgende code toe aan het %post script binnen je ks.cfg op UDA. ## Install MGE UPS Software cp /vmfs/volumes/iso/mge/installmge.sh /tmp cd /tmp chmod 755 installmge.sh touch installmge.sh
8 augustus 2007
./installmge.sh
MGE Network Shutdown Module V3
8 augustus 2007
Zoals je ziet is het niet meer zo complex om de UPS software te installeren binnen het Service Console van VMware ESX 3.0.x
MGE Network Shutdown Module V3