alertmanager
alertmanager copied to clipboard
mute_time_intervals in local time zone
Hello,
Does it make sense to add an ability to specify mute_time_intervals start and end times in the local time zone instead of UTC? Let's imaging that we deploy the same service in 4 regions (US, EU, APAC, AE), And we have a maintenance job for this service starting at 1:00 AM local time. Also, we have a local Prometheus/Alertmanager in every region. With the current approach, we have to have 4 different configurations of Alertmanager depending on the target region because the start time will be different in UTC. Also, onboarding a new region will also require Alertmanager's config modification. Having the configuration in local time will allow having the same config across all regions, and do not care about time conversion
Same here, we are in a time zone that changes year by year for daylight saving.
Only having UTC makes it much more annoying to maintain offhour schedules.
There must be a go library that handles timezones?! Is there interest from the devs for a pull request to implement this?
Hi @arnitolog,
Yes there is interest in this, and it was discussed when the feature was first merged. Initially the mute time interval specification allowed a timezone parameter as part of the definition, however this had some issues. The main problem is that Go does not use the Windows time zone database, so conversion between time zones simply does not work on Windows which is a platform that Prometheus/Alertmanager supports, so we couldn't do it without breaking support for that platform.
That being said, Go is capable of retrieving the servers local time from Windows, just not arbitrarily converting between time zones on Windows. Perhaps the easiest option here is to just allow using the servers local timezone as a boolean flag in the timezone definition rather than allowing arbitrary time zones as a parameter.
I'm happy to add this if @simonpasquier or @w0rm are ok with the concept.
We could load the default timezone go provides if we also provide the user the ability to load a fresher timezone file.
I've just opened #2782 which allows a user-specified timezone in time interval definitions. For Windows, users can pass in 'Local' which works without a timezone database and (I would guess) addresses most users who just want to use a local time.
Anything specific that prevents #2782 from being merged? It's a great feature to have for global companies, we eagerly wait for this to be merged :)
I'm also interested in seeing this merged because I'd also like to define time zone specific times.
This is now merged and released via https://github.com/prometheus/alertmanager/releases/tag/v0.25.0.