VMware ESXi 4 Log Files

Like most VI Admins, I've been using VMware ESXi quite a lot more lately and I'm slowly coming across things that are different to how they are in ESX. Log files being one of these differences.

With the absence of the Service Console, ESXi presents a slightly different architecture. If you haven't yet read The Architecture of VMware ESXi, I would recommend having a good read through.

Differences between ESX and ESXi logs

Here is the common log file structure in ESX (Source)

  • /var/log/vmware/hostd.log – ESX Service Log
  • var/log/vmware/vpx/vpxa.log – vSphere Client Agent Logs
  • /var/log/vmware/aam – VMware HA Logs
  • /var/logvmkernel – VMKernel Messages
  • /var/log/vmkwarning – VMKernel Warnings
  • /var/log/messages – Service Console Log

Here is the common log file structure in ESXi

  • /var/log/vmware/hostd.log – ESXi Service Log
  • var/log/vmware/vpx/vpxa.log – vCenter Agent Logs
  • /var/log/messages – Syslog Log (Combines vmkernel & hostd)

Read the rest of this entry »

PowerCLI: A Simple VM Backup Script

Just lately I've been doing a lot of work in a Lab environment. Some of the work I'm doing is quite important to me so I decided to workout a way I can backup my VM's onto a backup device. To my surprise this was pretty simple to do.

Here is how I decided the script should function:

  1. Send myself an email telling me that the backup process has started
  2. Import the name of the VM to be backed up and the destination datastore from a CSV file
  3. Create a Snapshot of the VM I want to backup
  4. Create a Clone'd VM from the Snapshot
    • Place the backup onto my Backup Datastore
    • Name the backup <master VM name>-<date stamp>
    • Thin provision the backup
  5. Remove the Snapshot from the master VM
  6. Send myself an email telling me that the backup process has completed

So that's what I wanted to do, this is what I ended up with.

Read the rest of this entry »

PowerCLI: Reconfiguring NTP Servers on ESX Hosts

Just lately I’ve been creating a lot of PowerCLI scripts to help configure various aspects of out ESX environment. We’ve just implemented a new NTP Server to our network. So I was given the job to update all of our ESX Hosts. I didn’t fancy spending all morning manually changing them, so I set to work in creating a PowerCLI script to do the business. Here is the result.

$Cluster = "<cluster name>" 
$Hosts = Get-Cluster $Cluster | Get-VMHost 
ForEach ($Host in $Hosts) 
{ 
Remove-VmHostNtpServer -NtpServer "<old ntp server>" -VMHost $Host | Out-Null  
Add-VmHostNtpServer -NtpServer "<new ntp server>" -VMHost $Host | Out-Null 
Get-VmHostService -VMHost $Host | Where-Object {$_.key -eq "ntpd"} | Restart-VMHostService -Confirm:$false | Out-Null 
write "NTP Server was changed on $Host" 
}