Saturday, February 21, 2009

Atlantis... Found... or Not

Yesterday, British tabloids reported the discovery of the Lost Continent of Atlantis! The discovery was made, not by intrepid explorers, but by searching Google Earth's maps:

Can you see the highways on the bottom of the Ocean?


View Larger Map

Well, it seems that these highways are simply the paths of the oceanographic ships which mapped the area - Plato can rest easy, his hoax has not been discovered :)

Link to the tabloid "The Sun"

Link to better explanation.

 

-- Robert

Wednesday, February 18, 2009

Finding unassociated Situations

In ITM, after you have created a new situation, you must do two things to it:

  1. You must distribute it to one or more agents. This will determine where a situation runs. i.e you can limit it to specific servers or run it on all of them.
  2. Associate it with some node in a tree in the TEP Portal. This is so that when the situation activates (fires, become true) you will see it in the portal console.

The problem then starts when you want to be sure that all your situations have been distributed and associated properly. The first problem is simpler - you can use a SOAP call on the TEMS to fish out the list of situations and their distributions. The second problem is slightly more complex. The TEPS database hold the list of all situations and associations - but a list of unassociated situations - which are the ones which will not show up even if they become true.

Recently I was at a customer and needed to verify that all situations were indeed associated. I remember seeing something that showed this, but my searching skills betrayed me and I wrote this out quickly. If anyone does have a link- feel free to send it.

Being a quick-and-dirty job (and being rusty with my Perl), this script will only work on the environment it was written for - Windows/SQLServer, but it should be easy to convert
Also, I committed the crime of using system calls in Perl, instead of SOAP and SQL calls embedded in the code - so sue me :)

#!/user/local/bin/perl
# This script will list situations which exist but are not associated with any portal navigator item.
# It is limited to Windows systems running SQLServer, but can easily be modified for any OS/DB combination. :)
# Part 1 - list all situations from TEMS
# Part 2 - list all situation associations from TEPS
# Part 3 - Find which situations exist in part 1 but not part 2
#
# Robert Barron Feb-2009

my $sSitListFile = "SitList.txt";
my $sSitAssocFile = "SitAssocList.txt";
my $sTEMSHOST = "x.x.x.x";
my $sTEMSUser = "xxxxxx"
my $sTEMSPassword = "xxxxxx";
my $sTEPSHOST = "x.x.x.x";
my $sTEPSUser = "xxxxxx"
my $sTEPSPassword = "xxxxxx";

# Part 1
#  login to TEMS and pull out a list of situations

system ("tacmd login -s " . $sTEMSHOST . " -u " . $sTEMSUser . " -p " . $sTEMSPassword);
if (-e $sSitListFile) {
    unlink ($sSitListFile);
}

#Run tacmd listsit and extract the first  string from each line.
# NOTE: This line must be modified if you are using situation names with spaces in the middle (ITM 6.2.1+)
system ("for /f %i in ('tacmd listsit') do \@echo %i >> " . $sSitListFile);
open (File, $sSitListFile ) || die "Could not open " . $sSitListFile ."\n";

while (<File>) { #Strip any \n or spaces from the situation string
    chop;
    $tmp = $_;
    $tmp =~ s/^\s+//;
    $tmp =~ s/\s+$//;
    push(@arrAllSits, $tmp );
}
close (File);

# Part 2
# login to TEPS database and pull out the situation associations.
if (-e $sSitAssocFile) {
    unlink ($sSitAssocFile);
}
system ("sqlcmd -S " . $sTEPSHOST . " -U " . $sTEPSUser . " -P " . $sTEPSPassword . " -d teps -Q\"select distinct(name) from teps.KFWTMPLSIT\" > " . $sSitAssocFile );
open (File, $sSitAssocFile) || die "Could not open " . $sSitAssocFile . "\n";
while (<File>) { #Strip any \n or spaces from the situation string
    chop;
    $tmp = $_;    
    $tmp =~ s/^\s+//;
    $tmp =~ s/\s+$//;
    push(@arrAssocedSits, $tmp);
}
close (File);

#Part3
%found=();
@arrNotAssoced =();

#build lookup table
foreach $item (@arrAssocedSits) {$found {$item} = 1}

# find elements which are in @arrAllSits and not in @arrAssocedSits
foreach $item (@arrAllSits) {
    unless ($found{$item}) {
        #it's not in %found, so print
        print ($item ."\n");
    }
}

This script will print out the list of situations which exist but are not associated with any navigator item.

-- Robert

Wednesday, February 11, 2009

Search before you post!

If you spend some time on the TEM10 mailing list, you'll find out two things:

  1. These guys know a lot about Tivoli.
  2. These guys don't like answering simple questions which have already been answered before!

Unlike the Developerworks forum, where you can simply enter a search term at the top of the screen, there's no obvious way to search TME10.

Try at the official site or at the not-so-official-but-simpler-site.

Anyway, before asking a question, try giving these sites a peek - if it's been answered before, you'll save yourself time.

-- Robert