UNSOLVED

davemalhotra

updated

18 years ago

0

6105

September 9th, 2008 11:00

Perl API problems - Can't connect to broker

I am trying to make a simple script using the Perl API. For some reason it will not connect to the broker. I get this error:

Can't connect to broker 'localhost:526', stopped at ./test.pl line 13

Note that I am running the broker on port 526. I know it is working because I can telnet to the port.

What could be the problem? Here is the session code:

$session = InCharge::session->new(
broker=>"localhost:526",

domain=>"INCHARGE-AM-PM",
username=>"admin",
password=>"changeme",
traceServer=>0

);

Any help is appreciated.

Dave

  • supriya2

    2 Posts

    475

    0

    Posted September 9th, 2008 23:00

    Which version of perl you are using?

  • 475

    0

    Posted September 10th, 2008 09:00

    This was the answer to my problem. Had to apply hotfix:

    The following is a Primus(R) eServer solution:

    ID: emc154932

    Domain: EMC1

    Solution Class: 3.X Compatibility

    Fact EMC SW: EMC Smarts IP

    Suite 7.x

    Fact EMC SW: EMC Smarts SAM

    Suite 7.x

    Fact EMC SW: EMC Smarts

    Application Suite 7.x

    Symptom ./sm_perl -h

    ld.so.1: perl: fatal: libperl.so: open failed: No such file or directory

    Symptom Can't locate IO/Handle.pm in @INC (@INC

    contains: /opt/Inharge7/SAM/smarts/

    local/perl/lib

    /opt/InCharge7/SAM/smarts/perl/lib /opt/InCharge7/SAM/smarts/perl/5.8.0/lib

    /emc/ferren/DEV/thirdparty/perl/5.8.8/solaris8-sparc-32/install/lib/5.8.8/sun4-solaris-thread-multi

    /emc/ferren/DEV/thirdparty/perl/5.8.8/solaris8-sparc-32/install/lib/5.8.8

    /emc/ferren/DEV/thirdparty/perl/5.8.8/solaris8-sparc-32/install/lib/site_perl/5.8.8/sun4-solaris-thread-multi

    /emc/ferren/DEV/thirdparty/perl/5.8.8/solaris8-sparc-32/install/lib/site_perl/5.8.8

    /emc/ferren/DEV/thirdparty/perl/5.8.8/solaris8-sparc-32/install/lib/site_perl

    .) at /opt/InCharge7/SAM/smarts/perl/5.8.0/lib/InCharge/[remote.pm|http://remote.pm/] line 15.

    BEGIN failed--compilation aborted at

    /opt/InCharge7/SAM/smarts/perl/5.8.0/lib/InCharge/[remote.pm|http://remote.pm/] line 15.

    Compilation failed in require at

    /opt/InCharge7/SAM/smarts/perl/5.8.0/lib/InCharge/[session.pm|http://session.pm/] line 128.

    BEGIN failed--compilation aborted at

    /opt/InCharge7/SAM/smarts/perl/5.8.0/lib/InCharge/[session.pm|http://session.pm/] line 128.

    Compilation failed in require at ../local/actions/david-test.pl line 6.

    BEGIN failed--compilation aborted at ../local/actions/david-test.pl line 6.

    "

    Symptom Smarts 7.0: Perl API stops working after

    upgrading to Smarts 7.0

    Symptom Receive *Can't connect to

    broker* error when running Perl API sample code in 7.0

    Change Upgraded to Smarts 7.0

    Cause 1) When running Perl API code

    in 7.x. Do not use the normal perl excutable. You'll need to use sm_perl in

    smarts/bin/ because of perl API changes that you'll need the smarts environment

    varibables. With just 3rd party perl, you will get "can't connect to

    broker" error.

    2) Perl 5.8.8 package can be download from http://powerlink.emc.com. There

    is a issue with "perl-5.8.8-solaris8-sparc-32.tar.gz", it

    only installs under perl dir and not toolbox/perl. From the HotFix 12 Readme

    instruction, it says to extract under /smarts/ but by default

    sm_perl looks for /smarts/toolbox/perl,

    example: "./sm_perl: /opt/InCharge71/SAM/smarts/toolbox/perl/bin/perl:

    not found"

    You'll need to create toolbox dir and then from within run "gunzip <

    /tmp/perl-5.8.8-solaris8-sparc-32.tar.gz | tar xvf ·"

    Fix

    Upgrade to SAM 7.2 HF 4 and above. If using HotFix,

    then point to the Perl API libary from the HF.

    Example: use lib

    "/opt/InCharge7/SAM/smarts/local/perl/5.8.8/lib";

    Following is instruction if you are using SAM 7.1:

    Create a /SAM/local/bin/system/sm_perl.options

    with the following contents:

    SM_PERL_BASE=$SM_HOME/toolbox/perl

    **SM_REMAP_PROG=$SM_PERL_BASE/bin/perl

    **SM_PREPEND_ARGS="-I "$SM_HOME"/local/perl/lib -I

    "$SM_HOME"/perl/lib -msm_perl_init -I

    "$SM_HOME"/perl/$SM_PERL::DIST_VER/lib

    **LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"$SM_PERL_BASE"/lib/5.8.8/sun4-solaris-thread-multi/COR

    **SM_CMD_VAR_NAME=SM_RUNPER

    **PERLLIB="

    **PERL5LIB="

    Also, create the

    following /SAM/smarts/local/perl/lib/[sm_perl_init.pm|http://sm_perl_init.pm/] :

    BEGIN {
    *# Pattern describing the compiled-in Perl root

    directory.

    • *my $as_built_path_pat =

    '(/opt/software/perl-5[/]+|/emc/.*?/install)'

    • *# Path to Perl's root directory, as installed, provided by

    runcmd wrapper

    • *my $pl = $ENV{'SM_PERL_BASE'}

    • *# Walk @INC, translating relevant element

    • *foreach (@INC)

    • *$_ =~ s!$as_built_path_pat!$pl!o

    **

    **1

  • Jamey2

    3 Posts

    475

    0

    Posted October 23rd, 2008 12:00

    I had to make a change in my session.pm, see below. The underlined/bolded line was added by me, which corrected my issue.




    1. get any authentication data needed, for connecting to the

    1. broker.

    my $auth = undef;

    my ( $user, $pass ) = InCharge::auth::getLoginAndPassword( " " );

    if (defined($user) and defined($pass)) { $auth = $user.":".$pass; }

    1. establish a connection with the broker

    $auth = $args.":".$args;

    my $bsess = eval { _attach(

    $args{broker_host},

    $args,

    "dmbroker",

    $args,

    $auth,

    undef,

    $default_timeout

    ); };