#!/opt/SUNWstade/bin/perl  -I/opt/SUNWstade/lib 
use Java::TreefrogControls;
use Data::Dumper;
use System;

use strict;
System->set_home("/opt/SUNWstade");
my ($renv, $devs, $hosts, $notifs) = PDM::ConfigFile->read();
System->set_renv($renv);

# Remember, the count is off (under) by one
if (( $#ARGV eq 2))
{
   my $key      = shift @ARGV;
   my $path     = shift @ARGV;
   my $filename = shift @ARGV;

   print "Collecting support data for $key\n";
   my $rval = Java::TreefrogControls->getSupportData($key, $path, $filename);
   print "Completion status: ".$rval."\n\n";


}
else
{
  print "\n";
  print "usage SupportData <identifier> <path> <filename>\n\n";
  print "  Collects support data for 6130/6140 series arrays\n";
  print "  Valid identifiers are the deviceKey, array name, controller ip number\n";
  print "  or controller DNS name.  The exact form of identifier used must be on\n";
  print "  record in order for the array to be recognized.  Use the command\n";
  print "  'ras_admin device_list' to find a valid array name and ip number.\n\n";
  print "  ex: SupportData SUN.XXXXXXXXXXX.YYYYYYYYYY /tmp outputfile\n";
  print "  ex: SupportData Array-15 /tmp outputfile\n";
  print "  ex: SupportData 123.456.789.101 /tmp outputfile\n";
  exit 1;
}


