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

ActiveGate extension - configuration upload issue

MathieuB
Observer

Hi,

I have an ActiveGate extension, with valid plugin.json and a properties.json to set configuration parameters.

When I upload a new version of my extension, with new configuration, I see that the configuration parameters have not changed. [the version is incraised on the plugin.json and the upload is successful]

I see several issues :

  • The parameters on the config UI have not been updated (Setting/Monitoring/Monitored technologies/MyPlugin/Endpoint configuration)
    --> Is it a bug or do I miss nothing on the build/upload process ?
  • The extension is not restarted, so it continues to loop the query() function. But I read my configuration parameters on the initialize() function, so the new parameters are not loaded.
    --> How to restart the extension after a new build ?

 

I see on the log that the new code has been deployed successfully.

I am quite new on my Dynatrace company, so maybe I miss something basic 😅

plugin.json :

 

 

{
	"name": "custom.remote.python.myplugin",
	"version": "0.945",
	"type": "python",
	"entity": "CUSTOM_DEVICE",
	"metricGroup": "myplugin",
	"technologies": ["MYPLUGIN"],
	"source": {
		"package": "activegate_plugin_myplugin",
		"className": "MyPlugin",
		"activation": "Remote"
	},
	"properties": [
		{
			"key": "debug",
			"type": "Dropdown",
			"dropdownValues" : ["WARNING", "INFO", "DEBUG"],
			"defaultValue" : "INFO"
		},
		{
			"key": "url",
			"type": "String"
		},
		{
			"key": "url2",
			"type": "String"
		}
	],
	"configUI": {
		"displayName": "MyPlugin",
		"properties" : [
			{"key" : "url", "displayName": "First URL", "displayOrder": 1},
			{"key" : "url2", "displayName": "Second URL", "displayOrder": 2},
			{"key" : "debug", "type":"String", "displayName": "Enable debug logging", "displayOrder": 3}
		]
	}
}

 

 

properties.json :

 

 

{
	"debug": "DEBUG",
	"url": "https://google.fr",
	"url2": "https://google.com"
}

 

 

 

6 REPLIES 6

Mike_L
Dynatrace Guru
Dynatrace Guru

Hi,

The properties.json file is only used during oneagent_simulate_plugin. The rest of the time the configuration is coming from the Dynatrace cluster. If the properties change you'll have to hit "update" in the Dynatrace UI to send the new properties to the ActiveGate. Once new configurations are sent the plugin will restart and run initialize again.

The new code is loaded in whenever the RemotePluginModule or PluginAgent process (depending on ActiveGate/OneAgent) is restarted. The process is automatically restarted whenever a new version is found in a plugin.json. You can always force it by restarting the remote plugin or OneAgent service.

Mike

MathieuB
Observer

Hi,

Thanks for your help @Mike_L .

I will rework my json files to see if the new parameters are propagated. Because I don't want to update the parameters from the UI.

 

If you don't want to update the parameters in the UI, maybe make them hardcoded in the python code (either in the script itself or by importing a json or so from the file system.

Mike

Hi again @Mike_L ,

So you said that the only way to update the parameters from the plugin.json is to update them in the UI ?
Therefore, I do not understand why there is a 'defaultValue' in the json.

 

I perform some test and after the update (with the build_plugin command), the new code is running but the script starts at the query() function and not the initialize().

 

 

class DemoPluginRemote(RemoteBasePlugin):
    def initialize(self, **kwargs):
        self.url = self.config["url"]

    def query(self, **kwargs):
        #plugin routine

 

 

So maybe my issue cames from the RemotePluginModule that do no restart. I will look on the ActiveGate configuration.

If you're fine with the ability of changing it in the UI then you can do something like this in the python code:

def initialize(self, **kwargs):
  config = kwargs['config']
  self.url = config["url"].strip()

  if self.url == '':
    self.url = "https://dynatrace.com"

 

Mike

No I don't want to hardcode parameters.

So I'm going to read the properties.json or get parameters from kwargs['json_config']['properties']

Thanks for your help Mike_L.

Featured Posts