braedon / prometheus-mysql-exporter

Prometheus MySQL Exporter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature: allow queries at defined times (a.k.a. cron-like)

svenXY opened this issue · comments

Hi,

it would be great to be able to run some queries at certain times, like at 00:00 or similar. We have queries that count certain things and want to have precise numbers (x per day and similar)

scheduler.enterabs(time, priority, action, argument=(), kwargs={}) allows to set a time, so it would be necessary to change schedule_event to allow to either set a query_every or query_at.

Hi, I've made PR #18 to implement this, maybe you'd like to take a look at it

Cheers,
Sven

Hi @svenXY, sorry for the long delay.

I wanted to keep the MySQL reconnection change separate, and change the cron implementation a bit, so I made a new branch from your main commit. There's some explanation of the changes in the commit message.

Please review #20 and let me know if it'll still work for you. If so, I'll get it merged in ASAP.

Released in 0.5.0