[mrtg] Re: Newbie - setting up templates

Eric Brander eric_mailing_list at rednarb.com
Fri Apr 15 16:41:02 MEST 2005


Cristine Warring wrote:

>"Global symbol "$targetname" requires explicit package name at (eval 4)
>line 3, <IF_TEMPLATE> line 20.
>  
>

I think it should be $target_name.

Here is the template I use for interfaces on my switches: (watch out for 
line wrap)

if(not $problem_lines)
{

my $target_name = $sysname . "_" . $if_ref;

$target_lines .= <<ECHO;

Target[$target_name]: $if_ref:$router_connect
Options[$target_name]: growright, bits
WithPeak[$target_name]: wmy
MaxBytes[$target_name]: $if_speed
Legend1[$target_name]: Incoming Traffic in Bits per Second
Legend2[$target_name]: Outgoing Traffic in Bits per Second
Legend3[$target_name]: Peak 5 Minute Incoming Traffic
Legend4[$target_name]: Peak 5 Minute Outgoing Traffic
Title[$target_name]: Network Utilization -- $if_description
SetEnv[$target_name]: MRTG_INT_DESCR="$if_ref - $if_snmp_name"
PageTop[$target_name]: <H1><font color="#0000FF">Network Utilization - 
$if_description</font></H1>
 <TABLE>
   <TR><TD><font color="#800000"><b>System:</b></font></TD><TD><font 
color="#800000"><b>$sysname</b></font></TD></TR>
   <TR><TD>Description:</TD><TD>$html_if_description</TD></TR>
   <TR><TD>Interface Name:</TD><TD>$html_if_snmp_name</TD></TR>
   <TR><TD>Interface Type:</TD><TD>$html_if_type_desc 
($if_type_num)</TD></TR>
   <TR><TD>Interface Speed:</TD><TD><font 
color="#0000FF">$if_speed_str</font></TD></TR>
 </TABLE>
ECHO

#my $target_name = $router_name . "_" . $if_ref . "_errors";
my $target_name = $sysname . "_" . $if_ref . "_errors";

$target_lines .= <<ECHO;

Target[$target_name]: ifInErrors.$if_ref&ifOutErrors.$if_ref:$router_connect
Options[$target_name]: growright, nobanner, nopercent, perminute
WithPeak[$target_name]: wmy
MaxBytes[$target_name]: 10000
AbsMax[$target_name]: 10000000
Colours[$target_name]: RED#cc0000,ORANGE#ff6600,DARK 
GREEN#006600,VIOLET#ff00ff
LegendO[$target_name]: Err/Min Out:
LegendI[$target_name]: Err/Min In:
YLegend[$target_name]: Errors
Legend1[$target_name]: Incoming Errors per Minute
Legend2[$target_name]: Outgoing Errors per Minute
Legend3[$target_name]: Peak 5 Minute Incoming Errors per Minute
Legend4[$target_name]: Peak 5 Minute Outgoing Errors per Minute
ShortLegend[$target_name]: &nbsp;
Title[$target_name]: Errors -- $if_description
SetEnv[$target_name]: MRTG_INT_DESCR="Errors - $if_snmp_name"
PageTop[$target_name]:  <H1><font color="#0000FF">Errors - 
$if_description</font></H1>
 <TABLE>
   <TR><TD><font color="#800000"><b>System:</b></font></TD><TD><font 
color="#800000"><b>$sysname</b></font></TD></TR>
   <TR><TD>Description:</TD><TD>$html_if_description</TD></TR>
   <TR><TD>Interface Name:</TD><TD>$html_if_snmp_name</TD></TR>
   <TR><TD>Interface Type:</TD><TD>$html_if_type_desc 
($if_type_num)</TD></TR>
   <TR><TD>Interface Speed:</TD><TD><font 
color="#0000FF">$if_speed_str</font></TD></TR>
 </TABLE>
ECHO


} else {
  $head_lines="";
  $problem_lines="";
  $target_lines="";
  $separator_lines="";
}

--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive     http://lists.ee.ethz.ch/mrtg
FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org
WebAdmin    http://lists.ee.ethz.ch/lsg2.cgi



More information about the mrtg mailing list