Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
## ## Sherlock v0.1 written 040409:1650 by BJP ## ## Sherlock, given a hostname, can determine if that host is known to +netbackup. ## ## Usage: <hostname> ## if ($#ARGV<0) { print "\n\nUsage: <hostname>\n"; print "Example: 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(); }

In reply to Sherlock v0.1 by bpoag

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    marioroy Ditto for DB_File, BerkeleyDB, etc. ;-)

    How do I use this? | Other CB clients
    Other Users?
    Others about the Monastery: (3)
    As of 2017-08-18 07:48 GMT
    Find Nodes?
      Voting Booth?
      Who is your favorite scientist and why?

      Results (297 votes). Check out past polls.