# Plugin Development for OneAgent: Sample py script does not work?

**URL:** <https://community.dynatrace.com/t/plugin-development-for-oneagent-sample-py-script-does-not-work/7704>\
**Category:** Extensions\
**Tags:** oneagent, extensions\
**Created:** [September 5, 2017, 9:09am UTC](https://community.dynatrace.com/t/plugin-development-for-oneagent-sample-py-script-does-not-work/7704 "2017-09-05T09:09:04Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![jan\_palic](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/jan_palic/32/28246_2.png) [@jan\_palic](https://community.dynatrace.com/u/jan_palic)\
**Post date:** [September 5, 2017, 9:09am UTC](https://community.dynatrace.com/t/plugin-development-for-oneagent-sample-py-script-does-not-work/7704/1 "2017-09-05T09:09:04Z")

</div>

Hi there.

I try to understand and learn the plugin development of OneAgent plugins. I follow the documentation

\* [https://help.dynatrace.com/monitoring-plugins/cust…](https://help.dynatrace.com/monitoring-plugins/custom-plugins/how-do-i-create-a-python-custom-plugin/) and  
\* [https://dynatrace.github.io/plugin-sdk/readme.html](https://dynatrace.github.io/plugin-sdk/readme.html)

but I see after

\* installing a proper python on my debian workstation

\* installing the OneAgent and installing the whl file with pip3

nothing working and I wonder why.

First, the second documentation says that I will find a python script or module called

\* oneagent\_sdk.demo\_app

but I do not see anything in the SDK (downloaded from the Dynatrace Server) or in the OneAgent installation directory (/opt/dynatrace).  
Second, I find in the SDK directory (unzipped from the SDK archive I downloaded) the demo\_plugin.py, which does nothing calling by python3.5.

I am confused and got stuck, so my question is, what I miss to do here? May anyone help me to get my next step, running the demo plugin?

Thanks in advance.  
Jan

---

<div class="post-metadata">

**Author:** ![Julius\_Loman](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/julius_loman/32/51_2.png) [@Julius\_Loman](https://community.dynatrace.com/u/Julius_Loman)\
**Post date:** [September 5, 2017, 11:27am UTC](https://community.dynatrace.com/t/plugin-development-for-oneagent-sample-py-script-does-not-work/7704/2 "2017-09-05T11:27:37Z")

</div>

I was playing with the Oneagent SDK a while ago also on Debian. It was quite a pain since Debian is still using Python 2.7 by default and some python 3 dependencies were missing.

As far as I remember plugins are not intended to be executed directly as python files, but using oneagent\_simulate\_plugin command that gets installed with the SDK itself. Go to the demo\_plugin directory of the SDK and run the simulate plugin command oneagent\_simulate\_plugin .

Then running the python -m oneagent\_sdk.demo\_app from the documentation, I believe the python command resolves to Python 2.7 (debian default) and that is probably your cause.

---

<div class="post-metadata">

**Author:** ![jan\_palic](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/jan_palic/32/28246_2.png) [@jan\_palic](https://community.dynatrace.com/u/jan_palic)\
**Post date:** [September 5, 2017, 11:33am UTC](https://community.dynatrace.com/t/plugin-development-for-oneagent-sample-py-script-does-not-work/7704/3 "2017-09-05T11:33:09Z")

</div>

Hi Julius,

thank you for your answer and the hint.

I was looking for a file oneagent\_sdk.demo\_app and did not found it (what is clear, now!).  
My python is already set to 3.5 with update alternatives, so this was done before.

Anyway, long story short, it works… thank you.

.-)

Jan

---

<div class="post-metadata">

**Author:** ![TorstenHellwig](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/torstenhellwig/32/33996_2.png) [@TorstenHellwig](https://community.dynatrace.com/u/TorstenHellwig)\
**Post date:** [September 6, 2017, 11:41am UTC](https://community.dynatrace.com/t/plugin-development-for-oneagent-sample-py-script-does-not-work/7704/4 "2017-09-06T11:41:04Z")

</div>

Interesting - I can’t get the simulator to work on Windows. Even with the supplied sample plugins I get an error:

2017-09-06 13:25:37,314 [ERROR] - 3048(MainThread) - [\_main] Plugin simulator was stopped with enexpected exception  
Traceback (most recent call last):  
File “c:\users\torsten hellwig\appdata\local\programs\python\python35-32\lib\site-packages\oneagent\_sdk\plugin\_simulator.py”, line 217, in \_main  
external\_api=external\_api  
TypeError: main() got an unexpected keyword argument ‘external\_api’

Plugin simulator summary:

* * *

Python Version is 3.5.3, 32bit.

Any idea?

cheers,

Torsten

---

<div class="post-metadata">

**Author:** ![Julius\_Loman](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/julius_loman/32/51_2.png) [@Julius\_Loman](https://community.dynatrace.com/u/Julius_Loman)\
**Post date:** [September 6, 2017, 3:35pm UTC](https://community.dynatrace.com/t/plugin-development-for-oneagent-sample-py-script-does-not-work/7704/5 "2017-09-06T15:35:05Z")

</div>

I’m currently encountering the same bug on Linux. Which version of oneagent-sdk do you have? I have plugin-sdk-1.125.174.20170821-131816

---

<div class="post-metadata">

**Author:** ![Julius\_Loman](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/julius_loman/32/51_2.png) [@Julius\_Loman](https://community.dynatrace.com/u/Julius_Loman)\
**Post date:** [September 6, 2017, 3:44pm UTC](https://community.dynatrace.com/t/plugin-development-for-oneagent-sample-py-script-does-not-work/7704/6 "2017-09-06T15:44:26Z")

</div>

It must be definitely a bug in the simulator in recent versions. I’ve tried also the 123 version and 113 (I’v found the archive on my laptop). In 113 the oneagent\_simulator seems to be working and it’s not failing at the external\_api error.

---

<div class="post-metadata">

**Author:** ![TorstenHellwig](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/torstenhellwig/32/33996_2.png) [@TorstenHellwig](https://community.dynatrace.com/u/TorstenHellwig)\
**Post date:** [September 6, 2017, 3:58pm UTC](https://community.dynatrace.com/t/plugin-development-for-oneagent-sample-py-script-does-not-work/7704/7 "2017-09-06T15:58:15Z")

</div>

Yes, I got the same answer in the meantime from [@Michael L.](https://answers.dynatrace.com/users/4119/view.html)

Seems to be a known bug with my 123.229 version. Good to know that 113 works.

torsten

---

<div class="post-metadata">

**Author:** ![chuan\_sern\_wong](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/chuan_sern_wong/32/32488_2.png) [@chuan\_sern\_wong](https://community.dynatrace.com/u/chuan_sern_wong)\
**Post date:** [September 7, 2017, 7:19am UTC](https://community.dynatrace.com/t/plugin-development-for-oneagent-sample-py-script-does-not-work/7704/8 "2017-09-07T07:19:59Z")

</div>

,

Hi Guys,

Just begin my baby step to the plugin exploration and encountered the same issue on my vagrant - CentOS Linux release 7.3.1611 (Core). Do anyone know where to download the previous version that works ?

[vagrant@localhost demo\_plugin\_multi]$ oneagent\_sim  
2017-09-07 07:03:23,633 [ERROR] - 140201704101696(MainThread) - [\_main] Plugin simulator was stopped with enexpected exception  
Traceback (most recent call last):  
File “/usr/lib/python3.5/site-packages/oneagent\_sdk/plugin\_simulator.py”, line 217, in \_main  
external\_api=external\_api  
TypeError: main() got an unexpected keyword argument ‘external\_api’

---

<div class="post-metadata">

**Author:** ![Julius\_Loman](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/julius_loman/32/51_2.png) [@Julius\_Loman](https://community.dynatrace.com/u/Julius_Loman)\
**Post date:** [September 7, 2017, 7:29am UTC](https://community.dynatrace.com/t/plugin-development-for-oneagent-sample-py-script-does-not-work/7704/9 "2017-09-07T07:29:49Z")

</div>

Historical versions are not available to download from the UI.  
However I’m uploading here the old version (113) that was laying around on my HDD from the time I made first steps with the SDK.

Let’s hope it won’t violate some policy for uploading that here. 🙂  
[plugin-sdk-111326320170313-105814.zip](https://community.dynatrace.com/uploads/short-url/dBmjfPJxpThOECsKxcZIBeN4WZ6.zip) (3.03 MB)

---

<div class="post-metadata">

**Author:** ![TorstenHellwig](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/torstenhellwig/32/33996_2.png) [@TorstenHellwig](https://community.dynatrace.com/u/TorstenHellwig)\
**Post date:** [September 7, 2017, 8:30am UTC](https://community.dynatrace.com/t/plugin-development-for-oneagent-sample-py-script-does-not-work/7704/10 "2017-09-07T08:30:21Z")

</div>

Perfect! Works…

---

<div class="post-metadata">

**Author:** ![Jakub\_Mierzewsk](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/jakub_mierzewsk/32/36350_2.png) [@Jakub\_Mierzewsk](https://community.dynatrace.com/u/Jakub_Mierzewsk)\
**Post date:** [September 7, 2017, 9:36am UTC](https://community.dynatrace.com/t/plugin-development-for-oneagent-sample-py-script-does-not-work/7704/11 "2017-09-07T09:36:40Z")

</div>

This bug is fixed in agent 127. [@Julius L.](https://answers.dynatrace.com/users/16467/view.html) thx for workaround

---

<div class="post-metadata">

**Author:** ![Karolina\_Linda](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/karolina_linda/32/36089_2.png) [@Karolina\_Linda](https://community.dynatrace.com/u/Karolina_Linda)\
**Post date:** [September 7, 2017, 9:41am UTC](https://community.dynatrace.com/t/plugin-development-for-oneagent-sample-py-script-does-not-work/7704/12 "2017-09-07T09:41:38Z")

</div>

No, it won’t 🙂

Actually, it’s one of the best “self-service” threads I’ve read in the Dynatrace forums 🙂

Best regards,

Karolina

---

<div class="post-metadata">

**Author:** ![Julius\_Loman](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/julius_loman/32/51_2.png) [@Julius\_Loman](https://community.dynatrace.com/u/Julius_Loman)\
**Post date:** [September 11, 2017, 8:06am UTC](https://community.dynatrace.com/t/plugin-development-for-oneagent-sample-py-script-does-not-work/7704/13 "2017-09-11T08:06:36Z")

</div>

FYI - It seems the problem is resolved in latest SDK - version 127. At least it works for me now.

---

<div class="post-metadata">

**Author:** ![thobishim](https://avatars.discourse-cdn.com/v4/letter/t/aeb1de/32.png) [@thobishim](https://community.dynatrace.com/u/thobishim)\
**Post date:** [September 9, 2018, 9:28pm UTC](https://community.dynatrace.com/t/plugin-development-for-oneagent-sample-py-script-does-not-work/7704/14 "2018-09-09T21:28:54Z")

</div>

Hi

I am also trying to test out the SDK but I am getting the following error whenever I try to test the simulator:

--------------------------------------------------------------------------------------------------------------------------------------------

C:\Users\NB204316\Documents\plugin-sdk-1.149.213.20180809-141631\examples\demo\_oneagent\_plugin\>oneagent\_simulate\_plugin INFO:ruxit.plugin\_loop:Installing plugins with conflict resolution INFO:ruxit.package\_utils.plugin\_updater:Unable to get revision from plugin\_directory\_path ‘C:\\Users\\NB204316\\Documents\\plugin-sdk-1.149.213.20180809-141631\\examples\\demo\_oneagent\_plugin’, assuming -1 INFO:ruxit.package\_utils.plugin\_updater:plugins\_by\_revision: defaultdict(\<class ‘dict’\>, {‘no\_revision’: {‘custom.python.demo\_plugin’: PluginInfo(name=‘custom.python.demo\_plugin’, reported\_name=‘custom.python.demo\_plugin’, version=‘1.2’, directory=‘C:\\Users\\NB204316\\Documents\\plugin-sdk-1.149.213.20180809-141631\\examples\\demo\_oneagent\_plugin’ package=‘demo\_plugin’)}}) INFO:ruxit.package\_utils.plugin\_updater:Installing plugins INFO:ruxit.package\_utils.plugin\_updater:Processing revision ‘no\_revision’ INFO:ruxit.package\_utils.plugin\_updater:Processing candidate\_entries: {‘custom.python.demo\_plugin’: PluginInfo(name=‘custom.python.demo\_plugin’, reported\_name=‘custom.python.demo\_plugin’, version=‘1.2’, directory=‘C:\\Users\\NB204316\\Documents\\plugin-sdk-1.149.213.20180809-141631\\examples\\demo\_oneagent\_plugin’ package=‘demo\_plugin’)} INFO:ruxit.package\_utils.plugin\_updater:Working set validated, new current\_entries: OrderedDict([(‘custom.python.demo\_plugin’, PluginInfo(name=‘custom.python.demo\_plugin’, reported\_name=‘custom.python.demo\_plugin’, version=‘1.2’, directory=‘C:\\Users\\NB204316\\Documents\\plugin-sdk-1.149.213.20180809-141631\\examples\\demo\_oneagent\_plugin’ package=‘demo\_plugin’))]) INFO:ruxit.package\_utils.plugin\_updater:Plugin PluginInfo(name=‘custom.python.demo\_plugin’, reported\_name=‘custom.python.demo\_plugin’, version=‘1.2’, directory=‘C:\\Users\\NB204316\\Documents\\plugin-sdk-1.149.213.20180809-141631\\examples\\demo\_oneagent\_plugin’ package=‘demo\_plugin’) from revision ‘no\_revision’ compatible INFO:ruxit.package\_utils.plugin\_updater:Processing revision ‘plugin\_deployment’ INFO:ruxit.package\_utils.plugin\_updater:Processing revision ‘plugin\_development’ INFO:ruxit.plugin\_loop:========= INCOMPATIBLE PLUGINS ========= INFO:ruxit.plugin\_loop:[] INFO:ruxit.plugin\_loop:======================================== INFO:ruxit.plugin\_loop:\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* INFO:ruxit.plugin\_loop:[PluginInfo(name=‘custom.python.demo\_plugin’, reported\_name=‘custom.python.demo\_plugin’, version=‘1.2’, directory=‘C:\\Users\\NB204316\\Documents\\plugin-sdk-1.149.213.20180809-141631\\examples\\demo\_oneagent\_plugin’ package=‘demo\_plugin’)] **INFO:ruxit.plugin\_loop:\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* INFO:ruxit.plugin\_loop:sys.path after installing plugins: [‘C:\\Python35\\Scripts\\oneagent\_simulate\_plugin.exe’, ‘c:\\python35\\python35.zip’, ‘c:\\python35\\DLLs’, ‘c:\\python35\\lib’, ‘c:\\python35’, ‘c:\\python35\\lib\\site-packages’, ‘C:\\Users\\NB204316\\Documents\\plugin-sdk-1.149.213.20180809-141631\\examples\\demo\_oneagent\_plugin’] ERROR:oneagent\_sdk.plugin\_simulator:Plugin simulator was stopped with unexpected exception Traceback (most recent call last): File “c:\python35\lib\site-packages\oneagent\_sdk\plugin\_simulator.py”, line 265, in \_main platform\_api=platform\_api File “c:\python35\lib\site-packages\ruxit\plugin\_loop.py”, line 340, in main loop.main() File “c:\python35\lib\site-packages\ruxit\plugin\_loop.py”, line 91, in main next(support\_alert\_creator) TypeError: ‘Mock’ object is not an iterator**

--------------------------------------------------------------------------------------------------------------------------------------------

I am running Python 3.5 and my sdk is plugin-sdk-1.149.213.20180809-141631 on Windows 10

I am trying to run “oneagent\_simulate\_plugin”

---

<div class="post-metadata">

**Author:** ![thobishim](https://avatars.discourse-cdn.com/v4/letter/t/aeb1de/32.png) [@thobishim](https://community.dynatrace.com/u/thobishim)\
**Post date:** [September 9, 2018, 9:44pm UTC](https://community.dynatrace.com/t/plugin-development-for-oneagent-sample-py-script-does-not-work/7704/15 "2018-09-09T21:44:45Z")

</div>

I’m not sure if I am missing anything, as this is a the error that has more meaning “ **TypeError: ‘Mock’ object is not an iterator** ”

It looks like python is having issues with the Mock object
