cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Set query method checks other than 1 minute

Ardhi
Guide

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

 

Screen Shot 2022-05-11 at 10.15.22.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

5 REPLIES 5

Julius_Loman
DynaMight Legend
DynaMight Legend

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.

Certified Dynatrace Master | Alanata a.s., Slovakia, Dynatrace Master Partner

Thank you.

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

mark_bley
Dynatrace Champion
Dynatrace Champion

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

AntonioSousa
DynaMight Guru
DynaMight Guru

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...

Antonio Sousa

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

 

Screen Shot 2022-05-18 at 08.18.32.png

Featured Posts