# OneAgent: remove previous versions

**URL:** <https://community.dynatrace.com/t/oneagent-remove-previous-versions/20981>\
**Category:** Open Q&A\
**Tags:** updates, oneagent\
**Created:** [December 3, 2020, 3:55pm UTC](https://community.dynatrace.com/t/oneagent-remove-previous-versions/20981 "2020-12-03T15:55:25Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![yuryk](https://avatars.discourse-cdn.com/v4/letter/y/ee7513/32.png) [@yuryk](https://community.dynatrace.com/u/yuryk)\
**Post date:** [December 3, 2020, 3:55pm UTC](https://community.dynatrace.com/t/oneagent-remove-previous-versions/20981/1 "2020-12-03T15:55:25Z")

</div>

We have the oneagent installed with the autoupdate enabled. Just found that the oneagent keeps all previous versions for ever. Are there any solution, key, flag that could help to avoid a such behavior and remove them automatically after the update is finished

---

<div class="post-metadata">

**Author:** ![JamesKitson](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/jameskitson/32/22460_2.png) [@JamesKitson](https://community.dynatrace.com/u/JamesKitson)\
**Post date:** [December 3, 2020, 4:17pm UTC](https://community.dynatrace.com/t/oneagent-remove-previous-versions/20981/2 "2020-12-03T16:17:25Z")

</div>

Where exactly are you seeing that? If we kept every version on the monitored hosts everyone would quickly be running out of space.

> **[OneAgent file aging mechanism](https://docs.dynatrace.com/docs/ingest-from/dynatrace-oneagent/oneagent-aging-mechanism)**
>
> Learn how OneAgent deletes old files to minimize disk space usage.

Do you mean on the Managed cluster side?

---

<div class="post-metadata">

**Author:** ![yuryk](https://avatars.discourse-cdn.com/v4/letter/y/ee7513/32.png) [@yuryk](https://community.dynatrace.com/u/yuryk)\
**Post date:** [December 3, 2020, 4:24pm UTC](https://community.dynatrace.com/t/oneagent-remove-previous-versions/20981/3 "2020-12-03T16:24:05Z")

</div>

In the AWS EC2 instances, that we use

For instance:

```auto
[root]# ls -lah /opt/dynatrace/oneagent/agent/bin/<br>drwxr-xr-x. 6 root user 82 Jun  3  2020 1.193.159.20200602-190835<br>drwxr-xr-x. 6 root user 82 Jun 30 23:10 1.195.139.20200701-001924<br>drwxr-xr-x. 6 root user 82 Jul  7 15:31 1.195.148.20200707-160955<br>drwxr-xr-x. 6 root user 82 Jul 20 14:55 1.195.161.20200720-160625<br>drwxr-xr-x. 6 root user 82 Jul 23 13:27 1.197.134.20200723-143315<br>drwxr-xr-x. 6 root user 82 Aug 21 15:42 1.199.101.20200821-165422<br>lrwxrwxrwx. 1 root root   25 Aug 26 08:17 current -> 1.199.101.20200821-165422

```

---

<div class="post-metadata">

**Author:** ![JamesKitson](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/jameskitson/32/22460_2.png) [@JamesKitson](https://community.dynatrace.com/u/JamesKitson)\
**Post date:** [December 3, 2020, 8:56pm UTC](https://community.dynatrace.com/t/oneagent-remove-previous-versions/20981/4 "2020-12-03T20:56:35Z")

</div>

So what is in those directories is described here:

> **[OneAgent file aging mechanism](https://docs.dynatrace.com/docs/ingest-from/dynatrace-oneagent/oneagent-aging-mechanism)**
>
> Learn how OneAgent deletes old files to minimize disk space usage.

It is not the full agent just some of the small pieces that are used for injection into processes. The only item of note in their is under the ‘any’ subdirectory of each of the versions. It shows we keep the 10 most recent (plus the current) versions of that so it is not forever.

I’ll update if I find any way to control this behavior but at this time I don’t think that is possible.

---

<div class="post-metadata">

**Author:** ![yuryk](https://avatars.discourse-cdn.com/v4/letter/y/ee7513/32.png) [@yuryk](https://community.dynatrace.com/u/yuryk)\
**Post date:** [December 4, 2020, 5:58am UTC](https://community.dynatrace.com/t/oneagent-remove-previous-versions/20981/5 "2020-12-04T05:58:16Z")

</div>

Hi James, not sure that’s correct

```auto
du -sh /opt/dynatrace/oneagent/agent/bin/<br>4.1G    /opt/dynatrace/oneagent/agent/bin/

```

And moreover, there were much many versions, but I just deleted them

```auto
drwxr-xr-x. 3 root user 17 Mar 18  2019 1.163.277.20190318-125829<br>drwxr-xr-x. 3 root user 17 Apr  2  2019 1.165.211.20190402-143336<br>drwxr-xr-x. 3 root user 17 Apr  8  2019 1.165.227.20190408-130003<br>drwxr-xr-x. 3 root user 17 Apr 17  2019 1.165.238.20190417-081639<br>drwxr-xr-x. 3 root user 17 May  2  2019 1.167.159.20190502-150150<br>drwxr-xr-x. 3 root user 17 May  8  2019 1.167.176.20190508-104947<br>drwxr-xr-x. 3 root user 17 May 29  2019 1.169.172.20190529-101847<br>drwxr-xr-x. 3 root user 17 Jun 25  2019 1.171.180.20190625-172111<br>drwxr-xr-x. 3 root user 17 Jul 19  2019 1.171.252.20190719-134816<br>drwxr-xr-x. 3 root user 17 Aug  2  2019 1.173.295.20190802-111637<br>drwxr-xr-x. 3 root user 17 Aug  9  2019 1.173.314.20190809-152259<br>drwxr-xr-x. 3 root user 17 Aug 26  2019 1.173.358.20190826-182424<br>drwxr-xr-x. 3 root user 17 Sep 10  2019 1.175.240.20190910-170422<br>drwxr-xr-x. 3 root user 17 Sep 20  2019 1.175.270.20190920-173335<br>drwxr-xr-x. 3 root user 17 Oct 10  2019 1.177.204.20191010-030448<br>drwxr-xr-x. 3 root user 17 Oct 11  2019 1.177.216.20191011-134546<br>drwxr-xr-x. 3 root user 17 Nov  6  2019 1.179.177.20191106-102431<br>drwxr-xr-x. 3 root user 17 Nov 13  2019 1.179.187.20191113-095744<br>drwxr-xr-x. 3 root user 17 Dec 11  2019 1.181.154.20191211-083443<br>drwxr-xr-x. 6 root user 82 Apr 23 09:12 1.189.205.20200423-102214<br>drwxr-xr-x. 6 root user 82 May 14 09:35 1.191.217.20200514-103405<br>drwxr-xr-x. 6 root user 82 May 26 13:44 1.191.239.20200526-145639<br>drwxr-xr-x. 6 root user 82 Jun  3 07:30 1.193.159.20200602-190835<br>drwxr-xr-x. 6 root user 82 Jun 30 23:10 1.195.139.20200701-001924<br>drwxr-xr-x. 6 root user 82 Jul  7 15:31 1.195.148.20200707-160955<br>drwxr-xr-x. 6 root user 82 Jul 20 14:55 1.195.161.20200720-160625<br>drwxr-xr-x. 6 root user 82 Jul 23 13:27 1.197.134.20200723-143315<br>drwxr-xr-x. 6 root user 82 Aug 21 15:42 1.199.101.20200821-165422<br>lrwxrwxrwx. 1 root root   25 Aug 26 08:17 current -> 1.199.101.20200821-165422

```

---

<div class="post-metadata">

**Author:** ![JamesKitson](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/jameskitson/32/22460_2.png) [@JamesKitson](https://community.dynatrace.com/u/JamesKitson)\
**Post date:** [December 4, 2020, 2:56pm UTC](https://community.dynatrace.com/t/oneagent-remove-previous-versions/20981/6 "2020-12-04T14:56:24Z")

</div>

After checking internally, it seems this behavior is most often attributed to monitoring being deactivated on the host in which case the aging operations do not occur.

If you do have monitoring active on this host (or others) and still see this a support case would be best so they can take a closer look at what is happening.

---

<div class="post-metadata">

**Author:** ![Tomasz\_Gajger](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/tomasz_gajger/32/11712_2.png) [@Tomasz\_Gajger](https://community.dynatrace.com/u/Tomasz_Gajger)\
**Post date:** [December 14, 2020, 6:40am UTC](https://community.dynatrace.com/t/oneagent-remove-previous-versions/20981/7 "2020-12-14T06:40:41Z")

</div>

Hi, the problem you’re experiencing is being tracked in the following product idea: [https://community.dynatrace.com/idea/243195/oneagent-update-cleanup.html](https://community.dynatrace.com/idea/243195/oneagent-update-cleanup.html)

You will also find the explanation of the behavior there - as James mentioned, it’s caused by agent being deactivated and having auto-updates enabled at the same time.

---

<div class="post-metadata">

**Author:** ![yuryk](https://avatars.discourse-cdn.com/v4/letter/y/ee7513/32.png) [@yuryk](https://community.dynatrace.com/u/yuryk)\
**Post date:** [December 14, 2020, 7:07am UTC](https://community.dynatrace.com/t/oneagent-remove-previous-versions/20981/8 "2020-12-14T07:07:38Z")

</div>

Could you clarify please, what it means enabled?  
If I can see my machine in the DT dashboard?  
and if I can see that process on my machine?

```auto
ps -ef | grep dynatracroot     18076     1  0 Aug26 ?        00:35:47 /opt/dynatrace/oneagent/agent/lib64/oneagentwatchdog -bg -config=/opt/dynatrace/oneagent/agent/conf/watchdog.conf

```

If that’s right, I don’t see any difference between machines that are added into the monitoring pool and don’t.

all of them have kept all the versions since the first installation

---

<div class="post-metadata">

**Author:** ![Tomasz\_Gajger](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/tomasz_gajger/32/11712_2.png) [@Tomasz\_Gajger](https://community.dynatrace.com/u/Tomasz_Gajger)\
**Post date:** [December 14, 2020, 7:29am UTC](https://community.dynatrace.com/t/oneagent-remove-previous-versions/20981/9 "2020-12-14T07:29:49Z")

</div>

“enabled” pertains to whether the monitoring of the host is enabled or not, in the Web UI: “Host settings \> General \> Monitor this host”

OneAgent processes will be running regardless if monitoring is enabled or not.

---

<div class="post-metadata">

**Author:** ![ThatiSrikanth](https://avatars.discourse-cdn.com/v4/letter/t/6de8d8/32.png) [@ThatiSrikanth](https://community.dynatrace.com/u/ThatiSrikanth)\
**Post date:** [December 28, 2021, 4:34am UTC](https://community.dynatrace.com/t/oneagent-remove-previous-versions/20981/10 "2021-12-28T04:34:53Z")

</div>

Is your issue solved?  
i am curious know if so what the solution they have provided to clean up the old oneagent softwares which is lying on the instances
