# Set query method checks other than 1 minute

**URL:** <https://community.dynatrace.com/t/set-query-method-checks-other-than-1-minute/35106>\
**Category:** Extensions\
**Tags:** settings, extensions\
**Created:** [May 11, 2022, 4:01am UTC](https://community.dynatrace.com/t/set-query-method-checks-other-than-1-minute/35106 "2022-05-11T04:01:27Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ardhi](https://avatars.discourse-cdn.com/v4/letter/a/e99b99/32.png) [@Ardhi](https://community.dynatrace.com/u/Ardhi)\
**Post date:** [May 11, 2022, 4:01am UTC](https://community.dynatrace.com/t/set-query-method-checks-other-than-1-minute/35106/1 "2022-05-11T04:01:27Z")

</div>

Hi,

Based on this [documentation](https://www.dynatrace.com/support/help/extend-dynatrace/extensions/activegate-extensions/write-your-first-activegate-plugin), I found out the query method is checked every minute.

But is there a way we can change this to arbitrary values like 1 hour or 1 day?

So far I did the checking function,

```markup
def query(self, **kwargs):
        logger.info(f"Config: {self.username} {self.config_folder}, {self.retention_days}, {self.device_type}")
        logger.info(f"{datetime.now()} ActiveGate Backup Plugin")
        if self.poll_count < self.polling_interval:
            self.poll_count += 1
            logger.info(f"... only polling every {self.polling_interval} minutes. Skipping this minute.")
        else:
            logger.info(f"your time has come: {datetime.now()}")
            self.poll_count = 1

```

But without luck, not even every minute

 ![Screen Shot 2022-05-11 at 10.15.22.png](https://global.discourse-cdn.com/dynatrace/original/3X/c/a/cabb3601f5fcfc03c61815612212212b6863e559.png)

the query only works when the “Update” button is pressed on the extension page.

Is there any additional setting or a way around this?

Thank you.

Regards,

Ardhi

---

<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:** [May 11, 2022, 6:17am UTC](https://community.dynatrace.com/t/set-query-method-checks-other-than-1-minute/35106/2 "2022-05-11T06:17:33Z")

</div>

You need to do that in your code. The query method gets executed every minute, however if the previous run did not finish, the extension engine won’t trigger another query method call. If you need to execute it in a different interval, just implement a simple counter in your extension and immediately exit the query method.

---

<div class="post-metadata">

**Author:** ![Ardhi](https://avatars.discourse-cdn.com/v4/letter/a/e99b99/32.png) [@Ardhi](https://community.dynatrace.com/u/Ardhi)\
**Post date:** [May 12, 2022, 3:18am UTC](https://community.dynatrace.com/t/set-query-method-checks-other-than-1-minute/35106/3 "2022-05-12T03:18:01Z")

</div>

Thank you.

The query indeed works, only the logger somehow doesn’t show up.

---

<div class="post-metadata">

**Author:** ![mark\_bley](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/mark_bley/32/20954_2.png) [@mark\_bley](https://community.dynatrace.com/u/mark_bley)\
**Post date:** [May 17, 2022, 12:47pm UTC](https://community.dynatrace.com/t/set-query-method-checks-other-than-1-minute/35106/4 "2022-05-17T12:47:40Z")

</div>

The specific logs for your extensions will be under /var/lib/dynatrace/remotepluginmodule/log/remoteplugin/custom.remote.python.your\_extension\_name/

---

<div class="post-metadata">

**Author:** ![AntonioSousa](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/antoniosousa/32/50_2.png) [@AntonioSousa](https://community.dynatrace.com/u/AntonioSousa)\
**Post date:** [May 17, 2022, 8:17pm UTC](https://community.dynatrace.com/t/set-query-method-checks-other-than-1-minute/35106/5 "2022-05-17T20:17:15Z")

</div>

I personally use an alternative method, based on the modulus of the current minute. So, if I want it to run every 5 minutes, I do a modulus 5…

---

<div class="post-metadata">

**Author:** ![Ardhi](https://avatars.discourse-cdn.com/v4/letter/a/e99b99/32.png) [@Ardhi](https://community.dynatrace.com/u/Ardhi)\
**Post date:** [May 18, 2022, 1:20am UTC](https://community.dynatrace.com/t/set-query-method-checks-other-than-1-minute/35106/6 "2022-05-18T01:20:06Z")

</div>

Thank you, yes was using modulus, and so far the result is good.

![Screen Shot 2022-05-18 at 08.18.32.png](https://global.discourse-cdn.com/dynatrace/original/3X/2/4/244bbb2684e278f3ef73e50b16a323165b66cf27.png)
