Discussion of NRG Configuration Strings

NRG configuration strings have the following formats:

 SomeKeyword[target]: value
 SomeOtherKeyword[target][ds]: value two

The NRG configuration system simply uses hash tables (indexed arrays) where the keys are the ``target'' and ``ds'' hash key names above. The values of these hash tables are the ``value'' and ``value two'' on the right hand side of the strings above.

For example:

 System[erewhon-e1]:            public@erewhon.wiscnet.net
 RRD[erewhon-e1]:               erewhon-e1.rrd
 GraphWebPage[erewhon-e1]:      erewhon-e1.cgi
 Variable[erewhon-e1][input]:   ifInOctets.1
 Variable[erewhon-e1][output]:  ifOutOctets.1

Global configuration values can be set by using the special target ``*''. For example:

 Label[*][input_bits]: input

To reducing the amount of similar configuration strings, NRG allows for the use of perl regular expressions (regexp's) for setting semi-global configuration values. This involves using a regexp with one of the ``^'', ``$'', or ``.*'' patterns--these patterns cause NRG to evaluate them as regexp's. For example, the following configuration sets the graph label to ``amount used'' for all targets that end in ``-mem'':

 Label[.*-mem$][used_mem]:  amount used

Note to MRTG users: The NRG configuration system differs from the MRTG system. With MRTG, using ``^'' and/or ``$'' for the target of a MRTG conf string has a ``positional'' context and they used to prepend or append global configuration values. With NRG, ``^'' should be used at the beginning of target or ds to start matching at the beginning and ``$'' should be used at the end of a target or ds to force matching at the end like above.

The RRD[]: keyword creates a RRD (.rrd file.) The Variable[]: keywords define an RRD's DSs. Together, they tell nrg-runmaker to gather SNMP or other data. The GraphWebPage[]: keyword creates an rrdcgi script. The Graph[]: keywords tell NRG how to display DS values in graph web pages.

I don't think you can use regexps or ``*'' in the ds part of Graph[][]: configuration strings. The reason for this restriction is very complex and thus beyond the scope of this document. (In fact, I'm not sure I could really explain it without watching debug output from the execution of nrg-cgikeeper!)