Example of input tab details for a Menu command
This section contains examples for the input tab entries for a Menu command. This configuration logic is also used to display the menu commands in the BMC ProactiveNet Performance Management Operations console or TrueSight Infrastructure Management administrator console. For more details, see Configuring PATROL KM metadata and XML schema.
Sample logic for a menu command
Sample logic written in the Input tab for a menu command (KM Configuration metadata).
<MenuCommand available="AVAILABLE_ALWAYS" id="psx_trace" name="Trace">
<MenuCommand annotate="false" autoID="false" available="AVAILABLE_ALWAYS" id="bppm_app_trace" name="Set Application Trace" security="SECURITY_INHERIT">
<BaseCommand>
<Command commandType="PSL" computerType="ALL_COMPUTERS">
<Commandtext serial="1383803797">requires NT_OS_menu; app_trace_dbg ();</Commandtext>
</Command>
</BaseCommand>
<MenuCmdConfigurationMetadata xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<KMLevelConfiguration dataModelMajorVersion="1" dataModelMinorVersion="0"/>
<ConfigurationParameters>
<ConfigurationParameter>
<AttributeSet description="Application Trace Selection Options" id="appTraceSelectOpts" label="Application Trace Selection Options">
<Attribute>
<Enum default="" description="Application Class Selection" id="appclass" label="Application Class">
<Enumerators>
<Enumerator id="win_op_sys" label="Windows Operating System" value="0"/>
<Enumerator id="win_evnt" label="Windows Events" value="1"/>
<Enumerator id="processes" label="Processes" value="2"/>
<Enumerator id="services" label="Services" value="3"/>
<Enumerator id="cache" label="Cache" value="4"/>
<Enumerator id="processors" label="Processors" value="5"/>
<Enumerator id="network_protocols" label="Network Protocols" value="6"/>
<Enumerator id="job_objects" label="Job Objects" value="7"/>
<Enumerator id="logical_disks" label="Logical Disks" value="8"/>
<Enumerator id="physical_disks" label="Physical Disks" value="9"/>
<Enumerator id="paging_files" label="Paging Files" value="10"/>
<Enumerator id="printers" label="Printers" value="11"/>
<Enumerator id="NT_CompositesColl" label="NT_CompositesColl" value="12"/>
<Enumerator id="network_interfaces" label="Network Interfaces" value="13"/>
<Enumerator id="registry" label="Registry" value="14"/>
<Enumerator id="server_security" label="Server and Security" value="15"/>
<Enumerator id="health" label="Health At A Glance" value="16"/>
<Enumerator id="memory" label="Memory" value="17"/>
<Enumerator id="system" label="System" value="18"/>
<Enumerator id="blue_screen" label="Blue Screen" value="19"/>
<Enumerator id="agent_health" label="Agent Health" value="20"/>
</Enumerators>
</Enum>
</Attribute>
<Attribute>
<MultiSelect default="all" description="Select Debug Type" id="dbgtype" label="Debug Type">
<Enumerators>
<Enumerator id="all" label="ALL" value="0"/>
<Enumerator id="disc" label="Discovery" value="1"/>
<Enumerator id="coll" label="Collection" value="2"/>
<Enumerator id="cmd" label="Commands" value="3"/>
<Enumerator id="xpc" label="XPC" value="4"/>
</Enumerators>
</MultiSelect>
</Attribute>
<Attribute>
<Enum default="" description="Debug Flag" id="dbgflag" label="Debug Flag">
<Enumerators>
<Enumerator id="off" label="OFF" value="0"/>
<Enumerator id="on" label="ON" value="1"/>
</Enumerators>
</Enum>
</Attribute>
</AttributeSet>
</ConfigurationParameter>
</ConfigurationParameters>
</MenuCmdConfigurationMetadata>
</MenuCommand>
Supported input configuration metadata for menu command
Following table illustrates the supported input configuration metadata for menu commands:
XML tags for Menu | HTML UI Representation | Validation |
---|---|---|
String | Input text box | validateForbidden |
AcountName | Username and password input text box | |
Boolean | CheckBox | |
Counter | Input text box with input range validation using minimum and maximum data | |
Enum | Combo box | |
MultiSelect | List with multiple data selection option | |
AttributeSet | Border for the attributes inside the attribute set |
Executing menu command
When PATROL Agent receives a command, it checks the value for CMD_T and if the value is MENU, then PATROL Agent creates a PSL code and executes it. The following template PSL code provides the logic to parse the inputs defined in the configuration metadata of menu commands:
function bppm_app_trace (...)
{
local app,dbg_opts,opt1,opt2,opt3,opt4,opt5,cnfigFile;
app = "";
dbg_opts = "";
opt1 = "";
opt2 = "";
opt3 = "";
opt4 = "";
opt5 = "";
arguments = va_start();
c = va_arg(arguments);
while (c != "")
{
if(ntharg(c,1,"/") == "appclass")
{
switch (ntharg(c,2,"/"))
{
case 0:{ app = "Windows Operating System";}
case 1:{ app = "Windows Events";}
case 2:{ app = "Processes";}
case 3:{ app = "Services";}
case 4:{ app = "Cache";}
case 5:{ app = "Processors";}
case 6:{ app = "Network Protocols";}
case 7:{ app = "Job Objects";}
case 8:{ app = "Logical Disks";}
case 9:{ app = "Physical Disks";}
case 10:{ app = "Paging Files";}
case 11:{ app = "Printers";}
case 12:{ app = "NT_CompositesColl";}
case 13:{ app = "Network Interfaces";}
case 14:{ app = "Registry";}
case 15:{ app = "Server and Security";}
case 16:{ app = "Health At A Glance";}
case 17:{ app = "Memory";}
case 18:{ app = "System";}
case 19:{ app = "Blue Screen";}
case 20:{ app = "Agent Health";}
}
}
if(ntharg(c,1,"/") == "dbgflag")
{
flag = ntharg(c,2,"/");
}
if(ntharg(c,1,"/") == "dbgtype")
{
dbg_opts = replace(ntharg(c,2,"/"),",","\n");
foreach opt (dbg_opts)
{
switch (opt)
{
case 0:{ opt1 = "all";}
case 1:{ opt2 = "disc";}
case 2:{ opt3 = "coll";}
case 3:{ opt4 = "cmd";}
case 4:{ opt5 = "xpc";}
}
}
}
c = va_arg(arguments);
}
}
PATROL Agent sends the output of the PSL code to the BMC ProactiveNet or TrueSight Infrastructure Management.
Comments
Log in or register to comment.