NRG Template Configuration

 - The key feature of NRG templates is the use of keywords.
   This file documents keywords that can be used in NRG templates.
   It also contains general information about the use of templates.
 - The Default.conf file defines the default templates used.  See
   "grep Template Default.conf".
 - If you want to alter the look and feel of your NRG website (the
   HTML layout of your .cgi scripts), then edit .cgi.tm templates.
   Another place to alter NRG's HTML is in the discover-*.tm
   templates: these contain the HTML for the headers of web pages
   generated by nrg-discover-ifaces et al.
 - If you want to alter the way NRG maintains round robin databases
   of data, then edit .rrd.tm templates.


Graph Web Page Templates

 - Graph web page templates are used to define the look and feel
   of your NRG graph web pages.  Graph web page templates have
   the ".cgi.tm" extension.  The following rrdcgi graph template
   keywords are substituted by nrg-cgikeeper:
     ___RRD___
     ___DIR___
     ___TITLE___
     ___PAGE_TOP___
     ___PAGE_BODY___
     ___PAGE_BOTTOM___
     ___IMAGE_DIR___
     ___OPTIONS___
 
 - There are two special rrdcgi graph template keywords:
     ___DEFS___
     ___PLOTS___
 - These keywords cause nrg-cgikeeper to generate lines of rrdcgi
   code for graphing each DS (defined by the var_name part of the
   .conf string "Variable[target][var_name]: ...").  The keyword 
   ___DEFS___ will generate lines of DEF and CDEF rrdcgi code.  
   The keyword ___PLOTS___ will generate lines of AREA, LINEn, STACK 
   and GPRINT rrdcgi code.
 - Note that graph web page templates must begin with these two lines:
     #!/some/path/to/rrdcgi
     <HTML>
   If they do not, Microsoft InternetExplorer will not properly
   display graph web pages constructed with the incorrect template.


RRD Database Templates

 - RRD database templates define the data sources (DS) and round 
   robin archives (RRAs) for your NRG data.  Database templates have
   the ".rrd.tm" extension.
 - The rrdcgi graph has three specal-case template keywords:
     ___RRD_NAME___  - this keyword is thrown away! (the .rrd file path is
                       determined by .conf configuration strings)
     ___DSS___       - this keyword is substituted with RRDtool DS names.
                       These DS names are determined by the "var" part
                       of the Variable[target][var]: .conf string.
     ___DS_TYPES___  - this keyword is substituted with the DS types of
                       the DSs.  The default DS type is "COUNTER"--it's
                       substituted when no DS type is specified in the
                       Variable[target][var]: .conf string.
     ___DS_MAX___    - this keyword is substituted with the best MaxValue[] 
                       statement match.  It's used to set the "max" value of 
                       DSs to prevent incorrect graph spikes.
 - Here are some caveats about using nrg-rrdkeeper:
     - nrg-rrdkeeper assumes each rrd-template contains information
       for the creation of one and only one "rrdtool create".  So 
       define one and only one "class" of RRD in each rrd-template file.
     - make sure each line of "rrdtool create" information starts
       with either "-" or "DS" or "RRA".  All other lines will be
       ignored.


Table Web Page Templates

 - Table web page templates are used to define the look and feel of
   your NRG table web pages.   They have the ".cgi.tm" extension.
 - The following "global" rrdcgi table template keyword is
   substituted by nrg-tablemaker:
     ___TITLE___
 - To allow for the creation HTML tables, nrg-tablekeeper generates
   blocks of HTML code corresponding to the RRDs that match
   the TableRegExp[]: .conf string.  (See templates/table-misc.cgi.tm.)
   These blocks of HTML code begin after the ___BEGIN_ROWS___
   template keyword and end with the ___END_ROWS___ template keyword.
   Within these blocks, the following keywords are substituted:
     ___DS_LABELS___
     ___PAGE_TITLE___
     ___PAGE_URL___
     ___RRD_NAME___
     ___TARGET_NAME___
 - To allow for inserting text from the PageBody[]: configuration 
   strings into table web pages, there is a special keyword
     ___REGEXP_regexp___   (should be ___PAGE_BODY_regexp___)
   where "regexp" is perl regular expression.  For example, the 
   keyword ___REGEXP_Interface:\s*(\S+)___ will extract "Serial-1"
   from the configuration string "PageBody[]: Interface: Serial-1".
 - To allow for inserting current "now" RRD values into table web
   pages, there is another special keyword:
     ___RRD_regexp_DSn_LAST___
   where "regexp" is perl regular expression and "n" is the Nth DS.
   This tells nrg-tablemaker to replace this keyword with DS values
   for the Nth DSs in the RRDs matching "regexp".  For example,
   the keyword ___RRD_.*-mem.rrd$_DS0_LAST___ will be replaced by
   values the 1st DSs in RRD's matching the perl regular expression
   /.*-mem.rrd$/.  (The perl regexp /.*-mem.rrd$/ simply matches
   the -mem.rrd file name extension/suffix.)