<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic SaaS migration PART 3 - DPS consumption related issue SaaS vs Managed in Dynatrace tips</title>
    <link>https://community.dynatrace.com/t5/Dynatrace-tips/SaaS-migration-PART-3-DPS-consumption-related-issue-SaaS-vs/m-p/305359#M2188</link>
    <description>&lt;P&gt;Hi Folks,&lt;/P&gt;&lt;P&gt;During a SaaS migration, we had to solve a license consumption-related challenge.&lt;/P&gt;&lt;P&gt;In Managed DPS, we could offer our clients the option to reduce their DEV and UAT license consumption and use the released capacity to cover more IT infrastructure.&lt;/P&gt;&lt;P&gt;There were several options, but we always chose to &lt;STRONG&gt;switch off the environments at the environment level&lt;/STRONG&gt;, instead of, for example, switching off OneAgents on the hosts. It was the simplest solution.&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.dynatrace.com/managed/dynatrace-api/cluster-api/cluster-api-v2/environments/update-specific-managed-environment" target="_blank" rel="noopener"&gt;Update specific environment — Dynatrace Managed Docs&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Example call form the documentation:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;curl -X PUT "https://myManaged.cluster.com/api/cluster/v2/environments/19a963a7-b19f-4382-964a-4df674c8eb8e?createToken=false" -H "accept: application/json; charset=utf-8" -H "Authorization: Api-Token fSRCdB7PQDSdFVANvNfSF" -H "Content-Type: application/json; charset=utf-8" -d "
{\"name\":\"MyNewTeam\",\"id\":\"19a963a7-b19f-4382-964a-4df674c8eb8e\",\"trial\":false,\"state\":\"DISABLED\",\"tags\":[\"owner:john.wicked@dynatrace.com\",\"department:finance\"],\"storage\":{\"userSessionRetention\":{\"maxLimitInDays\":90},\"sessionReplayRetention\":{\"maxLimitInDays\":35}}}&lt;/LI-CODE&gt;&lt;P&gt;For this, we used the documented Cluster API v2 Environments API calls. We created environment disable and environment enable curl requests for each environment and scheduled them using cron jobs.&lt;/P&gt;&lt;P&gt;The schedule looked like this:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Switch off DEV/UAT environments at 20:00 on weekdays.&lt;/LI&gt;&lt;LI&gt;Switch them back on at 06:30 on weekdays.&lt;/LI&gt;&lt;LI&gt;Keep them switched off for the entire weekend.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;This way, many Host Unit / GiB-hours could be freed up and used to monitor other infrastructure entities.&lt;/P&gt;&lt;P&gt;We did not observe any issues with this solution.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ADVANTAGE:&lt;/STRONG&gt; The OneAgent recognizes when the environment/ActiveGate is in an "off" state and stops generating traffic. When the environment/ActiveGate becomes available again, the OneAgent recognizes the "on" state and resumes traffic generation.&lt;/P&gt;&lt;P&gt;Switch off&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Mizs_0-1792092478837.png"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/34434i822AC10139887ECC/image-dimensions/830x63?v=v2" alt="Mizs_0-1792092478837.png" title="Mizs_0-1792092478837.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Switch on&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Mizs_1-1792092516267.png"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/34435iCE4607F17760C394/image-dimensions/838x44?v=v2" alt="Mizs_1-1792092516267.png" title="Mizs_1-1792092516267.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;There is no need to restart processes or pods because the OneAgent remains up and running the whole time, so code module injection remains active.&lt;/P&gt;&lt;P&gt;At the SaaS environment level, however, there is no equivalent API call. But we still had to provide a solution for our clients.&lt;/P&gt;&lt;P&gt;We evaluated several options. The final two candidates were:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Switch off the ActiveGates.&lt;/LI&gt;&lt;LI&gt;Switch off the OneAgents.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;Switching off the ActiveGates&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;We did not experience any problems with "normal" VMs + OneAgent (Linux/Windows) after switching the Linux/Windows ActiveGates off and back on.&lt;/P&gt;&lt;P&gt;However, in Kubernetes environments, we encountered OneAgent injection issues after the containerized ActiveGates "started" again.&lt;/P&gt;&lt;P&gt;Client created solution for "swith on/off" cron jobs of AG: (remove of AG capabilities...)&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: dynakube-scaler
  namespace: dynatrace
rules:
- apiGroups: ["dynatrace.com"]
  resources: ["dynakubes"]
  verbs: ["get", "patch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: dynakube-scaler-binding
  namespace: dynatrace
subjects:
- kind: ServiceAccount
  name: scaler-sa
  namespace: dynatrace
roleRef:
  kind: Role
  name: dynakube-scaler
  apiGroup: rbac.authorization.k8s.io
     
kind: CronJob
apiVersion: batch/v1
metadata:
  name: stop-activegate
  namespace: dynatrace
spec:
  schedule: "0 19 * * *"
  timeZone: Europe/Budapest
  concurrencyPolicy: Forbid
  suspend: false
  jobTemplate:
    spec:
      template:
        spec:
          containers:
            - name: oc
              image: xxx/openshift4/ose-cli
              command:
                - oc
              args:
                - patch
                - dynakube/ocpapgsb
                - -n
                - dynatrace
                - --type=merge
                - -p
                - '{"spec":{"activeGate":{"capabilities":[]}}}'
              resources: {}
              terminationMessagePath: /dev/termination-log
              terminationMessagePolicy: File
              imagePullPolicy: Always
          restartPolicy: Never
          terminationGracePeriodSeconds: 30
          dnsPolicy: ClusterFirst
          serviceAccountName: scaler-sa
          serviceAccount: scaler-sa
          securityContext: {}
          schedulerName: default-scheduler
  successfulJobsHistoryLimit: 3
  failedJobsHistoryLimit: 1
   
kind: CronJob
apiVersion: batch/v1
metadata:
  name: start-activegate
  namespace: dynatrace
spec:
  schedule: "0 18 * * *"
  timeZone: Europe/Budapest
  concurrencyPolicy: Forbid
  suspend: false
  jobTemplate:
    spec:
      template:
        spec:
          containers:
            - name: oc
              image: xxx/openshift4/ose-cli
              command:
                - oc
              args:
                - patch
                - dynakube/ocpapgsb
                - -n
                - dynatrace
                - --type=merge
                - -p
                - '{"spec":{"activeGate":{"capabilities":["routing","kubernetes-monitoring","dynatrace-api"]}}}'
              resources: {}
              terminationMessagePath: /dev/termination-log
              terminationMessagePolicy: File
              imagePullPolicy: Always
          restartPolicy: Never
          terminationGracePeriodSeconds: 30
          dnsPolicy: ClusterFirst
          serviceAccountName: scaler-sa
          serviceAccount: scaler-sa
          securityContext: {}
          schedulerName: default-scheduler
  successfulJobsHistoryLimit: 3
  failedJobsHistoryLimit: 1&lt;/LI-CODE&gt;&lt;P&gt;So, &lt;STRONG&gt;switching off the OneAgents was the winner.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;But how???&lt;/P&gt;&lt;P&gt;Of course, we used the latest Dynatrace Workflow functionality. Once again, we aimed for the simplest possible solution.&lt;/P&gt;&lt;P&gt;We created four workflows:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Switch off OneAgents on the hosts at a scheduled time.&lt;/LI&gt;&lt;LI&gt;Switch on OneAgents on the hosts at a scheduled time.&lt;/LI&gt;&lt;LI&gt;Switch off OneAgents on the hosts on demand, for example, in emergency situations.&lt;/LI&gt;&lt;LI&gt;Switch on OneAgents on the hosts on demand, for example, in emergency situations.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;The workflow itself is very simple.&lt;/P&gt;&lt;P&gt;The first main step collects the host list using an API call. The second main step switches the OneAgents off or on using API calls from a script created with DT Assist.&lt;/P&gt;&lt;P&gt;Here is an example workflow for switch off.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Mizs_2-1792092597154.png"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/34436iD5AB6D4F90894886/image-size/medium?v=v2&amp;amp;px=400" alt="Mizs_2-1792092597154.png" title="Mizs_2-1792092597154.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;First main step&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;host_list is a GET API call using the appropriate API token.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;https://xxx.live.dynatrace.com/api/v2/entities?entitySelector=type%28%22HOST%22%29&amp;amp;from=now-3d &lt;/LI-CODE&gt;&lt;P&gt;now-3d can cause a logical problem. For example, you might switch on hosts that you don't actually want to switch on. You can adjust this time range according to your requirements.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Second main step&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Use the results from host_list in a script and switch the OneAgents on or off on the selected hosts.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;import { execution } from '@dynatrace-sdk/automation-utils';
import { credentialVaultClient } from '@dynatrace-sdk/client-classic-environment-v2';

export default async function () {
  const ex = await execution();

  const data = await ex.result('host_list');

  const parsed = JSON.parse(data.body);
  const creds = await credentialVaultClient.getCredentialsDetails({
    id: 'CREDENTIALS_VAULT-7936DA7F9F7FBEBF',
  });

  const token = creds.token; 
  const url = "https://xxx.live.dynatrace.com/api/v2/";

  //------functions
  async function hostmodification(url, token, data) {
      const res = await fetch(`${url}settings/objects`, {
        method: "POST",
        headers: {
          "Authorization": `Api-Token ${token}`,
          "Content-Type": "application/json",
          "Accept": "application/json"
        },
        body: data
      });
      if (!res.ok) throw new Error(`Failed apply host modifications: ${res.status}`);
      return await res.json();
  }

   //----------------

  let body = [{"schemaId":"builtin:host.monitoring","schemaVersion":"1.4","scope":"TEST","value":{"enabled":false}}];
  
  for (var i = 0; i &amp;lt; parsed.entities.length; i++) {
    var counter = parsed.entities[i];
    console.log(counter.entityId);

    body = `[{"schemaId":"builtin:host.monitoring","schemaVersion":"1.4","scope":"${counter.entityId}","value":{"enabled":false}}]`
    //console.log(JSON.stringify(body));

    await hostmodification(url, token, body);
    
  }
  
}&lt;/LI-CODE&gt;&lt;P&gt;&lt;STRONG&gt;DISADVANTAGE&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;There is one important disadvantage to this solution.&lt;/P&gt;&lt;P&gt;If a process on a host or a pod in a containerized environment is restarted while the OneAgent is in the "switched off" state, for example, because of process or pod maintenance, you will lose code module injection for that process or pod.&lt;/P&gt;&lt;P&gt;Therefore, you need to make sure that the affected process or pod is restarted after the OneAgent has been switched back on.&lt;/P&gt;&lt;P&gt;For example, if you have a performance test pipeline, you could add a process or pod restart step after the OneAgent has been switched back on.&lt;/P&gt;&lt;P&gt;In these situations, Fleet Management functionality can also help.&lt;/P&gt;&lt;P&gt;I hope this solution is useful for other members also.&lt;/P&gt;&lt;P&gt;Best regards,&lt;BR /&gt;János&lt;/P&gt;</description>
    <pubDate>Thu, 15 Oct 2026 20:00:42 GMT</pubDate>
    <dc:creator>Mizső</dc:creator>
    <dc:date>2026-10-15T20:00:42Z</dc:date>
    <item>
      <title>SaaS migration PART 3 - DPS consumption related issue SaaS vs Managed</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-tips/SaaS-migration-PART-3-DPS-consumption-related-issue-SaaS-vs/m-p/305359#M2188</link>
      <description>&lt;P&gt;Hi Folks,&lt;/P&gt;&lt;P&gt;During a SaaS migration, we had to solve a license consumption-related challenge.&lt;/P&gt;&lt;P&gt;In Managed DPS, we could offer our clients the option to reduce their DEV and UAT license consumption and use the released capacity to cover more IT infrastructure.&lt;/P&gt;&lt;P&gt;There were several options, but we always chose to &lt;STRONG&gt;switch off the environments at the environment level&lt;/STRONG&gt;, instead of, for example, switching off OneAgents on the hosts. It was the simplest solution.&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.dynatrace.com/managed/dynatrace-api/cluster-api/cluster-api-v2/environments/update-specific-managed-environment" target="_blank" rel="noopener"&gt;Update specific environment — Dynatrace Managed Docs&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Example call form the documentation:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;curl -X PUT "https://myManaged.cluster.com/api/cluster/v2/environments/19a963a7-b19f-4382-964a-4df674c8eb8e?createToken=false" -H "accept: application/json; charset=utf-8" -H "Authorization: Api-Token fSRCdB7PQDSdFVANvNfSF" -H "Content-Type: application/json; charset=utf-8" -d "
{\"name\":\"MyNewTeam\",\"id\":\"19a963a7-b19f-4382-964a-4df674c8eb8e\",\"trial\":false,\"state\":\"DISABLED\",\"tags\":[\"owner:john.wicked@dynatrace.com\",\"department:finance\"],\"storage\":{\"userSessionRetention\":{\"maxLimitInDays\":90},\"sessionReplayRetention\":{\"maxLimitInDays\":35}}}&lt;/LI-CODE&gt;&lt;P&gt;For this, we used the documented Cluster API v2 Environments API calls. We created environment disable and environment enable curl requests for each environment and scheduled them using cron jobs.&lt;/P&gt;&lt;P&gt;The schedule looked like this:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Switch off DEV/UAT environments at 20:00 on weekdays.&lt;/LI&gt;&lt;LI&gt;Switch them back on at 06:30 on weekdays.&lt;/LI&gt;&lt;LI&gt;Keep them switched off for the entire weekend.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;This way, many Host Unit / GiB-hours could be freed up and used to monitor other infrastructure entities.&lt;/P&gt;&lt;P&gt;We did not observe any issues with this solution.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ADVANTAGE:&lt;/STRONG&gt; The OneAgent recognizes when the environment/ActiveGate is in an "off" state and stops generating traffic. When the environment/ActiveGate becomes available again, the OneAgent recognizes the "on" state and resumes traffic generation.&lt;/P&gt;&lt;P&gt;Switch off&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Mizs_0-1792092478837.png"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/34434i822AC10139887ECC/image-dimensions/830x63?v=v2" alt="Mizs_0-1792092478837.png" title="Mizs_0-1792092478837.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Switch on&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Mizs_1-1792092516267.png"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/34435iCE4607F17760C394/image-dimensions/838x44?v=v2" alt="Mizs_1-1792092516267.png" title="Mizs_1-1792092516267.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;There is no need to restart processes or pods because the OneAgent remains up and running the whole time, so code module injection remains active.&lt;/P&gt;&lt;P&gt;At the SaaS environment level, however, there is no equivalent API call. But we still had to provide a solution for our clients.&lt;/P&gt;&lt;P&gt;We evaluated several options. The final two candidates were:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Switch off the ActiveGates.&lt;/LI&gt;&lt;LI&gt;Switch off the OneAgents.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;Switching off the ActiveGates&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;We did not experience any problems with "normal" VMs + OneAgent (Linux/Windows) after switching the Linux/Windows ActiveGates off and back on.&lt;/P&gt;&lt;P&gt;However, in Kubernetes environments, we encountered OneAgent injection issues after the containerized ActiveGates "started" again.&lt;/P&gt;&lt;P&gt;Client created solution for "swith on/off" cron jobs of AG: (remove of AG capabilities...)&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: dynakube-scaler
  namespace: dynatrace
rules:
- apiGroups: ["dynatrace.com"]
  resources: ["dynakubes"]
  verbs: ["get", "patch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: dynakube-scaler-binding
  namespace: dynatrace
subjects:
- kind: ServiceAccount
  name: scaler-sa
  namespace: dynatrace
roleRef:
  kind: Role
  name: dynakube-scaler
  apiGroup: rbac.authorization.k8s.io
     
kind: CronJob
apiVersion: batch/v1
metadata:
  name: stop-activegate
  namespace: dynatrace
spec:
  schedule: "0 19 * * *"
  timeZone: Europe/Budapest
  concurrencyPolicy: Forbid
  suspend: false
  jobTemplate:
    spec:
      template:
        spec:
          containers:
            - name: oc
              image: xxx/openshift4/ose-cli
              command:
                - oc
              args:
                - patch
                - dynakube/ocpapgsb
                - -n
                - dynatrace
                - --type=merge
                - -p
                - '{"spec":{"activeGate":{"capabilities":[]}}}'
              resources: {}
              terminationMessagePath: /dev/termination-log
              terminationMessagePolicy: File
              imagePullPolicy: Always
          restartPolicy: Never
          terminationGracePeriodSeconds: 30
          dnsPolicy: ClusterFirst
          serviceAccountName: scaler-sa
          serviceAccount: scaler-sa
          securityContext: {}
          schedulerName: default-scheduler
  successfulJobsHistoryLimit: 3
  failedJobsHistoryLimit: 1
   
kind: CronJob
apiVersion: batch/v1
metadata:
  name: start-activegate
  namespace: dynatrace
spec:
  schedule: "0 18 * * *"
  timeZone: Europe/Budapest
  concurrencyPolicy: Forbid
  suspend: false
  jobTemplate:
    spec:
      template:
        spec:
          containers:
            - name: oc
              image: xxx/openshift4/ose-cli
              command:
                - oc
              args:
                - patch
                - dynakube/ocpapgsb
                - -n
                - dynatrace
                - --type=merge
                - -p
                - '{"spec":{"activeGate":{"capabilities":["routing","kubernetes-monitoring","dynatrace-api"]}}}'
              resources: {}
              terminationMessagePath: /dev/termination-log
              terminationMessagePolicy: File
              imagePullPolicy: Always
          restartPolicy: Never
          terminationGracePeriodSeconds: 30
          dnsPolicy: ClusterFirst
          serviceAccountName: scaler-sa
          serviceAccount: scaler-sa
          securityContext: {}
          schedulerName: default-scheduler
  successfulJobsHistoryLimit: 3
  failedJobsHistoryLimit: 1&lt;/LI-CODE&gt;&lt;P&gt;So, &lt;STRONG&gt;switching off the OneAgents was the winner.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;But how???&lt;/P&gt;&lt;P&gt;Of course, we used the latest Dynatrace Workflow functionality. Once again, we aimed for the simplest possible solution.&lt;/P&gt;&lt;P&gt;We created four workflows:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Switch off OneAgents on the hosts at a scheduled time.&lt;/LI&gt;&lt;LI&gt;Switch on OneAgents on the hosts at a scheduled time.&lt;/LI&gt;&lt;LI&gt;Switch off OneAgents on the hosts on demand, for example, in emergency situations.&lt;/LI&gt;&lt;LI&gt;Switch on OneAgents on the hosts on demand, for example, in emergency situations.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;The workflow itself is very simple.&lt;/P&gt;&lt;P&gt;The first main step collects the host list using an API call. The second main step switches the OneAgents off or on using API calls from a script created with DT Assist.&lt;/P&gt;&lt;P&gt;Here is an example workflow for switch off.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Mizs_2-1792092597154.png"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/34436iD5AB6D4F90894886/image-size/medium?v=v2&amp;amp;px=400" alt="Mizs_2-1792092597154.png" title="Mizs_2-1792092597154.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;First main step&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;host_list is a GET API call using the appropriate API token.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;https://xxx.live.dynatrace.com/api/v2/entities?entitySelector=type%28%22HOST%22%29&amp;amp;from=now-3d &lt;/LI-CODE&gt;&lt;P&gt;now-3d can cause a logical problem. For example, you might switch on hosts that you don't actually want to switch on. You can adjust this time range according to your requirements.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Second main step&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Use the results from host_list in a script and switch the OneAgents on or off on the selected hosts.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;import { execution } from '@dynatrace-sdk/automation-utils';
import { credentialVaultClient } from '@dynatrace-sdk/client-classic-environment-v2';

export default async function () {
  const ex = await execution();

  const data = await ex.result('host_list');

  const parsed = JSON.parse(data.body);
  const creds = await credentialVaultClient.getCredentialsDetails({
    id: 'CREDENTIALS_VAULT-7936DA7F9F7FBEBF',
  });

  const token = creds.token; 
  const url = "https://xxx.live.dynatrace.com/api/v2/";

  //------functions
  async function hostmodification(url, token, data) {
      const res = await fetch(`${url}settings/objects`, {
        method: "POST",
        headers: {
          "Authorization": `Api-Token ${token}`,
          "Content-Type": "application/json",
          "Accept": "application/json"
        },
        body: data
      });
      if (!res.ok) throw new Error(`Failed apply host modifications: ${res.status}`);
      return await res.json();
  }

   //----------------

  let body = [{"schemaId":"builtin:host.monitoring","schemaVersion":"1.4","scope":"TEST","value":{"enabled":false}}];
  
  for (var i = 0; i &amp;lt; parsed.entities.length; i++) {
    var counter = parsed.entities[i];
    console.log(counter.entityId);

    body = `[{"schemaId":"builtin:host.monitoring","schemaVersion":"1.4","scope":"${counter.entityId}","value":{"enabled":false}}]`
    //console.log(JSON.stringify(body));

    await hostmodification(url, token, body);
    
  }
  
}&lt;/LI-CODE&gt;&lt;P&gt;&lt;STRONG&gt;DISADVANTAGE&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;There is one important disadvantage to this solution.&lt;/P&gt;&lt;P&gt;If a process on a host or a pod in a containerized environment is restarted while the OneAgent is in the "switched off" state, for example, because of process or pod maintenance, you will lose code module injection for that process or pod.&lt;/P&gt;&lt;P&gt;Therefore, you need to make sure that the affected process or pod is restarted after the OneAgent has been switched back on.&lt;/P&gt;&lt;P&gt;For example, if you have a performance test pipeline, you could add a process or pod restart step after the OneAgent has been switched back on.&lt;/P&gt;&lt;P&gt;In these situations, Fleet Management functionality can also help.&lt;/P&gt;&lt;P&gt;I hope this solution is useful for other members also.&lt;/P&gt;&lt;P&gt;Best regards,&lt;BR /&gt;János&lt;/P&gt;</description>
      <pubDate>Thu, 15 Oct 2026 20:00:42 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-tips/SaaS-migration-PART-3-DPS-consumption-related-issue-SaaS-vs/m-p/305359#M2188</guid>
      <dc:creator>Mizső</dc:creator>
      <dc:date>2026-10-15T20:00:42Z</dc:date>
    </item>
  </channel>
</rss>

