Change timezone and rounding off time in kapacitor alerts
Can there be a provision to change timezone of kapacitor alerts ex from UTC TO IST . Also can "2016-11-02 09:39:05.560565984 +0000 UTC" be changed to something like" 2016-11-02 09:39" or any other format
any news on enhancement.. by default kapacitor is in GMT TZ. how can I make this to PST TZ?
@vipulkhullar @maddygoes Are you talking about the timezone in the alert messages or somewhere else?
In the alerting... I think, we should have an option to change the TZ or kapacitor should pickup default server TZ...like grafana... right ?
Hi @nathanielc.
I'm quite surprised for the lack of support for timezones in a monitoring tool.. :(
We would like migrate part of our monitoring infrastructure to use with kapacitor , but we can not send alerts with N hours in the past to our system administrators. They will get confused on the time where to look for problems.
There is any plans to support TZ ? As a workaround could you send timestamp instead that we can transform to a valid time in our timezone ?
Hi @nathanielc we need a workaround to fix the time sent in the message.
There is any way to force kapacitor execute a "date" command in the host server and attach the output to the message on each triggered alert?
Thank you very much
Any update on this ? I really to change the timezone to my local timezone in the message.
Ok, I solved this myself. For those need to change timezone, 1st you need to change timezone in kapacitor server, then use this:
Time: {{ .Time.Local.Format "Mon, Jan 2 2006 at 15:04:05 MST" }}
You can use golang format here
Time: {{ .Time.Local.Format "Mon, Jan 2 2006 at 15:04:05 MST" }}
Adding context, here is the golang time format documentation: https://golang.org/pkg/time/#example_Time_Format
1st you need to change timezone in kapacitor server
@davistran86 How did you accomplish changing the timezone of the kapacitor server? I'm struggling to find kapacitor configuration that does this.
then use this:
Time: {{ .Time.Local.Format "Mon, Jan 2 2006 at 15:04:05 MST" }}
Use where?
I would also like to know where this is set. I can't find anything in kapacitor.conf
I would also like to know where this is set. I can't find anything in kapacitor.conf
That would go into your Kapacitor alert rule, such as in a TICKscript or in Chronograf's built-in monitoring config tool if you use that.
1st you need to change timezone in kapacitor server
@davistran86 How did you accomplish changing the timezone of the kapacitor server? I'm struggling to find kapacitor configuration that does this.
You can either change the TZ environment variable for the kapacitord process or change /etc/localtime.
I'm running Kapacitor in Docker, so I added this to my run command: -e TZ=Asia/Shanghai
That would go into your Kapacitor alert rule, such as in a TICKscript or in Chronograf's built-in monitoring config tool if you use that.
Could you please post a link how to do that? With https://community.influxdata.com/t/setting-time-zones/4974 this is not possible.
You can either change the
TZenvironment variable for the kapacitord process or change/etc/localtime. I'm running Kapacitor in Docker, so I added this to my run command:-e TZ=Asia/Shanghai
correct. I am doing this with mounting /etc/localtime from the host. But this has no effect for the kapacitor-timezone.
The time variable and format string is put directly into the alert message (.details) in tickscript. So your message could look like this:
var details = '<p>
Website abc.com is <b>{{ if eq .Level "CRITICAL" }}DOWN{{ else }}BACK ONLINE{{ end }}</b>: HTTP response code of http://abc.com/ is {{ index .Fields "value" }}.
</p>
<p>
Time: {{ .Time.Local.Format "Mon, Jan 2 2006 at 15:04:05 CST" }}
</p>
<p>
For more details go to https://chronograf.abc.com/
</p>'
What I struggle with now is that chronograf still shows the alerts time in UTC. Very confusing, when browsing data, all times are adapted to your browser's time zone, but when listing alerts, time is in UTC.