Sunday, February 21, 2010

HP Smart Array - Brief Tutorial

HP/Compaq servers use cciss drivers to represent the disks.

This cciss driver doesn't use the regular SCSI stack,
that's why the disks will appear as:

#ls -lah /dev/cciss/
total 0

brw-rw----  1 root disk 104,  0 2008-08-28 14:36 c0d0
brw-rw----  1 root disk 104,  1 2008-08-28 14:36 c0d0p1
brw-rw----  1 root disk 104,  2 2008-08-28 14:36 c0d0p2
brw-rw----  1 root disk 104,  3 2008-08-28 14:36 c0d0p3
brw-rw----  1 root disk 104, 16 2008-08-28 14:36 c0d1
brw-rw----  1 root disk 104, 17 2008-08-28 14:36 c0d1p1

  • c0=controller 0
  • d0=disk 0
  • p1=partition 1
HP offers a CLI tool for Disks information querry / management called "hpacucli" (can be obtained from their page).
This tool can do both (detailed) reporting and management, let's see how it works:

#hpacucli controller all show
Smart Array 6i in Slot 0      ()

#hpacucli ctrl slot=0 logicaldrive all show status

logicaldrive 1 (33.9 GB, RAID RAID 1+0):  OK
logicaldrive 2 (136.7 GB, RAID RAID 1+0):  OK

Let's list the drives on controller in slot 0:
#hpacucli ctrl slot=0 pd all show status

physicaldrive 1:0 (port 1:id 0, 36.4 GB): OK
physicaldrive 1:1 (port 1:id 1, 36.4 GB): OK
physicaldrive 1:2 (port 1:id 2, 146.8 GB): OK
physicaldrive 1:3 (port 1:id 3, 146.8 GB): OK

This tool can be extremely useful when implemented in monitoring scripts.
Also it makes easier on the user instead of searching /var/log/messages

Friday, February 19, 2010

Generate hosts file with Perl

A sweet way to add couple of servers to your hosts file/NIS map using a tiny perl script:

#!/usr/bin/perl -w

use strict;
use warnings;
print `clear`;
my $j=10;

open (HOSTS ,">>/etc/hosts.txt") or die $!;
for (my $num=0;$num <= 10; $num++) {
printf(HOSTS "server$j \t server$ \t 192.168.0.$num\n");
close (HOSTS) or die $! ;


The output will be:



Wednesday, February 10, 2010

Set up SSH on ESXi server

Virtualization has become an integral part of any big IT environment with VMware being the clear market leader. Vmware offers two main version for it's server OS (which hosts the virtual machines - aka VM's ) :ESXi server being the light version and ESX being the "heavy" version. In this short post I will demonstrate how to enable SSH on the ESXi server, which can be used for some remote command line manipulations ;) OK, let's start, After EXSi has been deployed this is the console you will see:

At the console, hit "Alt-F1" to get the first console (you are on the second, by default):


Give the root password to log in.
You should get a shell prompt
with warning:

Please note that this is not a standard Unix/Linux shell, lots of commands are missing and others may behave differently.

Next, we need to enable SSH in inted.conf:

vi /etc/inetd.conf

Uncomment the "ssh" line & save the file.

Find the PID of inetd & HUP it so that the changes take care:

kill -HUP 1234

SSH is enabled from now, feel free to use it for monitoring, scripting etc..