Deploy your plugin¶
Once you decide that your plugin is ready for distribution, take the following steps:
Build the final version of the plugin using the
oneagent_build_plugintool.Promote the plugin to production mode. To do this, go to Settings > Monitored technologies > Custom plugins and select a staging plugin that you're satisfied with. Hit the Upgrade now button.
Deploy the plugin by copying the folder generated by
oneagent_build_plugintool to theplugin_deploymentfolder in the root of your OneAgent installation [1] or use a configuration management tool, such as Puppet, Chef, or Ansible.Be sure that you copy the entire folder (named for examplecustom.python.demo_plugin), and not the zip archive that is generated byoneagent_build_plugin.Restart OneAgent.
Important considerations
Please note when distributing custom plugins:
- The plugin directories require at least read permissions for the appropriate user [2].
- Changing the contents of the plugin requires restarting OneAgent so that the plugins will be reloaded.
- If you're unsure how the plugins are loaded, and if you've copied them to the right place, learn more at Plugin life cycle in the "Plugin loading" section.
Example deployment with Ansible¶
An example playbook for distributing your plugin via Ansible could look similar to this:
---
- hosts: plugin_deployment
tasks:
- name: copy plugin folder
copy:
src: /opt/dynatrace/oneagent/plugin_development/custom.python.demo_plugin
dest: /opt/dynatrace/oneagent/plugin_deployment/
- name: restart agent service
service: name=oneagent state=restarted
become: true
Given you have inventory with plugin_deployment group, the output of running the script could look like this:
vagrant@ubuntu-trusty-64:~/workspace/ansible⟫ ansible-playbook -i inventory.ini deploy_plugin.yml
__________________
< PLAY [localhost] >
------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
______________
< TASK [setup] >
--------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
ok: [localhost]
___________________________
< TASK [copy plugin folder] >
---------------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
ok: [localhost]
______________________________
< TASK [restart agent service] >
------------------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
changed: [localhost]
____________
< PLAY RECAP >
------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
localhost : ok=3 changed=1 unreachable=0 failed=0
If you're unsure how ansible works please refer to Ansible documentation
| [1] | Usually /opt/dynatrace/oneagent or C:\\Program Files (x86)\\dynatrace\\oneagent |
| [2] | dtuser on linux, Local system account on Windows |