DX NetOps

 View Only

Custom menu to run a script on OneClick Server (Web Server)

  • 1.  Custom menu to run a script on OneClick Server (Web Server)

    Posted Jan 29, 2020 10:05 AM
    I have a requirement to run a script when I select an alarm on click on available menu item. Manu item should be disable if the AttributeID.TROUBLE_TICKET_ID is not empty.

    I have created the custom-menu-config.xml under $SPECROOT/custom/console/config/ with the below code.

    <root>
       <menu>
         <item name="Run the Script">
         <popup-visibility>when-filter-passed</popup-visibility>
         <action>
              <context>com.aprisma.spectrum.app.alarm.client.group.AlarmContext</context>
              <launch-web-server-script>
              <command>expect /app/Spectrum/custom/send.sh {0} {1}</command>
                 <param>
                    <attribute>AttributeID.MODEL_NAME</attribute>
                 </param>
                 <param>
                     <attribute>AttributeID.ALARM_STATUS</attribute>
                 </param>
                 <display-exit-status>
                     <status code="1">Could not open file</status>
                     <status code="2">Bad parameter</status>
                     <status code="3">Could not connect to the server</status>
                     <status default="true">Unknown error code {0}</status>
                 </display-exit-status> 
              </launch-web-server-script>
             <filter>
               <does-not-have-substring-ignore-case>AttributeID.TROUBLE_TICKET_ID</does-not-have-substring-ignore-case>
             </filter>
         </action>
       </item>
      </menu>
    </root>

    Please help me to verify the above code and also, provide me sample script on how to use the variables passed to the script using {0} {1} in the above code.

    Also, please help me to correct the filter in the code.

    ------------------------------
    Thank you.
    Rajashekar
    ------------------------------