# Dynatrace hourly license: auto-stop agent monitoring during non-business hours

**URL:** <https://community.dynatrace.com/t/dynatrace-hourly-license-auto-stop-agent-monitoring-during-non-business-hours/38810>\
**Category:** Dynatrace Managed\
**Tags:** dynatrace-managed, hosts-classic, licensing\
**Created:** [March 14, 2023, 3:13am UTC](https://community.dynatrace.com/t/dynatrace-hourly-license-auto-stop-agent-monitoring-during-non-business-hours/38810 "2023-03-14T03:13:50Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![RazTN7](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/raztn7/32/10208_2.png) [@RazTN7](https://community.dynatrace.com/u/RazTN7)\
**Post date:** [March 14, 2023, 3:13am UTC](https://community.dynatrace.com/t/dynatrace-hourly-license-auto-stop-agent-monitoring-during-non-business-hours/38810/1 "2023-03-14T03:13:50Z")

</div>

Hello Team,

Customer is using DT hourly license. Where we wanted to stop Dynatrace agent monitoring during non-business hour as the nature of the application don’t have customer landing during non-business hours (between 7pm to 8am)

Customer is expecting this feature to be included within Dynatrace as it is providing the flexi with hourly license consumption.

Just wanted to know what the other options are to handle this request.

Cheers!

R

---

<div class="post-metadata">

**Author:** ![Julius\_Loman](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/julius_loman/32/51_2.png) [@Julius\_Loman](https://community.dynatrace.com/u/Julius_Loman)\
**Post date:** [March 14, 2023, 7:30am UTC](https://community.dynatrace.com/t/dynatrace-hourly-license-auto-stop-agent-monitoring-during-non-business-hours/38810/2 "2023-03-14T07:30:35Z")

</div>

The easiest way is to utilize the [Settings API](https://www.dynatrace.com/support/help/dynatrace-api/environment-api/settings) with the schema&nbsp;builtin:host.monitoring to enable and disable the hosts as required. You need to disable them individually (one call per host). However you will need to keep in mind if some processes have been restarted on the hosts while OneAgent was disabled, then they need to be restarted again after monitoring was enabled back to get the code modules injected.

We’ve developed&nbsp;an automation tool to handle such situations for our customers (managing agents per hostgroup or tag, getting license utilization and getting the list of processes to be restarted).

---

<div class="post-metadata">

**Author:** ![mizso74](https://avatars.discourse-cdn.com/v4/letter/m/f05b48/32.png) [@mizso74](https://community.dynatrace.com/u/mizso74)\
**Post date:** [March 14, 2023, 7:54am UTC](https://community.dynatrace.com/t/dynatrace-hourly-license-auto-stop-agent-monitoring-during-non-business-hours/38810/3 "2023-03-14T07:54:31Z")

</div>

Hi&nbsp;[@Julius\_Loman](https://community.dynatrace.com/user/3364)&nbsp;,

Nice tool…:dynaspin:

Best regads,

Mizső

---

<div class="post-metadata">

**Author:** ![Julius\_Loman](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/julius_loman/32/51_2.png) [@Julius\_Loman](https://community.dynatrace.com/u/Julius_Loman)\
**Post date:** [March 14, 2023, 9:53am UTC](https://community.dynatrace.com/t/dynatrace-hourly-license-auto-stop-agent-monitoring-during-non-business-hours/38810/4 "2023-03-14T09:53:12Z")

</div>

[@Mizső](https://community.dynatrace.com/user/47783)&nbsp;thanks - the power comes when combined with automatic disabling of new OneAgent installations. Then you can safely roll out OneAgents across the environment and enable them afterwards where required.

It saves a huge amount of manual work in the UI.

---

<div class="post-metadata">

**Author:** ![RazTN7](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/raztn7/32/10208_2.png) [@RazTN7](https://community.dynatrace.com/u/RazTN7)\
**Post date:** [March 15, 2023, 3:26am UTC](https://community.dynatrace.com/t/dynatrace-hourly-license-auto-stop-agent-monitoring-during-non-business-hours/38810/5 "2023-03-15T03:26:16Z")

</div>

Thank you&nbsp;[@Julius\_Loman](https://community.dynatrace.com/user/3364). Can this tool be available in Dynatrace Hub/gitHub someday.

---

<div class="post-metadata">

**Author:** ![theharithsa](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/theharithsa/32/16236_2.png) [@theharithsa](https://community.dynatrace.com/u/theharithsa)\
**Post date:** [March 21, 2024, 5:15am UTC](https://community.dynatrace.com/t/dynatrace-hourly-license-auto-stop-agent-monitoring-during-non-business-hours/38810/6 "2024-03-21T05:15:28Z")

</div>

This is already there in our Official GitHub repository.&nbsp;  
[https://github.com/Dynatrace/auto-update-manager](https://github.com/Dynatrace/auto-update-manager)

This will help you in configuring settings 2.0 APIs.

---

<div class="post-metadata">

**Author:** ![cesarsaravia](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/cesarsaravia/32/12818_2.png) [@cesarsaravia](https://community.dynatrace.com/u/cesarsaravia)\
**Post date:** [March 21, 2024, 2:25pm UTC](https://community.dynatrace.com/t/dynatrace-hourly-license-auto-stop-agent-monitoring-during-non-business-hours/38810/7 "2024-03-21T14:25:50Z")

</div>

Hi [@RazTN7](https://community.dynatrace.com/user/4525)&nbsp;  
Another option or workaround is creating a workflow with the desired rules, and you can execute on-demand or on a fixed timeframe.  
Example:

 ![cesarsaravia_0-1711030893184.png](https://global.discourse-cdn.com/dynatrace/original/2X/2/2bbb9cbb4fae749718bfe09614ed043b4ba4d1b2.png)

And remember what&nbsp;[@Julius\_Loman](https://community.dynatrace.com/user/3364)&nbsp;mentions, if a process has been restarted on those non-business hours, you should restart the processes after the OneAgent it’s initiated. In that case you should add a task on your workflow and connect with an automation tool like ansible or terraform to make the restart of the processes.

Regards,

---

<div class="post-metadata">

**Author:** ![MarwanC](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/marwanc/32/34480_2.png) [@MarwanC](https://community.dynatrace.com/u/MarwanC)\
**Post date:** [July 15, 2025, 12:45pm UTC](https://community.dynatrace.com/t/dynatrace-hourly-license-auto-stop-agent-monitoring-during-non-business-hours/38810/8 "2025-07-15T12:45:39Z")

</div>

[cesarsaravia](https://community.dynatrace.com/user/30478), thank for you sharing the workflow, would you be kind to share some more info on the details of each box in your workflow, some screenshots is much appreciated.

---

<div class="post-metadata">

**Author:** ![Hillman](https://avatars.discourse-cdn.com/v4/letter/h/439d5e/32.png) [@Hillman](https://community.dynatrace.com/u/Hillman)\
**Post date:** [November 7, 2025, 9:33am UTC](https://community.dynatrace.com/t/dynatrace-hourly-license-auto-stop-agent-monitoring-during-non-business-hours/38810/9 "2025-11-07T09:33:33Z")

</div>

[@cesarsaravia](https://community.dynatrace.com/user/30478)&nbsp;That sounds a good idea! Do you have the sample DQL that get the list of hosts and the scripts / commands to disable OneAgent? Is it feasible on Kubernetes one as well?

---

<div class="post-metadata">

**Author:** ![Julius\_Loman](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/julius_loman/32/51_2.png) [@Julius\_Loman](https://community.dynatrace.com/u/Julius_Loman)\
**Post date:** [November 7, 2025, 10:07am UTC](https://community.dynatrace.com/t/dynatrace-hourly-license-auto-stop-agent-monitoring-during-non-business-hours/38810/10 "2025-11-07T10:07:40Z")

</div>

I use something like this in my workflows - when disabling by host groups (sort is not necessary of course)

```markup
fetch dt.entity.host, from: -7d
| fieldsAdd hostGroupName
| filter in(hostGroupName, array("test.host_group1","preprod.host_group1"))
| sort entity.name

```

It works also for kubernetes, but it might depend on your deployment type (applicationOnly vs cloudNativeFullStack)
