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

Python Module Dependency

jason_jenkinson
Contributor

Hi

I am creating a custom python plugin to query MSMQ stats on a windows server, the initial script is working locally but when I package and load the zip to the dynatrace server it responds with Package Not Found.

Is there a dependency so the modules are present on both Dyantrace server and host server.

Thanks in advance

Jason


6 REPLIES 6

Mike_L
Dynatrace Pro
Dynatrace Pro

Hi Jason,

The Dynatrace server only cares about the plugin.json at the moment. When you did the oneagent_build_plugin command, make sure that it created a folder of the plugin in the plugin_development folder, and do not press the button to upgrade the plugin to production from within the Dynatrace GUI.

Make sure that you build the plugin with the same version as the Dynatrace Plugin Agent (Python 3.6 64-bit unless you have an old OneAgent, then it is Python 3.5 64-bit). Some dependencies compile native libraries during build time, and then you need them to be importable.

If that's done and it still doesn't work. Please attach the log file of the plugin (found at programdata/dynatrace/oneagent/log/plugin/ruxitagent_pluginagent_[PID].log).

Mike


Thanks for the reply.

I have checked and I have python 3.7, not sure if that is going to be an issue but it could be as I was initially running pip 18.0 and had to downgrade to pip 9.3 in order to validate the json schema.

Also I can see that when I execute oneagent_build_plugin the package is zipped and placed into the development directory along with an archive, see below.

======================================== Plugin deployed successfully into C:\Program Files (x86)\dynatrace\oneagent\plugin_development\custom.python.demo_plugin

Plugin archive available at C:\Program Files(x86)\dynatrace\oneagent\plugin_development\custom.python.demo_plugin.zip ======================================== Restarting service Dynatrace OneAgent The Dynatrace OneAgent service is stopping.... The Dynatrace OneAgent service was stopped successfully. The Dynatrace OneAgent service was started successfully. oneagent service restarted successfully

I will uninstall python 3.7 and go back to 3.6 to give that another go, if that does fail then I will post the log.

Thanks again

Jason


Hi Michael

So rebuilt the code and searched through the logs and I can see the following in the attached, this is not the entire log but a snippet.

module-issue.txt

creating a normal .py file on the host in question I can import the module and the query returns results successful.

If needed I can attach the full log file.

Thanks again

Jason


Do you have the wmi.py file in the root of your custom.python.demo_plugin directory? Did you add the install_requires into your plugin.json file? Such as this:

"install_requires": ["wmi==1.4.9", "pypiwin32==223", "pythonnet==2.3.0"],


I've tested it out locally and got it running by also copying the following files from sub directories of the built plugin into the root of it:

_win32sysloader.pyd

pythoncom36.dll

pywintypes.py

pywintypes36.dll

winerror.py


boubacar_diallo
Inactive

Jason, am looking at similar feature to query/read MSMQ on windows. Maybe you can share scripts so that I don't have to write something from scratch. Many thanks