To list all the classes of a domain manager using a Perl script
search cancel

To list all the classes of a domain manager using a Perl script

book

Article ID: 327703

calendar_today

Updated On:

Products

VMware Smart Assurance

Issue/Introduction

This article explains the steps to list all the classes of a Smarts domain manager using a Perl script

Environment

Smarts 10.1.X

Resolution

To list all the classes of a Smarts IP domain, execute the Perl script in the following section using sm_perl.

The sm_perl executable is available under the <Base-Dir>/smarts/bin directory. You can run sm_perl as in the following example for a script called list.pl:

<Base-Dir>/smarts/bin/sm_perl.exe <Absolute Path to the Perl Script>

Example: <Base-Dir>/smarts/bin/sm_perl.exe <Base-Dir>/smarts/bin/list.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( );