12 Apr 2018 09:51 AM - last edited on 09 Dec 2021 10:15 AM by MaciejNeumann
Hi,
I suceeded in installing Dynatrace OneAgent to monitor a Kubernetes cluster deployed in Azure Container Service and I would like to do the same on Azure Compute VMs.
It was also successful through Azure Portal UI to set the OneAgent extension to VM but I tried to use Hashicorp Terraform for the same purpose and then I encountered an issue.
My terraform resource file looks like this :
resource "azurerm_virtual_machine_extension" "instance" {
name = "vmname_oneAgentLinux"
location = "westeurope"
resource_group_name = "my_resource_group_name"
virtual_machine_name = "vm_name"
publisher = "dynatrace_publisher"
type = "oneAgentLinux"
type_handler_version = "2.3.0.1"
settings = "{ \"tenantId\" : \"mytenant\" , \"token\" : \"mytoken\" }"
}
Firstly I thought type and type_handler_version were not mandatory (as it was not in azure portal) but I found values indicated in https://www.dynatrace.com/support/help/cloud-platf...
So I've got supposed valid values by requesting azure cli:
az vm extension image list --location westeurope -p dynatrace.ruxit -o table
Name Publisher Version
---------------------- --------------- ---------
oneAgentLinux dynatrace.ruxit 1.150.0.0
oneAgentLinux dynatrace.ruxit 1.151.0.0
oneAgentLinux dynatrace.ruxit 1.151.0.1
oneAgentLinux dynatrace.ruxit 1.99.1.1
oneAgentLinux dynatrace.ruxit 1.99.1.2
oneAgentLinux dynatrace.ruxit 1.99.2.0
oneAgentLinux dynatrace.ruxit 1.99.2.1
oneAgentLinux dynatrace.ruxit 2.2.0.0
oneAgentLinux dynatrace.ruxit 2.2.0.1
oneAgentLinux dynatrace.ruxit 2.2.0.2
oneAgentLinux dynatrace.ruxit 2.3.0.0
oneAgentLinux dynatrace.ruxit 2.3.0.1
But whatever value I use, I get the same error when I apply my terraform :
* azurerm_virtual_machine_extension.instance: compute.VirtualMachineExtensionsClient#CreateOrUpdate: Failure sending request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="InvalidParameter" Message="The value of parameter typeHandlerVersion is invalid." * azurerm_virtual_machine_extension.instance: 1 error(s) occurred:
Did someone here already have same issue with the installation of oneAgent on Azure VMs (not forcibly with terraform but arm or powershell, azure cli... ) ?
Thanks
Sylvain
PS: additional informations : Azure Datacenter Westeurope
Terraform 0.10
terraform provider.azurerm 1.1.2
Solved! Go to Solution.
12 Apr 2018 10:20 AM
uh uh, just 5 minutes later, I found the trick : type_handler_version parameter value seems to be limited to 2 digits.
So with the value "2.3" my terraform plan goes on... but failed with a new more comprehensible message 🙂
Long running operation terminated with status 'Failed': Code="VMExtensionProvisioningError" Message="VM has reported a failure when processing extension 'oneAgentLinux'. Error message: \"Installation failed: ERROR: Downloading agent installer failed!\"."
Probably a problem of availability of this version of agent in my datacenter location
12 Apr 2018 01:15 PM
Still struggling with versions...
I'm confused with the actual OneAgent version (1.139) and the list of versions provided by Azure extensions (1.99.*, 1.150.*, 1.151.*, 2.2.*, 2.3.*)
10 Dec 2018 10:00 AM
I got the same problem, but I had entered my Azure TenantID in the tenantid field, while it should be the Dynatrace environment id.
28 Nov 2023 01:24 PM
Just in case someone else is looking for a way to set additional properties, like host tags, etc.
You can provide even more properties by using the installerArguments property:
\"installerArguments\":\"--set-host-tag=stage=dev --set-host-tag=application=example_application --set-monitoring-mode=fullstack\"
Kind regards
Sebastian
03 Jul 2024 08:46 AM
This is my code:
03 Jul 2024 10:13 PM
This is the implementation, that is still running on my side. Good luck:
resource "azurerm_virtual_machine_extension" "dynatrace_oneagent" {
name = "dynatrace_oneAgentLinux"
virtual_machine_id = azurerm_linux_virtual_machine.cloud-init-azdevops.id
publisher = "dynatrace.ruxit"
type = "oneAgentLinux"
type_handler_version = "2.3"
settings = "{ \"tenantId\" : \"${var.environment_id}\" , \"token\" : \"${var.environment_api_token}\", \"server\":\"https://${var.environment_ag_url}/e/${var.environment_id}/api\", \"enableLogAnalytics\":\"yes\", \"installerArguments\":\"--set-host-group=MYPROJECT-${var.environment_name} --set-monitoring-mode=infra-only --set-host-tag=application=MYPROJECT --set-host-tag=stage=${var.environment_name} --set-host-tag=datacenter=AZURE\" }"
tags = local.tags
auto_upgrade_minor_version = true
depends_on = [
azurerm_linux_virtual_machine.cloud-init-azdevops
]
}
04 Jul 2024 09:57 AM
Thanks.
I am not sure why installerArguments are not working for me
05 Jul 2024 08:47 AM
Hmmm strange. Is your INSTALL_PATH accessible for the installation?
Is it possible to get more logs from the installation to get more insights, why it failed?
Kind regards, Sebastian
05 Jul 2024 09:01 AM
I am not sure, but the thing is that it is not taking any setup from installerArguments.
It's not just install path, it's not setting host group, host tags, nothing
05 Jul 2024 10:23 AM
this is my code and for me it looks like yours:
05 Jul 2024 10:34 AM
I also don't see any relevant difference in the code.And without the logs, it's hard to debug anything.
Seems like you need to raise a support ticket for Dynatrace. Afaik Terraform isn't supported by Dynatrace. But it's worth a try.
02 Jul 2024 04:11 PM
Guys,
Did you resolve this problem?
I am trying the same but I am getting an error:
API Response:
│
│ ----[start]----
│ {
│ "startTime": "2024-07-02T15:00:42.6313686+00:00",
│ "endTime": "2024-07-02T15:01:13.2250994+00:00",
│ "status": "Failed",
│ "error": {
│ "code": "VMExtensionProvisioningError",
│ "message": "VM has reported a failure when processing extension 'vmdacatest01' (publisher 'dynatrace.ruxit' and type 'oneAgentLinux'). Error message: 'Installation failed: ERROR: Agent installer failed'. More information on troubleshooting is available at https://aka.ms/vmextensionlinuxtroubleshoot. "
│ },
│ "name": "5970bb69-741d-455c-b39d-3ec85bb6c31e"
│ }
│ -----[end]-----
│
│
│ with azurerm_virtual_machine_extension.dynatrace_extension,
20 Sep 2024 07:29 AM
I resolved the issue that I had, here is the code that is working for me: