03 Jan 2025 10:15 AM - edited 03 Jan 2025 02:24 PM
Problem
After migrating hosts from Managed to SaaS or after migrating tenants, if there were hosts for which monitoring was disabled in the past, Dynatrace users may find it challenging to re-enable monitoring for those hosts given that they won't be visible in the UI, despite the OneAgent may be running on those hosts.
This happens because the host entity is created on the new tenant after a successful connection to the cluster, which wouldn't happen in this particular case as the cluster deactivates the agent due to the "do not monitor" configuration.
Troubleshooting steps
Ensure that the OneAgent is running on the host and verify that the disablement reason in OS agent logs is HOST_MONITORING_DISABLED:
Default OS log location in Windows: C:\ProgramData\dynatrace\oneagent\log\os\ruxitagent_host_XXXX
Default OS log location in Linux: /var/log/dynatrace/oneagent/os/ruxitagent_host_XXXXX.0.log
You may see log entries like below:
2025-01-02 07:41:52.148 UTC [0000cb3a] info [native] ConfigFromServer: Updating active state to OFF (server 0x00000001)
2025-01-02 07:41:52.149 UTC [0000cb3a] info [native] Disablement reason changed to: [HOST_MONITORING_DISABLED]
2025-01-02 07:41:52.149 UTC [0000cb3a] info [native] ============================== Agent inactivated ============================== (no more data will be sent by this agent, except heartbeats and config requests.)
2025-01-02 07:41:52.149 UTC [0000cb3a] info [native] Agent configuration updated; agent is now inactive
Resolution
There are 2 ways to re-enable host monitoring:
1) Modify the host settings via the UI > If host monitoring was disabled after the migration on the new tenant, then monitoring can be easily re-enabled as follows:
2) Use the Settings API > If the host is not visible in the hosts page even after using all possible timeframes, it could mean that the host entity was not created on the new tenant because the cluster deactivates the agent upon initial connection. To re-enable monitoring for said host, the Settings API should be used:
First, you'll need to find the HOST ID (OSI ID) to be used in the API call. To obtain this, search for the line containing OSI ID in the OS agent log (ruxitagent_host_XXXX.log mentioned in Troubleshooting steps). You should see a line like below (the last 16 alphanumeric digits are used as the HOST ID -> i.e.: HOST-21A1FBFA9960E7FA):
2025-01-02 08:11:15.115 UTC [00002e40] info [native] OSI ID ...................... 0x21a1fbfa9960e7fa
Now you can use the HOST ID to make an API call via curl (POST) to the Settings API to re-enable monitoring as shown below:
SaaS:
curl -X 'POST' 'https://{environmentid}.live.dynatrace.com/api/v2/settings/objects?validateOnly=false' -H 'accept: application/json; charset=utf-8' -H 'Authorization: Api-Token dt0c01.XXXXXXX' -H 'Content-Type: application/json; charset=utf-8' -d '[{"schemaId":"builtin:host.monitoring","schemaVersion":"1.3","scope":"HOST-21A1FBFA9960E7FA","value":{"enabled":true,"autoInjection":true}}]'
Managed:
curl -X 'POST' 'https://{your-domain}/e/{your-environment-id}/api/v2/settings/objects?validateOnly=false' -H 'accept: application/json; charset=utf-8' -H 'Authorization: Api-Token dt0c01.XXXXXXX' -H 'Content-Type: application/json; charset=utf-8' -d '[{"schemaId":"builtin:host.monitoring","schemaVersion":"1.3","scope":"HOST-21A1FBFA9960E7FA","value":{"enabled":true,"autoInjection":true}}]'
Make sure to replace the environment ID, host ID and use an access token in the API call with the following scopes:
- Read entities
- Write settings
If the API call was successful, host monitoring has been enabled and the host should be visible in the UI as soon as it connects to the cluster.
What's next
If this article did not help, please open a support ticket and provide the following information: