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

ActiveGate plugin Python dependency

rick_boyd
Mentor

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

11 REPLIES 11

rick_boyd
Mentor
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):
File "/var/opt/dynatrace/gateway/remotepluginmodule/agent/plugin/engine/ruxit/plugin_state_machine.py", line 270, in _execute_next_task
self._engine.send(None)
File "/var/opt/dynatrace/gateway/remotepluginmodule/agent/plugin/engine/ruxit/plugin_state_machine.py", line 525, in engine_generator
plugin_module = importlib.import_module(plugin_engine_instance.metadata["source"]["package"])
File "/var/opt/dynatrace/gateway/remotepluginmodule/agent/plugin/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 994, in _gcd_import
File "", line 971, in _find_and_load
File "", line 955, in _find_and_load_unlocked
File "", line 665, in _load_unlocked
File "", line 678, in exec_module
File "", line 219, in _call_with_frames_removed
File "/var/opt/dynatrace/gateway/remotepluginmodule/plugin_deployment/kafka-pipeline-plugin/kafka-pipeline-plugin.py", line 5, in
from avro.io import BinaryDecoder, DatumReader
ModuleNotFoundError: No module named 'avro'

with plugin.json starting:

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

Can you also add the output of oneagent_build_plugin?


Mike

hi, please see the comments on Piotr's answer


Piotr_Meller
Dynatrace Helper
Dynatrace Helper

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


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 (https://docs.python.org/3/library/venv.html) 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.

https://www.dynatrace.com/support/help/extend-dynatrace/activegate-plugins/plugin-development/activegate-plugin-sdk-overview/

Peter


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


Piotr_Meller
Dynatrace Helper
Dynatrace Helper

Here is the instruction how to install Plugin SDK:

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


Featured Posts