Comment 0 for bug 6008

Revision history for this message
In , Lorenzo Grio (lorenzo-grio-it) wrote : couriergraph not works with rrdtool 1.2

Package: couriergraph
Version: 0.24-1

Couriergraph does not work with rrdtool version 1.2, graph images are
not created and in web server log you will find:

ERROR: Garbage ':22:24 2005]\l' after command:
COMMENT:[Tue Aug 30 15:22:24 2005]\l
[Tue Aug 30 15:22:24 2005] [error] [client ???.???.???.???] Premature
end of script headers: /usr/lib/cgi-bin/couriergraph.cgi

To solve this problem file /usr/lib/cgi-bin/couriergraph.cgi need to be
modified (subroutines graph and graph_err):

sub graph($$$)
{
 my $range = shift;
 my $file = shift;
 my $title = shift;
 my $step = $range*$points_per_sample/$xpoints;
 my $date = localtime(time);
 $date =~ s|:|\\:|g unless $rrdtool_1_0;

 my ($graphret,$xs,$ys) = RRDs::graph($file,
  '--imgformat', 'PNG',
  '--width', $xpoints,
  '--height', $ypoints,
  '--start', "-$range",
  '--vertical-label', 'logins/min',
  '--lower-limit', 0,
  '--units-exponent', 0, # don't show milli-messages/s
  '--lazy',
  '--color', 'SHADEA#ffffff',
  '--color', 'SHADEB#ffffff',
  '--color', 'BACK#ffffff',

  $rrdtool_1_0 ? () : (
   '--slope-mode'
  ),

  "DEF:pop3d_login=$rrd:pop3d_login:AVERAGE",
  "DEF:mpop3d_login=$rrd:pop3d_login:MAX",
  "DEF:imapd_login=$rrd:imapd_login:AVERAGE",
  "DEF:mimapd_login=$rrd:imapd_login:MAX",
  "CDEF:rpop3d_login=pop3d_login,60,*",
  "CDEF:vpop3d_login=pop3d_login,UN,0,pop3d_login,IF,$range,*",
  "CDEF:rmpop3d_login=mpop3d_login,60,*",
  "CDEF:rimapd_login=imapd_login,60,*",
  "CDEF:vimapd_login=imapd_login,UN,0,imapd_login,IF,$range,*",
  "CDEF:rmimapd_login=mimapd_login,60,*",
  'LINE2:rpop3d_login#BB0000:pop3',
  'GPRINT:vpop3d_login:AVERAGE:total\: %.0lf logins',
  'GPRINT:rmpop3d_login:MAX:max\: %.0lf logins/min\l',
  'LINE2:rimapd_login#009900:imap',
  'GPRINT:vimapd_login:AVERAGE:total\: %.0lf logins',
  'GPRINT:rmimapd_login:MAX:max\: %.0lf logins/min\l',
  'HRULE:0#000000',
  'COMMENT:\s',
  'COMMENT:['.$date.']\r',
 );
 my $ERR=RRDs::error;
 die "ERROR: $ERR\n" if $ERR;
}

sub graph_err($$$)
{
 my $range = shift;
 my $file = shift;
 my $title = shift;
 my $step = $range*$points_per_sample/$xpoints;
 my $date = localtime(time);
 $date =~ s|:|\\:|g unless $rrdtool_1_0;

 my ($graphret,$xs,$ys) = RRDs::graph($file,
  '--imgformat', 'PNG',
  '--width', $xpoints,
  '--height', $ypoints_err,
  '--start', "-$range",
  '--vertical-label', 'logins/min',
  '--lower-limit', 0,
  '--units-exponent', 0, # don't show milli-messages/s
  '--lazy',
  '--color', 'SHADEA#ffffff',
  '--color', 'SHADEB#ffffff',
  '--color', 'BACK#ffffff',

  $rrdtool_1_0 ? () : (
   '--slope-mode'
  ),

  "DEF:pop3d_ssl_login=$rrd:pop3d_ssl_login:AVERAGE",
  "DEF:mpop3d_ssl_login=$rrd:pop3d_ssl_login:MAX",
  "DEF:imapd_ssl_login=$rrd:imapd_ssl_login:AVERAGE",
  "DEF:mimapd_ssl_login=$rrd:imapd_ssl_login:MAX",
  "CDEF:rpop3d_ssl_login=pop3d_ssl_login,3600,*",
  "CDEF:vpop3d_ssl_login=pop3d_ssl_login,UN,0,pop3d_ssl_login,IF,$range,*",
  "CDEF:rmpop3d_ssl_login=mpop3d_ssl_login,3600,*",
  "CDEF:rimapd_ssl_login=imapd_ssl_login,3600,*",
  "CDEF:rmimapd_ssl_login=mimapd_ssl_login,3600,*",

"CDEF:vimapd_ssl_login=imapd_ssl_login,UN,0,imapd_ssl_login,IF,$range,*",
  'LINE2:rpop3d_ssl_login#000000:pop3',
  'GPRINT:vpop3d_ssl_login:AVERAGE:total\: %.0lf logins',
  'GPRINT:rmpop3d_ssl_login:MAX:max\: %.0lf logins/hour\l',
  'LINE2:rimapd_ssl_login#000099:imap',
  'GPRINT:vimapd_ssl_login:AVERAGE:total\: %.0lf logins',
  'GPRINT:rmimapd_ssl_login:MAX:max\: %.0lf logins/hour\l',
  'HRULE:0#000000',

  'COMMENT:['.$date.']\r',
 );
 my $ERR=RRDs::error;
 die "ERROR: $ERR\n" if $ERR;
}

I've "copied" these modifies from mailgraph 1.11-1

Thanks for this package,
Lorenzo