Category: | NetBackup |
Author/Contact Info | Bowie J. Poag (bpoag_at-comast.net) |
Description: | Sherlock will determine if a given host is known or unknown to a NetBackup master server, regardless of platform type. It's presented here in its unmodified form (we differentiate primary and backup network interfaces by the inclusion of a b_ prefix on the hostname) for the sake of demonstration. Sherlock is known to smoke a pipe made of ivory, and is often condescending while addressing others, including his faithful sidekick, Watson. This predisposes him to developing mouth cancer and a bad reputation. There is a possibility that Watson may know judo, and as such, may use the momentum of an attacker's body to his advantage in executing one or more stunning throw techniques. Executing this code will cause a giant pair of scissors to appear in the skies at above rural England, disappearing after a few moments. No need to be alarmed. |
## ## Sherlock v0.1 written 040409:1650 by BJP ## ## Sherlock, given a hostname, can determine if that host is known to +netbackup. ## ## Usage: sherlock.pl <hostname> ## if ($#ARGV<0) { print "\n\nUsage: sherlock.pl <hostname>\n"; print "Example: sherlock.pl cistest\n\n"; exit(); } print "\nSherlock: Starting up..\n"; if ($ARGV[0]=~/^b_/) { print "Sherlock: Stripping off the \"b_\" prefix temporarily.. +\n"; $ARGV[0]=$'; } print "Sherlock: Checking to see if NetBackup knows about $ARGV[0]..\n +"; @results=`/usr/openv/netbackup/bin/bpclntcmd -pn -hn $ARGV[0] 2>&1 `; +## For some reason, this command will dump ordinary status informatio +n to stderr versus stdout, hence the gag suffix on the command. foreach $item (@results) { chomp ($item); if ($item=~/TRY_AGAIN/) { print "Sherlock: Bad news. NetBackup does not recogniz +e $ARGV[0] as a valid peer name under its care.\n"; print "Sherlock: Test results: FAIL\n"; print "Sherlock: Exiting..\n\n"; exit(); } if ($item=~/0x/) { print "Sherlock: Good news! NetBackup recognizes $ARGV +[0] as a valid client and peer name.\n"; print "Sherlock: Details: $item\n"; $clientName=$ARGV[0]; @history=`/usr/openv/netbackup/bin/bpclimagelist -t AN +Y -client $clientName`; if (@history == NULL) { print "Sherlock: A check of the backup logs fo +r this client shows nothing so far.. Still searching..\n"; print "Sherlock: This time, let's try again us +ing a \"b_\" prefix on the hostname and see what happens..\n"; } else { dumpHistory(); } $clientName="b_"."$ARGV[0]"; @history=`/usr/openv/netbackup/bin/bpclimagelist -t AN +Y -client $clientName`; if (@history == NULL) { print "Sherlock: I'm still not seeing anything + for this host. Hmmm.. Maybe it's a Wintel box? Lets try that..\n"; } else { dumpHistory(); } $clientName=$ARGV[0]; @history=`/usr/openv/netbackup/bin/bpclimagelist -t AN +Y -client $clientName -ct 5`; if (@history == NULL) { print "Sherlock: No luck.. I'm not seeing anyt +hing on it. Trying again, assuming it's a Wintel box AND \"b_\" prefi +xed..\n"; } else { dumpHistory(); } $clientName="b_"."$ARGV[0]"; @history=`/usr/openv/netbackup/bin/bpclimagelist -t AN +Y -client $clientName -ct 5`; if (@history == NULL) { print "Sherlock: Still no luck. This box needs + to be checked manually.\n"; print "Sherlock: Test results: FAIL\n"; print "Sherlock: Exiting..\n\n"; } else { dumpHistory(); } } } sub dumpHistory() { print "Sherlock: Ahhh, there we go. Results! This host appears + to have a backup history..\n"; foreach $item (@history) { chomp($item); print "Sherlock: $item\n"; } print "Sherlock: Test results: PASSED\n"; print "Sherlock: Exiting..\n\n"; exit(); } |
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Sherlock v0.1
by jwkrahn (Abbot) on Apr 06, 2009 at 19:07 UTC | |
by bpoag (Monk) on Apr 07, 2009 at 17:50 UTC | |
by Anonymous Monk on Jun 24, 2009 at 07:10 UTC | |
by pemungkah (Priest) on Jun 27, 2009 at 06:01 UTC |
Back to
Code Catacombs