cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

AttributeError: 'My_Plugin_Class' object has no attribute 'topology_builder'

Ben_Harvey
Contributor

Hi, im trying to build my first activegate extension,  the aim is to use the plugin to take information from some files prepared from other sources, then pump the metrics into dynatrace.

However every time i run it, i get the above error.
Sample from my script below.

Ive pretty much copied the demo_activegate_plugin_multi from the examples.

Any thoughts?

 

 

import re
import json
import os
import ruxit.api.topology_builder
from ruxit.api.exceptions import ConfigException
from ruxit.api.base_plugin import RemoteBasePlugin
from ruxit.api.data import PluginProperty


class Primary_RTU_Monitoring(RemoteBasePlugin):

    
    def query(self, **kwargs):
        if self.config["debug"]: #debug mode run every min.

            path = r"E:\Scripts\RTU_IO_MON\LOGS\\"
            categories = os.listdir(path)

            for item in categories:
                topology_group = self.topology_builder.create_group(identifier=item, group_name="RTU_IO_MONITORING")
                try:
                    file_name = "\results.json"
    ...........etc

 

 

 

4 REPLIES 4

Ben_Harvey
Contributor

 

 

from ruxit.api.topology_builder import TopologyBuilder
from ruxit.api.exceptions import ConfigException
from ruxit.api.base_plugin import RemoteBasePlugin


class My_Plugin_Class(RemoteBasePlugin, TopologyBuilder):

Looks like its an issue with my imports. It now works in the simulator with the arrangement shown. I thought RemoteBasePlugin imported BasePlugin, which in turn imported TopologyBuilder. Guess not.

demo_activegate_plugin_multi.py only imports RemoteBasePlugin.

Hopefully its a fix, time to test deployment. 

Ben_Harvey
Contributor

Fix worked. For the sake of anyone else who stumbles here in future:

When you update the plugin file, you need to stop and start the activegate service, or else your changes will not be loaded. This caught me out for a while. make sure you allow a few min in the stopped state before starting again.

Mike_L
Dynatrace Champion
Dynatrace Champion

Hi Ben, you can also increase the version in the plugin.json. That will automatically restart the remote plugin module.

Mike

Thanks for that Mike, good to know! 👍