Solution
Use the following XPath:
ancestor::managedEntity/attributes/attribute[@name="<attribute name>"]/@value
e.g.
ancestor::managedEntity/attributes/attribute[@name="OS"]/@value
Sample XML
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="MNL_MAYA_GATEWAY_9370")]/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="OS"]/@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>
Comments
0 comments
Please sign in to leave a comment.