Advertisement

news | articles | utilities | resources | about

vmpimlscan

vmpimlscan.pl

Create hardware alerts without the configuration or use of HP SIM agents [download here]

Prerequisites: To use this script, you will need a working Perl implementation and the VI Perl Toolkit installed. You may also need to install a couple of Perl modules that may or may not be a part of your Perl installation. Installation of these modules is an exercise left to the reader.

IO::Socket::SSL
Net::SMTP
Net::SSLeay

You will also need to a consistent naming convention for your ilo interfaces, and a consistent set of credentials in which to log into the ilo interfaces.

Step 1. Download the vmpimlscan.pl script here.

Step 2. Configure the script: Edit the script using a regular text editor, I prefer to use Notepad++ on a Windows platform, or nano on the unix platform. You will need to modify the section shown below to match your environment.

#--------------------------------------#
# User Configurable Variables          #
#--------------------------------------#

# Configure for one or more VirtualCenter servers, the same vc credentials 
# will be used on all VirtualCenter servers.
my @management_hosts = qw |
  vc1.yourdomain.com
  vc2.yourdomain.com
|;
my $vc_username = 'vc_username';
my $vc_password = 'vc_password';

# Configure ilo postfix ( appended to the end of each ESX host ) and ilo credentials.
# For example, if your VirtualCenter Management server has 3 hosts in it 
# ( esx01.yourdomain.com, esx02.yourdomain.com and esx03.yourdomain.com ) the following
# hostnames will be scanned 
# ( esx01-ilo.yourdomain.com , esx02-ilo.yourdomain.com, esx03-ilo.yourdomain.com ). 
# Servers that are identified by ip addresses only will be ignored.
my $ilo_postfix = '-ilo';
my $GET_IML ='
 < RIBCL version="2.21" >
  < LOGIN USER_LOGIN="ilo_username" PASSWORD="ilo_password" >
   < SERVER_INFO MODE="READ" >
    < GET_EVENT_LOG / >
   < /SERVER_INFO >
  < /LOGIN >
 < /RIBCL >';

# Configure email alerting variables if you would like the alerts to be emailed to you.
my $email_alert_address = 'alert_address@yourdomain.com';
my $email_from_address =  'alert_address@yourdomain.com';
my $email_subject = 'vmpimlscan.pl Scan';
my $smtp_server = 'smtp.yourdomain.com';

# Location of historical alerts, items that are logged to this file 
# ( in plain text ) will not be alerted on successive runs.
my $alert_log = './alert_log.csv';
 
# If for any reason you want one of your hosts to be ignored and not scanned, 
# put one or more hosts in this array ( 1 per line )
my @excluded_hosts = qw |
  brokenesxhost1.yourdomain.com
|;

#------------------------------#
# Fin Configuration            #
#------------------------------#

Step 3. Run the script.

perl ./vmpimlscan.pl

If you're in a windows environment, open a command prompt and execute the script. By default, the script will only output the errors, if you would like the script to be more verbose you can pass the -v flag, or -d for debug output. You can also pass the --email option to have alerts that are generated by the script send out to the configured email address.

The script has been designed to spawn a new process for each ilo connection to reduce the amount of time it takes to run the scan against a large environment, so don't be alarmed if you see a large numer of processes spawned when you launch the script if you are in a large environment.

As always, be sure and test this out in a test environment, it has worked well for me and hopefully it will make your life easier as well

Email dominic@vmprofessional.com with comments or questions.

 
Copyright © 2007 - vmprofessional. All rights reserved.