Smarts Perl API: How to find out "session->init()" connection information in a Perl script used with the Smarts Perl API
search cancel

Smarts Perl API: How to find out "session->init()" connection information in a Perl script used with the Smarts Perl API

book

Article ID: 303745

calendar_today

Updated On:

Products

VMware

Environment

VMware Smart Assurance - SMARTS

Resolution

How to find out session->init() connection information in a Perl script used with the Smarts Perl API
How to find out the domain name that the session->init() is connected to in a Perl script used with the Smarts Perl API

How to find out the username that the session->init() is connected to in a Perl script used with the Smarts Perl API




The following shows how you can find out the session->init() connection information using a myPerlscript.pl Perl script as an example:

<BASEDIR>/IP/smarts/bin/sm_perl -b host:10.1.1.1 -s INCHARGE-AM -u admin -p changeme myPerlscript.pl

$session = InCharge::session->init();

#To find out what the session structure is composed of:
print Dumper($session);

#To print domain name:
print $session->{'domain'};

#To print username as it is part of Hash of Hash:
print $session->{'args'}->{username};