<?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 Re: 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/305367#M2191</link>
    <description>&lt;P&gt;Thank you both for sharing those ideas!!&amp;nbsp;&lt;img class="lia-deferred-image lia-image-emoji" src="https://community.dynatrace.com/html/@0619AF12A3F7F3806F31A2EB83AC4DDA/images/emoticons/cool_doge.gif" alt=":cool_doge:" title=":cool_doge:" /&gt;&lt;img class="lia-deferred-image lia-image-emoji" src="https://community.dynatrace.com/html/@9BD876A77FEF3D5EF4BC972CF8A97CB1/images/emoticons/take_my_money.png" alt=":take_my_money:" title=":take_my_money:" /&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 16 Oct 2026 08:18:49 GMT</pubDate>
    <dc:creator>AntonPineiro</dc:creator>
    <dc:date>2026-10-16T08:18:49Z</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>
    <item>
      <title>Re: 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/305365#M2189</link>
      <description>&lt;P&gt;Great write-up&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/47783"&gt;@Mizső&lt;/a&gt;&amp;nbsp;, I have developed a similar, more advanced solution for SaaS using workflows that helps eliminate the restart issues to a significant degree. It is also connected to deployment events from the CI/CD pipelines, sending SDLC events on deployments. So, for example, if part of the environment has to be shut down, deployments enable Dynatrace during deployment and turn it off after deployment is finished. This ensures that the Dynatrace OneAgents are enabled during restarts. This, of course, does not resolve situations of manual restarts of processes when OneAgent is disabled.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;I have a common workflow for disabling / enabling part of the environment. Groups (scopes) are defined in lookup tables so we can define multiple parts (dev / test / preprod / uat) independently, currently by host groups and k8s clusters. It takes a few arguments on input:&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;enabled&lt;/STRONG&gt; (boolean) - if the workflow should enable or disable&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;group&lt;/STRONG&gt; (string) - name of the group to manage&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;trigger&lt;/STRONG&gt; (string) - trigger type&lt;UL&gt;&lt;LI&gt;"manual" - for manual enable/disable (triggers always)&lt;/LI&gt;&lt;LI&gt;"schedule" - for scheduled enable/disable (does not disable if deployment is running)&lt;/LI&gt;&lt;LI&gt;"deployment" - for enable/disable before/after deployment (does not disable after deployment is during business hours)&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;check_restarts&lt;/STRONG&gt; (boolean) - check for restarts&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;send_restart_events&lt;/STRONG&gt; (boolean) - if CUSTOM_ALERT events need to be send&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;Workflow does multiple tasks&lt;OL&gt;&lt;LI&gt;Gets host groups to disable from Grail lookup tables&lt;/LI&gt;&lt;LI&gt;Gets host to be disabled from these groups&lt;/LI&gt;&lt;LI&gt;Gets k8s clusters for the groups (disable Kubernetes API ingest)&lt;/LI&gt;&lt;LI&gt;Check if deployment is running (do not disable hosts if deployment is running, another workflow run will disable the environment after deployment finishes)&lt;/LI&gt;&lt;LI&gt;Disable or enable hosts if conditions match&lt;/LI&gt;&lt;LI&gt;Check for processes needed to be restarted and raise custom alerts for these processes - depending on the argument.&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Julius_Loman_0-1792130656645.png"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/34437i0E7520D1B8BEDA66/image-size/medium?v=v2&amp;amp;px=400" alt="Julius_Loman_0-1792130656645.png" title="Julius_Loman_0-1792130656645.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;This workflow is triggered by several other workflows using the API (not a call other workflow type) to optimise workflow cost (otherwise there would be 7 full workflows instead of one):&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Julius_Loman_1-1792131082439.png"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/34438iB28CBD14E97A0412/image-size/medium?v=v2&amp;amp;px=400" alt="Julius_Loman_1-1792131082439.png" title="Julius_Loman_1-1792131082439.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Oct 2026 07:48:55 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-tips/SaaS-migration-PART-3-DPS-consumption-related-issue-SaaS-vs/m-p/305365#M2189</guid>
      <dc:creator>Julius_Loman</dc:creator>
      <dc:date>2026-10-16T07:48:55Z</dc:date>
    </item>
    <item>
      <title>Re: 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/305366#M2190</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/3364"&gt;@Julius_Loman&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Great solution! Thanks for sharing it!&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;János&lt;/P&gt;</description>
      <pubDate>Fri, 16 Oct 2026 12:06:31 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-tips/SaaS-migration-PART-3-DPS-consumption-related-issue-SaaS-vs/m-p/305366#M2190</guid>
      <dc:creator>Mizső</dc:creator>
      <dc:date>2026-10-16T12:06:31Z</dc:date>
    </item>
    <item>
      <title>Re: 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/305367#M2191</link>
      <description>&lt;P&gt;Thank you both for sharing those ideas!!&amp;nbsp;&lt;img class="lia-deferred-image lia-image-emoji" src="https://community.dynatrace.com/html/@0619AF12A3F7F3806F31A2EB83AC4DDA/images/emoticons/cool_doge.gif" alt=":cool_doge:" title=":cool_doge:" /&gt;&lt;img class="lia-deferred-image lia-image-emoji" src="https://community.dynatrace.com/html/@9BD876A77FEF3D5EF4BC972CF8A97CB1/images/emoticons/take_my_money.png" alt=":take_my_money:" title=":take_my_money:" /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Oct 2026 08:18:49 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-tips/SaaS-migration-PART-3-DPS-consumption-related-issue-SaaS-vs/m-p/305367#M2191</guid>
      <dc:creator>AntonPineiro</dc:creator>
      <dc:date>2026-10-16T08:18:49Z</dc:date>
    </item>
  </channel>
</rss>

