Report on devices and device groups

Devices are the foundation of the topologies. Each device may represent a service (database, file server, router, etc). Metrics, events, and properties can be reported on the device level. A device group is a set of devices. Properties can also be reported on a device group level.

To report devices and device groups, use the topology_builder object. The object is accessible as a property of RemoteBasePlugin class, which you can use to create a device group.

Whenever possible, assign IP addresses and ports to devices. Dynatrace AI requires this to detect dependencies among components.

Report on devices

By default, the device technology assignment is defined in the plugin JSON file. Additionally, multiple IP addresses and ports assigned to one device can be reported. You can use them to match discovered services with a specific device.

add_endpoint method allows setting IP addresses, DNS names and ports.

  • ip is a single string and it's required.
  • dnsNames name is a list of strings separated with commas.
  • Ports can be provided as a single port number, port_list or range_list.

Usage examples:

            add_endpoint("1.1.1.1")
            add_endpoint(ip="1.1.1.1")
            add_endpoint("172.18.19.241", 4581)
            add_endpoint(ip="1.1.1.1", port=80)
            add_endpoint(ip="1.1.1.1", port=80, dnsNames=["name.com"])
            add_endpoint(ip="1.1.1.1", port=80, dnsNames=["name.com"], port_list=[88,8080], range_list=[(680, 690), (880, 900)])
            add_endpoint(ip="1.1.1.1", port=None, dnsNames=["name.com"], port_list=None, range_list=[(80, 88), (447, 450)])

There is a limit of 100 ports to be reported per one device in one minute. Exceeding this limit will cause config exception.

How to report on a device
Download
from ruxit.api.base_plugin import RemoteBasePlugin

class MyPlugin(RemoteBasePlugin):

	def query(self, **kwargs):
		group = self.topology_builder.create_group("My group", "My group")
		device = group.create_element("My device", "My device")
		device.report_property("my_property", "First device")
		device.add_endpoint("172.18.19.241", 4581)
		device.relative("my_device_counter", 2)

JSON essential
Download
{
	"name": "custom.remote.python.my_plugin",
	"version": "1.001",
	"type": "python",
	"entity": "CUSTOM_DEVICE",
	"processTypeNames": ["PYTHON"],
	"technologies": ["example technology"],
	"source": {
		"package": "my_plugin",
		"className": "MyPlugin",
		"activation": "Remote"
	},
	"metrics": [
		{
			"timeseries": {
				"key": "my_device_counter", 
				"unit": "Count", 
				"displayname": "my counter"}
		}
	]
}

Report on device groups

By default, the device group technology assignment is defined in the plugin JSON file.

How to report on device groups
Download
from ruxit.api.base_plugin import RemoteBasePlugin

class MyPlugin(RemoteBasePlugin):
	def query(self, **kwargs):
		group = self.topology_builder.create_group("My group", "My group")
		group.report_property("my_property", "First group")
		group.absolute("my_group_counter", 1)

JSON essential
Download
{
	"name": "custom.remote.python.my_plugin",
	"version": "1.001",
	"type": "python",
	"entity": "CUSTOM_DEVICE",
	"processTypeNames": ["PYTHON"],
	"technologies": ["example technology"],
	"source": {
		"package": "my_plugin",
		"className": "MyPlugin",
		"activation": "Remote"
	},
	"metrics": [
	{
		"entity": "PROCESS_GROUP", 
		"timeseries": {
			"key": "my_group_counter", 
			"unit": "Count", 
			"displayname": "my counter"}
	}
	],
	"ui": {
	"pgmetrics": [ {
		"key" : "my_group_counter",
		"displayname" : "My counter"
	} ]
}