Smarts IP: How can I list all the classes of a Smarts IP domain using a Perl script?
search cancel

Smarts IP: How can I list all the classes of a Smarts IP domain using a Perl script?

book

Article ID: 327703

calendar_today

Updated On:

Products

VMware

Environment

VMware Smart Assurance - SMARTS

Resolution

How can I list all the classes of a Smarts IP domain using a Perl script?



To list all the classes of a Smarts IP domain, execute the Perl script in the following section using sm_perl.exe. The sm_perl.exe executable is available under the C:\InCharge\IP\smarts\bin directory. You can run sm_perl.exe as in the following example for a script called ash.pl:

C:\InCharge\IP\smarts\bin>sm_perl.exe c:\perl\ca\ash.pl

Perl Script
The following script can be used to list all the classes in a Smarts IP domain:

#! /usr/bin/perl
use InCharge::session
$host='localhost:426';
        $uname='admin';
        $server="INCHARGE-AM-PM";
        $paswd="changeme";
        print "\nbroker=$host,server=$server";
        $session = InCharge::session->init(broker => $host,server => $server,user => $uname, password => $paswd);

        foreach $class ( sort $session->getClasses() ) {
foreach $inst (
sort $session->getInstances($class))
{
print $class . "::" . $inst . "\n";
}
}
$session->detach( );