Using RRD in my application I am trying to find a way to execute "rrdtool fetch" with specific timezone. In my case "Europe/Sofia" which is "+02:00" summer "+03:00" from UTC.
Get this command
rrdtool fetch test.rrd MAX -r 86400 -s -90d -e now
Is it possible to use it with timezone Europe/Sofia, which have to add 2 hours to timestamps?
If it is possible what will happen if we are in summer time, 2 or 3 hours will be added?
Internally, rrdtool works in Unixtime, and so it is timezone-agnostic. If you use 'now' then it will be the current time, whatever timezone you are in. If you give a time like "03:00" then it will be relative to the current timezone as defined by the system.
When displaying time, such as on the X-axis of a graph, then the timezone becomes important.
Note: See the rrdtool documentation for more details - https://oss.oetiker.ch/rrdtool/doc/rrdgraph.en.html
rrdtool uses the system time libraries, and so they control what timezone is used and how this is interpreted. Under Linux, you can set the
TZenvironment variable to select a timezone, and the libraries will use this when converting times to local format for the X-Axis or when you give times like "13:00". If you've not set anything, then you'll get your system's default, whatever that may be.TLDR - set your timezone using the appropriate method for your operating system, and rrdtool will honour it when you specify times.
See here for the documentation showing what strftime symbols can be used in the X-Axis definition : https://oss.oetiker.ch/rrdtool/doc/rrdgraph_graph.en.html
See here for details about the AT-style time specification that can be used for the
-sand-e: https://oss.oetiker.ch/rrdtool/doc/rrdfetch.en.html#AT-STYLE_TIME_SPECIFICATIONOne thing to note is that, whatever timezone you are in, the RRA buckets are aligned with midnight UCT. This doesnt show much if you're in Europe, but in New Zealand you can see the 'daily' counts rolling over at midday.