Start a Conversation

Unsolved

This post is more than 5 years old

1649

August 28th, 2012 14:00

How to export and import selective groups

hhi,

I have a server with multiple selective groups created. I need to create the same set of groups in multiple servers .

Is there an import and export possible from command line (DMCTl, Perl, ASL, utils) which can export the selective groups ?

52 Posts

August 29th, 2012 17:00

I don't think the import/export of selective groups was anything built into existing tools.  Most people that are looking to copy those have basically built a Perl script (or equivalent) to construct them across various domains.  See the thread here for more information:

https://community.emc.com/message/434092#434092

Hypothetically, you could use a Perl script to interrogate the server and build the set of commands that would replicate the groups.  It might also be possible to use the DXA to move the groups about, but there is likely too much baggage for that approach.

27 Posts

September 14th, 2012 10:00

Hello Shyamajay,

I'm including a pl code which should allow you to do that with a little modification on your part. Please keep in mind that This script has been modified by EMC support as best effort.  There are NO warranties or guarantees implied or explicit. This script is used at sole discretion of the user and by downloading and using any part of the script the user accepts full responsibility.

Now, with that in mind, copy the code from this page, save it as a .pl then you'd have to modify from line 59 through to line 66 to match the settings that you want to use.

Hope this helps you,

Regards,

TJ

EMC Technical Support Engineer III,

VCP, EMCSA, EMCIE

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

#!/usr/bin/perl -I/opt/InChargeUCSD/SAM/smarts/local/perl/5.8.8/lib -I/opt/InChargeUCSD/SAM/smarts/perl/5.8.8/lib

# This script has been modified by EMC support as best effort.  There are warrenties or guarantees implied or explicit.

#This script is used at sole descretion of the user and by downloading and using any part of the script the user accepts

#full responsibility.

$0 =~ s|.*/([^/]+)|$1|;     ## basename of app invocation

use InCharge::session;

### Note, run this with sm_perl in SAM bin directory

# default user/password -- get from file if it exists

#if (-e ".passwd") {

#       open IN,".passwd" or die "Local password file exists but can't be opened";

#       my $line= ;

#       chomp $line;

#       ($USER,$PASSWD)=split /\s+/,$line;

#       close IN;

#} else {

#       print("No .passwd file found.  Need USER/PASSWD in local file .passwd, on one line separated by whitespace. Exiting.\n");

#       die "No .passwd file found.";

#}

$domain="UCSD-SA";

$session = InCharge::session->init(

#       broker=>"resucsdapp1:426",

        domain=>"$domain",

        username=>"$USER",

        password=>"$PASSWD"

        );

#$INPUTFILE = "groups.txt";

# open (INFILE, "< $INPUTFILE")

#       or die "Couldn't open $INPUTFILE for reading : $!\n";

$obj = $session->object( "HGRP-Aousc_Sites" );

$name="Oakton_Court5";

create_group();

#  LINE: while ( )

#  {

#       chop;

#       $name="$_";

#       create_group();

# #     $obj->insertElement("ChildGroups","AOUSC-Sites/$name");

#  }

sub create_group {

        # create child group

        $grpObj = $session->create( "SelectiveGroup::HGRP-Aousc_Sites/$name" );

        $grpObj->put("DisplayName", "$name");

        $grpObj->put("TargetClass", "UnitaryComputerSystem");

        $selObj = $session->create( "ICF_GroupSelector::S-HGRP-Aousc_Sites/$name");

        $selObj->put("ChildGroup", "SelectiveGroup::HGRP-Aousc_Sites/$name");

        $selObj->put("SelectedBy", "SelectiveGroup::HGRP-Aousc_Sites");

        $selObj->put("Priority", 301);

        my $o = $session->object( "ICF_Criteria", "S-HGRP-Aousc_Sites/Oakton_Court5" );

        my $x = [

                ANYVALARRAY_SET =>[

                        [ [ STRING=> "Type"], [ STRING => "Router|router"] ],

                        [ [ STRING => "Vendor"], [ STRING=> "Cisco"] ]

                ]

        ];

        $session->put_P( $o, "criteria", $x);

        $obj->insertElement("ChildGroups","HGRP-Aousc_Sites/$name");

}

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

1 Message

November 1st, 2012 11:00

TJ,

Which part of the script does export the groups?  I can see only creation of the groups part.

Mariusz

No Events found!

Top