Custom properties
Dynatrace extensions enable you to send custom properties for a monitored technology on both, device and device group levels. The property has the form of a key-value pair, where both are strings.
To send a property, use the report_property(key="Key", value="Value") method:
1group.report_property(key='Group version', value="0.5")
or
1node.report_property(key='Device version', value="2.3")
The following example presents the complete extension code:
1import json2import requests3from ruxit.api.base_plugin import RemoteBasePlugin4import logging56logger = logging.getLogger(__name__)789class DemoPluginRemote(RemoteBasePlugin):10 def initialize(self, **kwargs):11 config = kwargs['config']12 logger.info("Config: %s", config)13 self.url = config["url"]1415 def query(self, **kwargs):16 # Collect stats17 stats = json.loads(requests.get(self.url).content.decode())1819 # Create group - provide group id used to calculate unique entity id in dynatrace20 # and display name for UI presentation21 group = self.topology_builder.create_group(identifier="DemoGroup",22 group_name="ActiveGate Demo Group")23 # report group custom property - any string-string values pair. It is added to device group metadata displayed in dynatrace UI24 group.report_property(key='Group custom property: version', value=stats['version'])2526 logger.info("1. Group custom property")27 # Create node - provide node id used to calculate unique entity id in dynatrace28 # and display name for UI presentation29 node = group.create_element(identifier="DemoNode",30 element_name="ActiveGate Demo Node")3132 logger.info("Topology: group name=%s, node name=%s", group.name, node.name)3334 # report property - any string-string values pair. It is added to device metadata displayed in dynatrace UI35 node.report_property(key='Device custom property: version', value=stats['version'])36 logger.info("2. Device custom property")
There are no specific edits required in the plugin.json
file.
See an example of custom properties reported on the device group and device levels:
The ActiveGate plugin module limits the amount of data (custom properties and too long strings) sent to Dynatrace Server . The limit is set at 100 custom properties sent in a 24 hour time frame. Single property key string can't be longer than 50 characters. Single property value string can't be longer that 140 characters. The properties are reported in packages, a single package can't be longer than 5120 characters.