DX NetOps

 View Only
  • 1.  Perl Script from Spectum menu

    Posted Nov 07, 2016 05:27 AM

    Dear Team,

     

    I am not able to launch perl script from CA Spectrum Menu, following is the syntax i am using.

    <action>
    <launch-web-server-script>
    <command>
    C:/Strawberry/remedy/Test6.pl
    </command>
    <param>
    <attribute>AttributeID.NETWORK_ADDRESS</attribute>
    </param>
    </launch-web-server-script>

    </action>

     

    anyhelp on this?

     

    Regards

    Ajit C



  • 2.  Re: Perl Script from Spectum menu
    Best Answer

    Broadcom Employee
    Posted Nov 07, 2016 07:00 AM

    Hi Ajit,

     

    See my example below, I did not have any issue with it:

     

        <item name="Send ColdStart Trap WEB">

                <popup-visibility>when-filter-passed</popup-visibility>

                <action>

                    <launch-web-server-script>

                    <command>cmd.exe /c "c:/Temp/ColdStartTrap.bat {0}"</command>

                    <param>

                        <attribute>AttributeID.NETWORK_ADDRESS</attribute>

                    </param>

                    </launch-web-server-script>

                    <context>

                        com.aprisma.spectrum.app.topo.client.render.ModelContext

                    </context>

                    <filter>

                        <has-attribute>AttributeID.NETWORK_ADDRESS</has-attribute>

                    </filter>

              </action>

            </item>   

     

     

     In the next example, it will pop-up a DOS-Prompt while running the script:

     

    <item name="Send ColdStart Trap">
       <popup-visibility>when-filter-passed</popup-visibility>
       <action>
          <launch-application>
          <command>cmd.exe /c start "Cold Start Trap {0}" cmd.exe /c "c:/Temp/ColdStartTrap.bat {0} &amp;&amp; pause"</command>
             <param>
                <attribute>AttributeID.NETWORK_ADDRESS</attribute>
             </param>
          </launch-application>
          <context>
             com.aprisma.spectrum.app.topo.client.render.ModelContext
          </context>
             <filter>
                <has-attribute>AttributeID.NETWORK_ADDRESS</has-attribute>
             </filter>
          </action>
    </item>

     

    Thanks,

    Silvio



  • 3.  Re: Perl Script from Spectum menu

    Posted Nov 08, 2016 03:49 AM

    Hi Silvio,

     

    I am trying to pass cause title to the perl script as input, but its only taking first word of it.

     

    Eg, Cause Title - High CPU Utilization

    then its only taking "High"

    anything missing here

     

    <action>
    <launch-web-server-script>
    <command>
    cmd.exe /c "C:/Strawberry/remedy/Test6.pl {0} {1}"
    </command>
    <param>
    <attribute>AttributeID.NETWORK_ADDRESS</attribute>
    </param>
    <param>
    <attribute>AlarmAttrID.CAUSE_TITLE</attribute>
    </param>
    </launch-web-server-script>

    </action>



  • 4.  Re: Perl Script from Spectum menu

    Posted Nov 08, 2016 07:04 AM

    The issue was with perl, the way it handles the input arguments with spaces, so change above command action like this

     

    cmd.exe /c C:/Strawberry/remedy/print.pl "{0}" then it worked



  • 5.  Re: Perl Script from Spectum menu

    Posted Nov 08, 2016 07:25 AM

    Good to know that your issue is resolved.



  • 6.  Re: Perl Script from Spectum menu

    Posted Nov 07, 2016 09:37 AM

    Ajith,

     

    Also, make sure the perl script is available at the mentioned path on the client machine from which you have connected to OneClick console and selecting the menu to execute perl script. Please refer the below points from OneClick customization Guide.

     

    The <command> element specifies the command or executable to execute. You can provide the path to the command or executable in one of two ways:
    ■ You can specify the path on each client via an environment variable. To do this in the Solaris environment, use the PATH environment variable. To create an environment variable in the Windows environment, select My Computer,Properties,Advanced, and then select the Environment Variables button.
    ■ You can specify an absolute path to the command or executable. If you do this, keep in mind that the path must be the same on each OneClick client. Path statements in the Windows environment should use a double backslash instead of a single backslash, for example:
    C:\\Windows\\system32\\cmd.exe
    Note: You can use the <validate> element to verify that the command or executable exists on the OneClick client and has execute permissions. If either of these conditions is found to be false during OneClick startup, the associated menu item is not added to the OneClick menu. (If the <validate> element is not used, the menu item is always added to the menu, but its state is determined by the value of other elements.)

     

     

    Cheers,

    Rajashekar



  • 7.  Re: Perl Script from Spectum menu

    Posted Nov 08, 2016 01:43 AM

    Hi Rajshekhar,

     

    thanks for reply

    I am using webscript and not an application, its working with inputs from Glenn and Silvio.

     

    Regards

    Ajit C



  • 8.  Re: Perl Script from Spectum menu

    Broadcom Employee
    Posted Nov 07, 2016 10:54 AM

    Further to what has already been mentioned, all executable programs must be run out of custom-menu-config.xml file located in $SPECROOT/custom/console/config.  Also if a program has been just added,  a OneClick tomcat restart is required, as Tomcat will scan this file custom-menu-config.xml on startup and create a list of programs that it will allow to run.  This has been done as enhancing security since Spectrum 9.4.0.

     

    Please let us know if you are still having problems.

     

    Best regards,

    Glenn