Pivotal Knowledge Base

Follow

How to open statistics archive files using a specific time zone in VSD

Applies To:

All Versions of GemFire

Purpose:

By default, VSD opens statistics in the time zone of the host running VSD. In order to align statistics with log entires, however, it would be preferable to see them in the time zone of the source system. A method for controlling the time zone used by VSD and an example script to (semi-)automate this is presented here.

Solution:

  1. To open a VSD file with the time zone of the source system, you need to know in which time zone the VSD file was created.

    This information is kept in the stats archive file header and can be extracted using the following:

    $ strings file.gfs | head

    e.g.

    $ strings cacheserver.gfs | head
    Hongkong
    localhost
    :GemFire 6.6.4.3 #build 39140 as of 12/10/2012 14:46:33 PST
    Linux 2.6.18-274.el5
    amd64 localhost
    ...
    
  2. On Unix/Linux systems, you can confirm the availability of the zone by looking in /usr/share/zoneinfo.
  3. Export the specified time zone to the shell and launch VSD:
    $ export TZ=<time zone> vsd

    e.g., for Hong Kong, you would do:

    $ export TZ=Asia/Hong_Kong vsd

Note: Some time zones have short names (e.g. EST, IST) that are not sufficiently unique, so it is generally better to use an equivalent "zoneinfo", region/city identifier.

Scripted Solution:

Below is a script that implements the above procedure. To use, save the script, changing the path of vsd to fit your install, and change the permissions of the script to run it, i.e.:

$ chmod +x startVSD.sh
$ ./startVSD.sh statfile.gfs

---- BEGIN SCRIPT ----

#!/bin/bash
# setting TIMEZONE before launching overrides the automatic setting.
if [ "$TIMEZONE" != "" ]; then
  export TZ=$TIMEZONE
else
  export TZ=`strings "$@" | head -1`
fi

echo "Using time zone: $TZ"
# use "exec" to start vsd in this same process rather than spawn a new one.
exec Path_to_GemFire/tools/vsd/bin/vsd "$@" &

----- END SCRIPT -----

Comments

Powered by Zendesk