dynatrace-oss / terraform-provider-dynatrace

Apache License 2.0
71 stars 33 forks source link

custom script for host monitoring #538

Closed MohamedAnouar closed 1 month ago

MohamedAnouar commented 1 month ago

When I open the settings of a host I can setup "custom scripts" to monitor specific metrics in my instance. Is there a way to do this via the API/ this Provider ? Thank you

kishikawa12 commented 1 month ago

Hi @MohamedAnouar,

Are you able to provide additional details/screenshots of what you are referring to?

Thanks!

MohamedAnouar commented 1 month ago

Hello,

I'm trying to configure under the host settings the extension : Custom scripts. After tracing the API calls, I found the following information about the target extension : extensionId: dynatrace.python.customscripts extensionType: PYTHON

By tracing the browser calls, I found that the API called to update the extension settings is the following : "/rest/configuration/monitoringextensions/hosts/$HOST_NAME with the extension ID and config in the PUT request data.

Can we use the current version of the provider to configure the extension or should we wait for a future version ?

Thank you

Reinhard-Pilz-Dynatrace commented 1 month ago

Hello @MohamedAnouar,

If I'm not mistaken, you're talking about a OneAgent Extension based on the Extension Framework V1 - developed by our Services Team. Although the public REST API of Dynatrace offers a way to configure these (i.e. the counter part for the URL /rest/configuration/monitoringextensions/hosts/$HOST_NAME you had reverse engineered), we've never implemented any resources for Terraform. Reasoning behind that was, that the EF1 was expected to get desupported sooner or later ... which coincidentally will be happening in about a month from now.

What you CAN configure using Terraform are Extensions based on the Extensions Framework V2 - for instance using the resource dynatrace_hub_extension_config. I'm unfortunately not sure whether our Services Team has already migrated the dynatrace.python.customscripts Plugin to Extensions V2. But in case there already exists a replacement, the above mentioned resource should do the trick.

Let me know if there are any further questions and I'll reopen the ticket.