# Is there a way to gracefully shut down an ActiveGate?

**URL:** <https://community.dynatrace.com/t/is-there-a-way-to-gracefully-shut-down-an-activegate/21169>\
**Category:** Open Q&A\
**Tags:** activegate\
**Created:** [June 27, 2019, 6:52pm UTC](https://community.dynatrace.com/t/is-there-a-way-to-gracefully-shut-down-an-activegate/21169 "2019-06-27T18:52:48Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![ian\_cervantez1](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/ian_cervantez1/32/31585_2.png) [@ian\_cervantez1](https://community.dynatrace.com/u/ian_cervantez1)\
**Post date:** [June 27, 2019, 6:52pm UTC](https://community.dynatrace.com/t/is-there-a-way-to-gracefully-shut-down-an-activegate/21169/1 "2019-06-27T18:52:48Z")

</div>

Based on the documentation here:

> **[Start/stop/restart ActiveGate](https://docs.dynatrace.com/docs/ingest-from/dynatrace-activegate/operation/stop-restart-activegate)**
>
> Learn how you can start, stop and restart ActiveGate on Windows or Linux.

When shutting down an ActiveGate (to apply an update, or to remove it and add a new one in its place), the only mechanism is to stop the service. This bothers me, since it isn’t a graceful shut down but rather an abrupt stop on the process. The ActiveGate may be in the middle of a synthetic test when the shutdown happens. Or, it may have collected OneAgent metrics and hasn’t sent the metrics along to Dynatrace yet.

Is there a way to safely drain traffic from the ActiveGate prior to shut down? Leave the ActiveGate online, but stop it from collecting _ **new** _ metrics from OneAgents and discontinue running synthetic monitoring tests?

More importantly, once the traffic has drained properly, can I automatically trigger the stop on the ActiveGate?

---

<div class="post-metadata">

**Author:** ![ctturner](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/ctturner/32/11883_2.png) [@ctturner](https://community.dynatrace.com/u/ctturner)\
**Post date:** [June 27, 2019, 7:17pm UTC](https://community.dynatrace.com/t/is-there-a-way-to-gracefully-shut-down-an-activegate/21169/2 "2019-06-27T19:17:29Z")

</div>

Based on my experience from running updates automatically and manually, We use the stop command as it starts to shutdown the services and isn’t a true abrupt stop which can be used if you call for a ‘force stop’ The OneAgents will retain the metrics for about 60 minutes until the activegate comes back online after the update. When it comes to the synthetics as we make them use dedicated activegates, and when we update it essentially puts the test on a hold. Our Synthetics run every 30 minutes and when I perform a long maintenance on the activegate for synthetics we don’t get alerted that synthetics failed because I used the stop command and it gracefully shutdown the service.

---

<div class="post-metadata">

**Author:** ![ctturner](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/ctturner/32/11883_2.png) [@ctturner](https://community.dynatrace.com/u/ctturner)\
**Post date:** [June 27, 2019, 7:21pm UTC](https://community.dynatrace.com/t/is-there-a-way-to-gracefully-shut-down-an-activegate/21169/3 "2019-06-27T19:21:40Z")

</div>

From the CMC side you can also select to disable or restart the activegate from the CMC console. This will start that shutdown procedure and not do an abrupt stop. The only difference between the two options is that one will turn the services back on, just like restarting your computer, it safely closes everything, then turns it all back on.

---

<div class="post-metadata">

**Author:** ![ian\_cervantez1](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/ian_cervantez1/32/31585_2.png) [@ian\_cervantez1](https://community.dynatrace.com/u/ian_cervantez1)\
**Post date:** [June 27, 2019, 7:52pm UTC](https://community.dynatrace.com/t/is-there-a-way-to-gracefully-shut-down-an-activegate/21169/4 "2019-06-27T19:52:17Z")

</div>

That’s great news about the OneAgents holding metrics for 60 minutes. I’ve got a multi-activegate setup, so if the OneAgents find a different ActiveGate that’s online to send metrics to - it’ll use the new one automagically right?

As for the Synthetics, I’m not worried about getting alerts for failure to run. I’ll have new ActiveGates online to replace the old ActiveGates I’m shutting down. I’m worried about gaps in the synthetic coverage caused by shutting down an ActiveGate in the middle of a synthetic test. If the currently running synthetic test is allowed to finish before stop kills the ActiveGate, then I’m all set. Let’s walk through a scenario:

1. A particularly long synthetic test with click paths may take 5-10 minutes to perform.
2. Start this long synthetic test.
3. 2 minutes into the synthetic test, the stop command is sent to the service.

Does the service respect the running synthetic test and wait the remaining 3-8 minutes before shutting down the service?

---

<div class="post-metadata">

**Author:** ![skrystosik](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/skrystosik/32/21133_2.png) [@skrystosik](https://community.dynatrace.com/u/skrystosik)\
**Post date:** [June 28, 2019, 6:57am UTC](https://community.dynatrace.com/t/is-there-a-way-to-gracefully-shut-down-an-activegate/21169/5 "2019-06-28T06:57:23Z")

</div>

Agents are holding metrics little bit shorter that you’ve said. It also depends of amount of traffic on particular host 🙂

---

<div class="post-metadata">

**Author:** ![ctturner](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/ctturner/32/11883_2.png) [@ctturner](https://community.dynatrace.com/u/ctturner)\
**Post date:** [June 28, 2019, 2:24pm UTC](https://community.dynatrace.com/t/is-there-a-way-to-gracefully-shut-down-an-activegate/21169/6 "2019-06-28T14:24:33Z")

</div>

After running a few tests I can confirm that the stop command will end any active synthetics tests.

---

<div class="post-metadata">

**Author:** ![ian\_cervantez1](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/ian_cervantez1/32/31585_2.png) [@ian\_cervantez1](https://community.dynatrace.com/u/ian_cervantez1)\
**Post date:** [June 28, 2019, 3:57pm UTC](https://community.dynatrace.com/t/is-there-a-way-to-gracefully-shut-down-an-activegate/21169/7 "2019-06-28T15:57:28Z")

</div>

Oh, bummer. 😞

---

<div class="post-metadata">

**Author:** ![ian\_cervantez1](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/ian_cervantez1/32/31585_2.png) [@ian\_cervantez1](https://community.dynatrace.com/u/ian_cervantez1)\
**Post date:** [June 28, 2019, 3:58pm UTC](https://community.dynatrace.com/t/is-there-a-way-to-gracefully-shut-down-an-activegate/21169/8 "2019-06-28T15:58:21Z")

</div>

Do you know how much “a little bit shorter” is? Are we talking, like, holding metrics for 30 minutes? Or is it substantially shorter like 1 minute?

---

<div class="post-metadata">

**Author:** ![ian\_cervantez1](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/ian_cervantez1/32/31585_2.png) [@ian\_cervantez1](https://community.dynatrace.com/u/ian_cervantez1)\
**Post date:** [June 28, 2019, 5:18pm UTC](https://community.dynatrace.com/t/is-there-a-way-to-gracefully-shut-down-an-activegate/21169/9 "2019-06-28T17:18:46Z")

</div>

I’ve submitted a product idea for this:

> **[Login | Dynatrace](https://sso.dynatrace.com/action/signin?goto=https%3A%2F%2Fsso.dynatrace.com%3A443%2Foauth2%2Fauthorize%2Fredirect%3FoAuth2CtxUuid%3Dd5363b62-4834-4bd9-8349-78a758af5739&oAuth2RedirectUri=https%3A%2F%2Fcommunity.dynatrace.com%2Fauth%2Foauth2callback)**

---

<div class="post-metadata">

**Author:** ![MaciejNeumann](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@MaciejNeumann](https://community.dynatrace.com/u/MaciejNeumann)\
**Post date:** [December 14, 2021, 1:15pm UTC](https://community.dynatrace.com/t/is-there-a-way-to-gracefully-shut-down-an-activegate/21169/10 "2021-12-14T13:15:21Z")

</div>

Comment from Synthetic Monitoring Product Manager:

"Active gate shutdown caused by update requests is graceful from executing synthetic tests point of view. There is timeout (now 5 minutes, will be increased to 7,5 minutes in 192) which is longer than the longest timeout for executing single test (Browser clickpath, 5 minutes). The procedure uses this timeout to wait for all currently executed tests to be finished. Such approach assures, that all tests which are executed when upgrade requests appears, will be finished. What you can observer is only slight delay in starting next tests caused by timeout and upgrade time

Please, notice, that it is internal upgrade procedure which doesn’t cover scenario of manual restart of machine on which Active Gates is running. In such case we have to base on standard system timeouts, which might be shorter."
