[collectd] [PATCH] contrib/collection.cgi: Replace undefined values
with 0 in email graphs.
Sebastian Harl
sh<span style="display: none;">.trailing-username</span>(a)<span style="display: none;">leading-domain.</span>tokkee.org
Wed Dec 13 09:33:40 CET 2006
The email plugin does not write any values to the rrd files if no data is
available thus causing the graphs to look somewhat broken if undefined values
are output as such.
Signed-off-by: Sebastian Harl <sh<span style="display: none;">.trailing-username</span>(a)<span style="display: none;">leading-domain.</span>tokkee.org>
---
contrib/collection.cgi | 63 ++++++++++++++++++++++++++++++++----------------
1 files changed, 42 insertions(+), 21 deletions(-)
diff --git a/contrib/collection.cgi b/contrib/collection.cgi
index 5c8bd4d..cc4eabc 100755
--- a/contrib/collection.cgi
+++ b/contrib/collection.cgi
@@ -283,9 +283,12 @@ # 'CDEF:syst_acc=syst_avg_notnull',
'GPRINT:qry_avg_sum:LAST:(ca. %5.1lf%sB Total)\l'
],
email => [
- 'DEF:avg={file}:count:AVERAGE',
- 'DEF:min={file}:count:MIN',
- 'DEF:max={file}:count:MAX',
+ 'DEF:tavg={file}:count:AVERAGE',
+ 'DEF:tmin={file}:count:MIN',
+ 'DEF:tmax={file}:count:MAX',
+ 'CDEF:avg=tavg,UN,0,tavg,IF',
+ 'CDEF:min=tmin,UN,0,tmin,IF',
+ 'CDEF:max=tmax,UN,0,tmax,IF',
"AREA:max#$HalfMagenta",
"AREA:min#$Canvas",
"LINE1:avg#$FullMagenta:Count ",
@@ -295,9 +298,12 @@ # 'CDEF:syst_acc=syst_avg_notnull',
'GPRINT:avg:LAST:%4.1lf Last\l'
],
email_size => [
- 'DEF:avg={file}:size:AVERAGE',
- 'DEF:min={file}:size:MIN',
- 'DEF:max={file}:size:MAX',
+ 'DEF:tavg={file}:size:AVERAGE',
+ 'DEF:tmin={file}:size:MIN',
+ 'DEF:tmax={file}:size:MAX',
+ 'CDEF:avg=tavg,UN,0,tavg,IF',
+ 'CDEF:min=tmin,UN,0,tmin,IF',
+ 'CDEF:max=tmax,UN,0,tmax,IF',
"AREA:max#$HalfMagenta",
"AREA:min#$Canvas",
"LINE1:avg#$FullMagenta:Count ",
@@ -307,9 +313,12 @@ # 'CDEF:syst_acc=syst_avg_notnull',
'GPRINT:avg:LAST:%4.1lf Last\l'
],
spam_score => [
- 'DEF:avg={file}:score:AVERAGE',
- 'DEF:min={file}:score:MIN',
- 'DEF:max={file}:score:MAX',
+ 'DEF:tavg={file}:score:AVERAGE',
+ 'DEF:tmin={file}:score:MIN',
+ 'DEF:tmax={file}:score:MAX',
+ 'CDEF:avg=tavg,UN,0,tavg,IF',
+ 'CDEF:min=tmin,UN,0,tmin,IF',
+ 'CDEF:max=tmax,UN,0,tmax,IF',
"AREA:max#$HalfMagenta",
"AREA:min#$Canvas",
"LINE1:avg#$FullMagenta:Count ",
@@ -319,9 +328,12 @@ # 'CDEF:syst_acc=syst_avg_notnull',
'GPRINT:avg:LAST:%4.1lf Last\l'
],
spam_check => [
- 'DEF:avg={file}:hits:AVERAGE',
- 'DEF:min={file}:hits:MIN',
- 'DEF:max={file}:hits:MAX',
+ 'DEF:t avg={file}:hits:AVERAGE',
+ 'DEF:tmin={file}:hits:MIN',
+ 'DEF:tmax={file}:hits:MAX',
+ 'CDEF:avg=tavg,UN,0,tavg,IF',
+ 'CDEF:min=tmin,UN,0,tmin,IF',
+ 'CDEF:max=tmax,UN,0,tmax,IF',
"AREA:max#$HalfMagenta",
"AREA:min#$Canvas",
"LINE1:avg#$FullMagenta:Count ",
@@ -1430,9 +1442,12 @@ sub output_graph_email_count
for (my $i = 0; $i < $c; ++$i) {
push @ret,
- "DEF:min_$i=$AbsDir/email-$inst[$i].rrd:count:MIN",
- "DEF:avg_$i=$AbsDir/email-$inst[$i].rrd:count:AVERAGE",
- "DEF:max_$i=$AbsDir/email-$inst[$i].rrd:count:MAX";
+ "DEF:tmin_$i=$AbsDir/email-$inst[$i].rrd:count:MIN",
+ "DEF:tavg_$i=$AbsDir/email-$inst[$i].rrd:count:AVERAGE",
+ "DEF:tmax_$i=$AbsDir/email-$inst[$i].rrd:count:MAX",
+ "CDEF:avg_$i=tavg_$i,UN,0,tavg_$i,IF",
+ "CDEF:min_$i=tmin_$i,UN,0,tmin_$i,IF",
+ "CDEF:max_$i=tmax_$i,UN,0,tmax_$i,IF";
}
for (my $i = 0; $i < $c; ++$i) {
@@ -1466,9 +1481,12 @@ sub output_graph_email_size
for (my $i = 0; $i < $c; ++$i) {
push @ret,
- "DEF:min_$i=$AbsDir/email_size-$inst[$i].rrd:size:MIN",
- "DEF:avg_$i=$AbsDir/email_size-$inst[$i].rrd:size:AVERAGE",
- "DEF:max_$i=$AbsDir/email_size-$inst[$i].rrd:size:MAX";
+ "DEF:tmin_$i=$AbsDir/email_size-$inst[$i].rrd:size:MIN",
+ "DEF:tavg_$i=$AbsDir/email_size-$inst[$i].rrd:size:AVERAGE",
+ "DEF:tmax_$i=$AbsDir/email_size-$inst[$i].rrd:size:MAX",
+ "CDEF:avg_$i=tavg_$i,UN,0,tavg_$i,IF",
+ "CDEF:min_$i=tmin_$i,UN,0,tmin_$i,IF",
+ "CDEF:max_$i=tmax_$i,UN,0,tmax_$i,IF";
}
for (my $i = 0; $i < $c; ++$i) {
@@ -1502,9 +1520,12 @@ sub output_graph_spam_check
for (my $i = 0; $i < $c; ++$i) {
push @ret,
- "DEF:min_$i=$AbsDir/spam_check-$inst[$i].rrd:hits:MIN",
- "DEF:avg_$i=$AbsDir/spam_check-$inst[$i].rrd:hits:AVERAGE",
- "DEF:max_$i=$AbsDir/spam_check-$inst[$i].rrd:hits:MAX";
+ "DEF:tmin_$i=$AbsDir/spam_check-$inst[$i].rrd:hits:MIN",
+ "DEF:tavg_$i=$AbsDir/spam_check-$inst[$i].rrd:hits:AVERAGE",
+ "DEF:tmax_$i=$AbsDir/spam_check-$inst[$i].rrd:hits:MAX",
+ "CDEF:avg_$i=tavg_$i,UN,0,tavg_$i,IF",
+ "CDEF:min_$i=tmin_$i,UN,0,tmin_$i,IF",
+ "CDEF:max_$i=tmax_$i,UN,0,tmax_$i,IF";
}
for (my $i = 0; $i < $c; ++$i) {
--
1.4.3.2
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20061213/e00dec13/attachment.pgp
More information about the collectd
mailing list