Helper functions are meant to simplify the creation of templates and trap errors
string rrd::def ( $vname, $rrdfile, $ds, [ $cf='AVERAGE' ] )
$def = rrd::def('var1', $RRDFILE[0], $DS[0], 'MAX');
string rrd::cdef ( $vname, $rpn, )
$def = rrd::cdef('var1_bits', 'var1,8,*' );
string rrd::vdef ( $vname, $rpn, )
$def = rrd::vdef('var1_avg', 'var1,AVERAGE' );
string rrd::line[1-3] ( $vname, $color, [ $text ], [ $stack ] )
$def .= rrd::line1('var1', #ff00ff );
Draws a simple line one pixel wide without label
$def .= rrd::line3('var1', '#ff00ff', 'Load' );
Draws a line three pixels wide with label “Load”
string rrd::area ( $vname, $color, [ $text ], [ $stack ] )
$def .= rrd::area('var1', '#ff00ff', 'Load' );
Draws an area with label “Load”
string rrd::gprint ( $vname, $cf, [ $text ] )
$def .= rrd::gprint('var1', 'MAX', '%4.2lf %s Max' );
$def .= rrd::gprint('var1', array('MIN', 'MAX', 'AVERAGE'), '%4.2lf %s' );
If $cf is an array the legend will be formatted automatically
string rrd::color ( $num )
Returns a color from the HTML color table
string rrd::gradient ( $vname, [$start_color], [$end_color], [$label], [$steps] )
Creates a color gradient from $start_color to $end_color
$def .= rrd::gradient('var1', '#ff0000', '#ffff00' );
string rrd::cut ( $text, $length )
$label = rrd::cut($LABEL[0], 18);
Cuts a text to a given length $length or fills it up to $length if needed.
This function is helpful if legend needs to be justified but length of label is unknown.
string rrd::ticker ( $vname, $warning, $critical, [$fraction], [$opacity], [$color_OK], [$color_WARN], [$color_CRIT] )
Creates a colorized bar at the top of the chart which shows different colors depending on states OK, WARNING & CRITICAL
$def .= rrd::ticker( "var1", $WARN[0], $CRIT[0] );
string rrd::alerter ( $vname, $label, $warning, $critical, [$opacity], [$unit], [$color_OK], [$color_WARN], [$color_CRIT], [$line_col] )
Creates colorized areas, which show different colors depending on states OK, WARNING & CRITICAL
$def .= rrd::alerter( "var1", $LABEL[0], $WARN[0], $CRIT[0], "FF", $UNIT[0] );