# Author: Tobias Oetiker <tobi@oetiker.ch>
# Date: 2006-09-06
# Purpose: Add an Error graph for each Traffic Graph


#if($if_ok) { #we are only interested in 'running' interfaces
    
 my $el = $default_target_lines;
 $el =~ s/^(Target\S+:\s+).+/${1}ifInErrors$if_ref&ifOutErrors$if_ref:$router_connect/m; # Error Target
 $el =~ s/^([^\s\]]+)/${1}.error/gm; # Filename for error log and graphs
 $el =~ s|</h1>| - Errors</h1>|i;
 $el =~ s|^(Title\[.+)|$1 - Errors|mi;
 $el =~ s/Traffic/Error/;
 $el =~ s/^(MaxBytes)(\S+)\s+\d+/$1$2 10000/m;  # more than 10'000 errors a second are BIG trouble anyway
 $el .= <<LEGEND;
YLegend$2 Errors per Minute
ShortLegend$2 e/min
Legend1$2 Incoming Errors per Minute
Legend2$2 Outgoing Errors per Minute
Legend3$2 Maximal 5 Minute Incoming Minute
Legend4$2 Maximal 5 Minute Outgoing Minute
LegendI$2 &nbsp;In:
LegendO$2 &nbsp;Out:
Options$2 perminute
LEGEND

  $target_lines = $default_target_lines."\n";
  if (oid_pick($router_connect,$v3opt,"ifInErrors.$if_index") and oid_pick($router_connect,$v3opt,"ifOutErrors.$if_index")){
        $target_lines .= $el;
  }
  $target_lines =~ s{<tr>\s+<td>(.+?)</td>\s+<td>(.+?)</td>\s*</tr>}{<tr><td>$1</td>\t<td>$2</td></tr>}g;
#} else {
#  $head_lines="";
#  $problem_lines="";
#  $target_lines="";
#  $separator_lines="";
#}
