10 May 2022
09:01 PM
- last edited on
17 May 2023
01: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.
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.
Thank you.
The query indeed works, only the logger somehow doesn't show up.
The specific logs for your extensions will be under /var/lib/dynatrace/remotepluginmodule/log/remoteplugin/custom.remote.python.your_extension_name/
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...
17 May 2022
06:20 PM
- last edited on
19 May 2022
05:53 AM
by
MaciejNeumann
Thank you, yes was using modulus, and so far the result is good.
Featured Posts