Back to Geneos FAQ

How to extract a Managed Entity's attribute and use it in a command argument

Solution Copied

Use the following XPath:

ancestor::managedEntity/attributes/attribute[@name="<attribute name>"]/@value

e.g.

ancestor::managedEntity/attributes/attribute[@name="OS"]/@value

Sample XML Copied

The sample command extracts the value of an attribute named “OS” from a headline cell.

<command name="Get ME Attribute Netprobe">
<targets>
<target>/geneos/gateway[(@name=&quot;MNL_MAYA_GATEWAY_9370&quot;)]/directory/probe/managedEntity/sampler/dataview/headlines/cell</target>
</targets>
<userCommand>
<type>script</type>
<runLocation>netprobe</runLocation>
<args>
<arg>
<static>/home/MNL/rgonzales/scripts/scripts/print_args.bash</static>
</arg>
<arg>
<userInput>
<description>ME Attribute</description>
<xpathOptions>
<xpathOption>ancestor::managedEntity/attributes/attribute[@name=&quot;OS&quot;]/@value</xpathOption>
</xpathOptions>
</userInput>
</arg>
<arg>
<userInput>
<description>Headline Name</description>
<xpathOptions>
<xpathOption>ancestor::dataview/headlines/cell/@name</xpathOption>
</xpathOptions>
</userInput>
</arg>
<arg>
<xpath>@name</xpath>
</arg>
<arg>
<xpath>@value</xpath>
</arg>
</args>
<enablePassword>true</enablePassword>
</userCommand>
</command>
["Geneos"] ["Geneos > Gateway"] ["FAQ"]

Was this topic helpful?