ActiveGate plugin Python dependency

Hi!

I’ve listed my plugin’s dependencies in the `install_requires’ element of ‘source’ in my ActiveGate remote plugin plugin.json, but it doesn’t seem like the plugin module is installing it. Is there potentially a step I missed, or missing functionality due to this being beta? Where can i check logs for this?

Thanks,

Rick B

2019-02-01 18:46:00.992 UTC [1e7738ef] info    [native] 140664985044736(MainThread) - [report_status] new plugin status for engine ('custom.remote.python.kafka.Stats', 0) PluginFullStatus(pluginName=custom.remote.python.kafka.Stats, pluginVersion=0.003, state=ERROR_UNKNOWN, description=No module named 'avro', monitoredEntityId=0x0, stacktrace=Traceback (most recent call last):<br>   File "/var/opt/dynatrace/gateway/remotepluginmodule/agent/plugin/engine/ruxit/plugin_state_machine.py", line 270, in _execute_next_task<br>     self._engine.send(None)<br>   File "/var/opt/dynatrace/gateway/remotepluginmodule/agent/plugin/engine/ruxit/plugin_state_machine.py", line 525, in engine_generator<br>     plugin_module = importlib.import_module(plugin_engine_instance.metadata["source"]["package"])<br>   File "/var/opt/dynatrace/gateway/remotepluginmodule/agent/plugin/python3.6/importlib/__init__.py", line 126, in import_module<br>     return _bootstrap._gcd_import(name[level:], package, level)<br>   File "", line 994, in _gcd_import<br>   File "", line 971, in _find_and_load<br>   File "", line 955, in _find_and_load_unlocked<br>   File "", line 665, in _load_unlocked<br>   File "", line 678, in exec_module<br>   File "", line 219, in _call_with_frames_removed<br>   File "/var/opt/dynatrace/gateway/remotepluginmodule/plugin_deployment/kafka-pipeline-plugin/kafka-pipeline-plugin.py", line 5, in <br>     from avro.io import BinaryDecoder, DatumReader<br> ModuleNotFoundError: No module named 'avro'

with plugin.json starting:

{<br>   "name": "custom.remote.python.kafka.Stats",<br>   "version": "0.003",<br>   "type": "python",<br>   "entity": "CUSTOM_DEVICE",<br>   "processTypeNames": ["PYTHON"],<br>   "technologies": ["Kafka Custom Pipeline"],<br>   "favicon": "https://www.ibm.com/watson/health/favicon.ico",<br>   "source": {<br>      "package": "kafka-pipeline-plugin",<br>      "className": "KafkaPipelinePlugin",<br>      "install_requires": ["avro","timeit","kafka"],<br>      "activation": "Remote"<br>   },<br>...<br>

Can you also add the output of oneagent_build_plugin?

Hi Rick,

have you built your plugin using

oneagent_build_plugin

command from Plugin SDK? That should build your plugin with required packages inside.

See Deploy via Plugin SDK:

https://www.dynatrace.com/support/help/extend-dyna…

Peter

thanks Piotr,
I thought that was only for oneagent plugins, some of the documentation is a little confusing.

Hi Piotr,

I previously followed the “manual” version of the deploy instructions there, before posting this question. now i’m trying to follow the sdk version and cannot find where or how to invoke the oneagent_build_plugin call, as it doesn’t seem to be on my path as a user on the linux box where my activegate and plugin module were installed, nor does it seem to be the name of any of the files in my install path. do you have direct knowledge of deploying plugins to linux activegates, and where i might be going wrong?

Thanks,

Rick B

hi, please see the comments on Piotr’s answer

Here is the instruction how to install Plugin SDK:

https://www.dynatrace.com/support/help/extend-dyna…

Hello Rick,

When you install the Plugin SDK, the install script will put these scripts inside the python /bin directory, side by side with pip, easy_install, etc.

Of course, if you do not have that directory as part of your path you will not “see” the commands. I recommend you use Python Virtual Environments (venv — Creation of virtual environments — Python 3.15.2 documentation) when developing plugins, because this will sort it our for you with no need to change your PATH environment variable or call the scripts manually from the location

thanks, i used virtualenv locally for dev and didn’t think to see that on the command line there. i’m not able to get venv set up on the activegate server so i’ll need to try to figure out where the packaged python environment is and work from there on the server. kind of annoying and not really spelled out in the directions where certain things are done, not to mention the manual method written out in the docs doesn’t work when you have required extra modules

Rick,

you don’t need to install venv on ActiveGate server, it’s enough to have it on your dev machine. Please install Plugin SDK inside you venv and use oneagent_build_plugin script to build the plugin. It will create a plugin package, which has to be uploaded to the server - the same script can do that if you provide server address and token. Finally you have to take this built plugin and story it in plugin_deployment dir on ActiveGate machine.

Peter

thank you. running into other issues now but this has resolved my dependency problem so i will open a new topic