Wednesday, January 14, 2015

Dell PERC command-line utility program perccli

This tool apparently works for all PERC9 controllers and the following operating systems are supported:
Novell SuSE Linux ES 11 
MS Windows Server 2012 
Red Hat Ent Linux 6 
Red Hat Ent Linux 7 
SUSE Linux ES 12 
MS Windows Server 2012 R2/SP 
MS Windows 2008 R2

Binaries are at: http://www.dell.com/support/home/us/en/19/Drivers/DriversDetails?driverId=3XDPP

HTML version of manual: http://www.dell.com/support/Manuals/us/en/19/Topic/poweredge-rc-h730/PERC_CLI_RG_Pub-v1/en-us

PDF of manual: http://topics-cdn.dell.com/pdf/poweredge-rc-h730_Reference%20Guide_en-us.pdf

Monday, January 5, 2015

Phonetic Alphabet of Confusion

I wanted to make a phonetic alphabet chart, but with words that all have the "wrong" sound at the start. e.g.A as in "aisle" I shamelessly stole most of this from

http://www.reddit.com/r/videos/comments/2g3fcw/i_had_another_phone_scammer_try_to_call_me_so_i/ckfs07x

I'd wanted to use words instead of names if possible (e.g. for "I", I'm used "Ian" because I couldn't find a word that starts with I but has an "e" or other sound.)

I thought about going through the Wiktionary database but that will take a while to program maybe...

Anyway, here's what I have so far:

A - aisle
B - bdellium
C - czar
D - djinn
E - euphrates
F - effluent (I would prefer a word that starts with "F")
G - gnome
H - honor
I - Ian  (can you think of a word not a proper name?)
J - jalapeno
K - knickers
L - elephant (I would prefer a word that starts with "L")
M - mnemonic
N - Nguyen (resorted to foreign language here :( )
O - ouija board
P - pterodactyl (bonus:  P sounds like T ) 
Q - qat
R - arse (I would prefer a word that starts with "R")
S - schadenfreude (can you think of a non-foreign word that starts "sch"
but sounds like "ch"?)
T - Tsunami (foreign origin, but has been adopted as English so I don't
feel bad about this one)
U - urn
V - vrow (frau) (optionally "vee") 
W - wren
X - Xian  (X is weird anyway, most words sound like "Z" anyway, so I
went with an "Sh" sound (Shee-an) instead! but again - it's a foreign
name, can't think of a word)
Y - yperite
Z - Zsa Zsa  (proper name :( )

Sunday, June 1, 2014

Perl script to quiz you for ARRL Ham radio exam

I've been studying for the Technician class amateur radio license. The ARRL sells a book that includes a CD with some nice software for practicing tests. However, if you don't have the book and/or CD, you might want to practice the test questions anyway. So I wrote a perl script that reads the text version of the question pool ( 2010 version or 2014 version), then asks you questions from it. example run:
# study.pl ~/Downloads/question_pool.txt

enter question # (blank for random question) or Ctrl-C to exit :

T6B07
What does the abbreviation "LED" stand for?
A. Low Emission Diode
B. Light Emitting Diode
C. Liquid Emission Detector
D. Long Echo Delay


answer? A
*** WRONG!      correct answer is (B)

enter question # (blank for random question) or Ctrl-C to exit :

T7A07
If figure T5 represents a transceiver in which block 1 is the transmitter portion and block 3 is the receiver portion, what is the function of block 2?
A. A balanced modulator
B. A transmit-receive switch
C. A power amplifier
D. A high-pass filter


answer? b
CORRECT!
Download the script

Thursday, April 3, 2014

Automating the VMware vSphere Perl SDK install with expect:


I couldn't find any other postings on the net about this, so here's my solution for automating the installation for the VMware vSphere Perl SDK on RHEL6 (this assumes you already have all the prerequisites installed.).  It probably works on any Linux OS but I only tested it on RHEL6.4.

Save this expect script (requires expect to be installed, duh!) in the same directory as the extracted tarball for the SDK (probably vmware-vsphere-cli-distrib/):
#!/usr/bin/expect

set timeout 120

spawn "./vmware-install.pl"

expect "Press enter to display " { send "\r" }
expect "vSphere Software Development Kit License Agreement" { send "q" }
expect "Do you accept" { send "yes\r" }
expect "Do you want to install precompiled Perl modules for RHEL" { send "\r" }
expect "In which directory do you want to install the executable files" { send "\r" }
# Wait for installation to finish
expect EOF
This accepts the defaults ("yes" to installing precompiled perl modules, "/usr/bin" for the installation directory) If you don't like that, edit the script!

SSH tunnel to multiple vSphere/ESXi hosts

An SSH tunnel to a single host is easy; reference: http://www.virtuallifestyle.nl/2010/03/tunneling-a-vsphere-client-connection-over-ssh/

However, if you want to open the vSphere client multiple times for simultaneous connections to multiple ESXi/vCenter hosts, then you have to get a little creative. Basically you follow the same instructions as above, except you don't need to edit the hosts file. Just use a single address in the loopback network (127.0.0.2 - 127.255.255.254 ) for each remote ESXi host.  e.g.:

ESXi host Tunnel Source Tunnel Destination
host1 127.0.0.2:443 esxhost1:443
host1 127.0.0.2:902 esxhost1:902
host1 127.0.0.2:903 esxhost1:903
host2 127.0.0.3:443 esxhost2:443
host2 127.0.0.3:902 esxhost2:902
host2 127.0.0.3:903 esxhost2:903

Then simply connect vSphere client to one of the loopback addresses you used.  In the example above, to connect to esxhost1, you connect vSphere Client to 127.0.0.2.  For esxhost2, 127.0.0.3.

You should be able to make up to ~16 million tunnels this way!

NOTE: When using an SSH tunnel, the vSphere Client will not show the "Hardware" tab for your hosts.

Monday, November 25, 2013

Perl script to convert JPL Horizons Ephemeris data to Celestia SSC Elliptical Orbit Parameters

With Comet ISON coming up, I've been playing with Celestia a bit to see if I can get it to show me with reasonable accuracy where the spacecraft SDO and STEREO (-A and -B) are in relation to the comet.

Long story short -- I had to make my own Celestia ".ssc" files to describe the spacecraft. Using the JPL HORIZONS web interfaceyou can get recent orbital elements, but you have to convert these to something Celestia will understand (an "EllipticalOrbit" stanza in the ".ssc" file).

The perl script below does the conversion; just run it and paste in a single block of Ephemeris data like this:

2456621.500000000 = A.D. 2013-Nov-25 00:00:00.0000 (CT)
 EC= 4.143129880700237E-02 QR= 9.996672652291025E-01 IN= 2.936558964716465E-01
 OM= 3.363978705358475E+02 W = 1.469845587993808E+02 Tp=  2456458.185749091208
 N = 9.254559117051611E-01 MA= 1.511401389693867E+02 TA= 1.533315740323342E+02
 A = 1.042874927988944E+00 AD= 1.086082590748784E+00 PR= 3.889974610856358E+02
And you'll get output line this:
EllipticalOrbit
{
        Epoch 2456621.500000000
        Period 1.06499689086802
        SemiMajorAxis 1.04287492798894
        Eccentricity 0.041431298807
        Inclination 0.293655896472
        AscendingNode 336.397870535848
        ArgOfPericenter 146.984558799381
        MeanAnomaly 151.140138969387
}
The perl script is below, or you can download it here.
#!/usr/bin/perl -w

# input an ephem set like this:
#2456621.500000000 = A.D. 2013-Nov-25 00:00:00.0000 (CT)
# EC= 4.143129880700237E-02 QR= 9.996672652291025E-01 IN= 2.936558964716465E-01
# OM= 3.363978705358475E+02 W = 1.469845587993808E+02 Tp=  2456458.185749091208
# N = 9.254559117051611E-01 MA= 1.511401389693867E+02 TA= 1.533315740323342E+02
# A = 1.042874927988944E+00 AD= 1.086082590748784E+00 PR= 3.889974610856358E+02

# output like this:
#        EllipticalOrbit
#        {
#                Epoch 2456621.500000000 # = A.D. 2013-Nov-25 00:00:00.0000 (CT)
#                # reference http://www.lepp.cornell.edu/~seb/celestia/transforming_ephemeris.html
#                Period 1.06499689086801936 # P = (q/(1-e))^1.5 for a closed, elliptical orbit (q = QR, e = ER)
#                SemiMajorAxis 1.04287492798894325 # a = (q+Q)/2, where Q is Apoapsis distance (AD in horizons ELEMENTS)
#                Eccentricity 0.04143129880700237 # (EC)
#                Inclination 0.2936558964716465 # (IN)
#                AscendingNode 336.3978705358475 # (OM)
#                ArgOfPericenter 146.9845587993808 # (W)
#                MeanAnomaly 151.1401389693867 # (MA)
#        }

my ($Epoch, $EC, $QR, $IN, $OM, $W, $Tp, $N, $MA, $TA, $A, $AD, $PR);
my ($Period, $SemiMajorAxis);


print "Input a single block of ephem data\n";

while () {
        if ( /^((\w|\.)+)/ ) {
                $Epoch = $1;
        }

        if ( /EC=/ ) {
                ($EC, $QR, $IN) = (split())[1,3,5];
        }

        if ( /OM= / ) {
                #$_ = readline; chomp;
                ($OM, $W, $Tp) = (split())[1,4,6];
        }

        if ( /N = / ) {
                #$_ = readline; chomp;
                ($N, $MA, $TA) = (split())[2,4,6];
        }

        if ( /AD= / ) {
                #$_ = readline; chomp;
                ($A, $AD, $PR) = (split())[2,4,6];
                last;
        }
}

$Period = ( $QR / (1 - $EC) )**1.5 ;
$SemiMajorAxis = ( $QR + $AD ) / 2 ;

print "EllipticalOrbit\n";
print "{\n";
print "\tEpoch $Epoch\n";
print "\tPeriod $Period\n";
print "\tSemiMajorAxis $SemiMajorAxis\n";
print "\tEccentricity " . sprintf("%12.12f\n",$EC);
print "\tInclination " . sprintf("%12.12f\n",$IN);
print "\tAscendingNode " . sprintf("%12.12f\n",$OM);
print "\tArgOfPericenter " . sprintf("%12.12f\n",$W);
print "\tMeanAnomaly " . sprintf("%12.12f\n",$MA);
print "}\n";

Friday, July 19, 2013

non-existent remote syslog server causes SSH and su to pause/hang

I recently setup a VMware lab for a project at work. As a quick start, I used some of our existing kickstart deployments (actually using cobbler), which included a bunch of operational configuration items.

Soon my users were experiencing some issues on logging in via SSH. The symptom was one of the following would occur:

  • User would immediately get the error "ssh_exchange_identification: Connection closed by remote host"
  • User would have to wait ~20 seconds to get a password prompt. After entering a password, another ~20 seconds would pass before getting the shell prompt.

I did a lot of different things to try to find the problem. I found that rebooting the system resolved the issue temporarily. Exacerbating the issue was that only a couple systems were experiencing the problem -- not all of them. So at first I discounted it being an issue with the configuration of the system. I chased the red herring of a certain application we were running on *only* those systems.

Another symptom of the issue was that "su" would also pause for ~20 seconds before presenting the password prompt, so I knew it wasn't limited to sshd.

Eventually I found the problem by doing the following:

 # strace su -
[...]
###  The output would pause here:
    connect(3, {sa_family=AF_FILE, path="/dev/log"}, 110) = 0
    sendto(3, "<86>Jul 19 16:36:59 su: pam_unix"..., 96, MSG_NOSIGNAL, NULL, 0) = 
/dev/log is a UNIX domain socket, used by the syslog (and rsyslog) daemons. The system was trying to write to the socket, and it was taking a long time.

When I looked at the config file (/etc/rsyslog.conf), I found that it had been setup to log to a remote server on our production network. Of course, the lab did not have access to the production network! So rsyslog was trying to log to a non-existent system.

The fix was simply to remove the non-existent remote syslog server from rsyslog.conf and restart syslog.

Why didn't *all* the lab systems have the same problem? I believe this is because the "problem" systems had much more syslog messages than the other systems -- due to the application we were running on those systems. So it was only indirectly related to the application!