main::dumpHistory() called too early to check prototype at 755780.pl.tdy line 87. main::dumpHistory() called too early to check prototype at 755780.pl.tdy line 74. main::dumpHistory() called too early to check prototype at 755780.pl.tdy line 63. main::dumpHistory() called too early to check prototype at 755780.pl.tdy line 53. Global symbol "@results" requires explicit package name at 755780.pl.tdy line 27. Global symbol "$item" requires explicit package name at 755780.pl.tdy line 30. Global symbol "@results" requires explicit package name at 755780.pl.tdy line 30. Global symbol "$item" requires explicit package name at 755780.pl.tdy line 31. Global symbol "$item" requires explicit package name at 755780.pl.tdy line 33. Global symbol "$item" requires explicit package name at 755780.pl.tdy line 40. Global symbol "$item" requires explicit package name at 755780.pl.tdy line 42. Global symbol "$clientName" requires explicit package name at 755780.pl.tdy line 44. Global symbol "@history" requires explicit package name at 755780.pl.tdy line 46. Global symbol "$clientName" requires explicit package name at 755780.pl.tdy line 46. Global symbol "@history" requires explicit package name at 755780.pl.tdy line 48. Global symbol "$clientName" requires explicit package name at 755780.pl.tdy line 56. Global symbol "@history" requires explicit package name at 755780.pl.tdy line 58. Global symbol "$clientName" requires explicit package name at 755780.pl.tdy line 58. Global symbol "@history" requires explicit package name at 755780.pl.tdy line 59. Global symbol "$clientName" requires explicit package name at 755780.pl.tdy line 66. Global symbol "@history" requires explicit package name at 755780.pl.tdy line 68. Global symbol "$clientName" requires explicit package name at 755780.pl.tdy line 68. Global symbol "@history" requires explicit package name at 755780.pl.tdy line 70. Global symbol "$clientName" requires explicit package name at 755780.pl.tdy line 77. Global symbol "@history" requires explicit package name at 755780.pl.tdy line 79. Global symbol "$clientName" requires explicit package name at 755780.pl.tdy line 79. Global symbol "@history" requires explicit package name at 755780.pl.tdy line 81. Global symbol "$item" requires explicit package name at 755780.pl.tdy line 94. Global symbol "@history" requires explicit package name at 755780.pl.tdy line 94. Global symbol "$item" requires explicit package name at 755780.pl.tdy line 95. Global symbol "$item" requires explicit package name at 755780.pl.tdy line 96. Bareword "NULL" not allowed while "strict subs" in use at 755780.pl.tdy line 48. Bareword "NULL" not allowed while "strict subs" in use at 755780.pl.tdy line 59. Bareword "NULL" not allowed while "strict subs" in use at 755780.pl.tdy line 70. Bareword "NULL" not allowed while "strict subs" in use at 755780.pl.tdy line 81. #### use warnings; use strict; ## ## Sherlock v0.1 written 040409:1650 by BJP ## ## Sherlock, given a hostname, can determine if that host is known to netbackup. ## ## Usage: sherlock.pl ## if ( @ARGV != 1) { print "\n\nUsage: sherlock.pl \n"; print "Example: sherlock.pl cistest\n\n"; exit 1; } print "\nSherlock: Starting up..\n"; if ( $ARGV[ 0 ] =~ s/^b_// ) { print "Sherlock: Stripping off the \"b_\" prefix temporarily..\n"; } print "Sherlock: Checking to see if NetBackup knows about $ARGV[0]..\n"; my @results = `/usr/openv/netbackup/bin/bpclntcmd -pn -hn $ARGV[0] 2>&1 `; ## For some reason, this command will dump ordinary status information to stderr versus stdout, hence the gag suffix on the command. for my $item ( @results ) { chomp $item; if ( $item =~ /TRY_AGAIN/ ) { print "Sherlock: Bad news. NetBackup does not recognize $ARGV[0] as a valid peer name under its care.\n"; print "Sherlock: Test results: FAIL\n"; print "Sherlock: Exiting..\n\n"; exit 2; } next if $item !~ /0x/; print "Sherlock: Good news! NetBackup recognizes $ARGV[0] as a valid client and peer name.\n", "Sherlock: Details: $item\n"; my $clientName = $ARGV[ 0 ]; my @history = `/usr/openv/netbackup/bin/bpclimagelist -t ANY -client $clientName`; dumpHistory( @history ) if @history; print "Sherlock: A check of the backup logs for this client shows nothing so far.. Still searching..\n", "Sherlock: This time, let's try again using a \"b_\" prefix on the hostname and see what happens..\n"; $clientName = "b_$ARGV[0]"; @history = `/usr/openv/netbackup/bin/bpclimagelist -t ANY -client $clientName`; dumpHistory( @history ) if @history; print "Sherlock: I'm still not seeing anything for this host. Hmmm.. Maybe it's a Wintel box? Lets try that..\n"; $clientName = $ARGV[ 0 ]; @history = `/usr/openv/netbackup/bin/bpclimagelist -t ANY -client $clientName -ct 5`; dumpHistory( @history ) if @history; print "Sherlock: No luck.. I'm not seeing anything on it. Trying again, assuming it's a Wintel box AND \"b_\" prefixed..\n"; $clientName = "b_$ARGV[0]"; @history = `/usr/openv/netbackup/bin/bpclimagelist -t ANY -client $clientName -ct 5`; dumpHistory( @history ) if @history; print "Sherlock: Still no luck. This box needs to be checked manually.\n", "Sherlock: Test results: FAIL\n", "Sherlock: Exiting..\n\n"; } sub dumpHistory { print "Sherlock: Ahhh, there we go. Results! This host appears to have a backup history..\n"; for my $item ( @_ ) { chomp $item; print "Sherlock: $item\n"; } print "Sherlock: Test results: PASSED\n", "Sherlock: Exiting..\n\n"; exit; }