[mrtg] Re: target_lines and template

Brander, Eric Eric.Brander at ACS-INC.com
Thu Jan 9 22:54:20 MET 2003


No perl scripting needed.  Check out this template I use.  It does in and
out of course, but also does errors and discards.  It would be a simple
modification to change it to what you are looking for instead of discards.
I call it with a batch file:

perl cfgmaker --subdirs=SNMPNAME --if-template=template-switch.txt
--ifdesc=name --descint --show-op-down public@%1 --output=%2.tmp 

##########start template-switch.txt##########

if(not $problem_lines)
{

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

$target_lines .= <<ECHO;

Target[$target_name]: $if_ref:$router_connect
ECHO

if ($directory_name) {
  $target_lines .= "Directory[$target_name]: $directory_name\n";
}

$target_lines .= <<ECHO;
Options[$target_name]: growright, bits, nobanner
UnScaled[$target_name]: dwmy
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]: $sysname -- $if_description -- Network Utilization
PageTop[$target_name]: <H1><font color="#0000FF">$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
ECHO

if ($directory_name) {
  $target_lines .= "Directory[$target_name]: $directory_name\n";
}

$target_lines .= <<ECHO;
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:&nbsp
LegendI[$target_name]: Err/Min In:&nbsp
YLegend[$target_name]: Errors
Legend1[$target_name]: Incoming Errors per Second
Legend2[$target_name]: Outgoing Errors per Second
Legend3[$target_name]: Peak 5 Minute Incoming Errors per Second
Legend4[$target_name]: Peak 5 Minute Outgoing Errors per Second
ShortLegend[$target_name]: &nbsp
Title[$target_name]: $sysname -- $if_description -- Errors
PageTop[$target_name]:  <H1><font
color="#0000FF">$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 . "_discards";
my $target_name = $sysname . "_" . $if_ref . "_discards";

$target_lines .= <<ECHO;

Target[$target_name]:
ifInDiscards.$if_ref&ifOutDiscards.$if_ref:$router_connect
ECHO

if ($directory_name) {
  $target_lines .= "Directory[$target_name]: $directory_name\n";
}

$target_lines .= <<ECHO;
Options[$target_name]: growright, nobanner, nopercent, perminute
WithPeak[$target_name]: wmy
MaxBytes[$target_name]: 10000
AbsMax[$target_name]: 10000000
Colours[$target_name]: ORANGE#ff6600,BRIGHTBLUE#0066ff,DARK
GREEN#006600,VIOLET#ff00ff
LegendO[$target_name]: Dis/Min Out:&nbsp
LegendI[$target_name]: Dis/Min In:&nbsp
YLegend[$target_name]: Discards
Legend1[$target_name]: Incoming Discards per Second
Legend2[$target_name]: Outgoing Discards per Second
Legend3[$target_name]: Peak 5 Minute Incoming Discards per Second
Legend4[$target_name]: Peak 5 Minute Outgoing Discards per Second
ShortLegend[$target_name]: &nbsp
Title[$target_name]: $sysname -- $if_description -- Discards
PageTop[$target_name]:  <H1><font
color="#0000FF">$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="";
}

#######end template##########

-----Original Message-----
From: Andrew Werbowy [mailto:Andrew_Werbowy at cbc.ca]
Sent: Thursday, January 09, 2003 2:55 PM
To: mrtg at list.ee.ethz.ch
Subject: [mrtg] target_lines and template


I am trying to monitor broadcast and multicast IN & OUT on Cisco 6513
switch. Switch has over 200 ports Gi ports I would just hate to go and
manually cut and paste ODIs.
When I run MRTG I would like to create the cfg file with this target line:
Target[$target_name]:
.1.3.6.1.2.1.2.2.1.12.$if_ref&.1.3.6.1.2.1.2.2.1.18.$if_ref:$router_connect
 
Also, I know that I can use --if-template template-file switch (Perl
script). I just need little help with this Perl scrip.
 
Did anybody tried this?
 
Andrew (who needs to learn Perl scripting)


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

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



More information about the mrtg mailing list