11 May 2022 05:01 AM - last edited on 17 May 2023 09:25 AM by Michal_Gebacki
Hi,
Based on this documentation, 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,
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
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
Solved! Go to Solution.
11 May 2022 07:17 AM
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.
12 May 2022 04:18 AM
Thank you.
The query indeed works, only the logger somehow doesn't show up.
17 May 2022 01:47 PM
The specific logs for your extensions will be under /var/lib/dynatrace/remotepluginmodule/log/remoteplugin/custom.remote.python.your_extension_name/
17 May 2022 09:17 PM
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...
18 May 2022 02:20 AM - last edited on 19 May 2022 01:53 PM by MaciejNeumann
Thank you, yes was using modulus, and so far the result is good.