vSphere Management Assistant

From vWiki
Jump to: navigation, search

Setup

Install vMA Appliance

  1. Get the OVF URL of the latest version from http://www.vmware.com/support/developer/vima/
  2. Import OVF into vCentre
    • You'll need to specify a cluster/host, datastore, and hostname
  3. Once imported, power on
  4. The VM will go into a Wizard
    • Update IP information
    • Enter a passsword for the vi-admin account (dictionary words not allowed)

Setup Date Time

  1. Remove existing date time zone
    • sudo rm /etc/localtime
  2. Add link to appropriate locale
    • sudo ln -s /usr/share/zoneinfo/Europe/London /etc/localtime
  3. Enable NTP daemon
    • sudo chkconfig ntpd on
  4. Edit the NTP config file to add your NTP server(s)
    • sudo vi /etc/ntp.conf
    • Edit the server entries as required
  5. Start the NTP daemon
    • sudo /etc/rc.d/init.d/ntpd start

Add ESX to vMA

  1. Log into the vMA as vi-admin
  2. Use vifp addserver command to add ESX and enter root password
    • EG vifp addserver esx-server.domain.com
  3. To test, set the session to use the server
    • vifptarget --set esx-server.domain.com
  4. and show NICS
    • vicfg-nics -l
  5. To enable logging for all servers
    • vilogger enable

Enable root

Normally there should be no reason to run as root, everything you need to do can be done via sudo.

  1. Set root password to something you know
    • sudo passwd root
  2. Enable root to login, edit /etc/passwd , and change the root line to
    • root:x:0:0:root:/root:/bin/bash

vilogger

Command Description
vilogger enable Enable vilogger for all connected hosts
vilogger list List vilogger hosts and status
vilogger disable Disable vilogger for all hosts
sudo /etc/init.d/vmware-vilogd restart Restart the vilogger service

Service Checker

For me the vilogger service has a habit of giving up monitoring of hosts, therefore I've written the following script to check for failures, and restart as appropriate. Note that the script looks for more than 10 fails (there's 3 logs per ESX, so logging has to fail for at least 4 ESX's before the script tries to restart). This is to allow for the occasions when ESX's are genuinely down, and I don't want the logger service being restarted every minute.

#!/bin/sh

NUMFAILED=`vilogger list | grep -c Failed`

if [ $NUMFAILED -gt 10 ]; then
        echo "`date` Restart the service"
        /etc/init.d/vmware-vilogd restart
else
        #echo "`date` Don't restart the service"
fi

The above is placed in the file /home/vi-admin/scripts/vilogger_check <code> and scheduled to run every minute by adding the following line to <code> /etc/crontab

  • /2 * * * * root /home/vi-admin/scripts/vilogger_check >> /home/vi-admin/scripts/vilogger_check.log 2>&1

Note that you need to Enable root in order for the script to run