[mrtg] Extreme/GigE template file help

Kevin C Jones kjones at ca.provision.net
Wed Mar 6 21:32:56 MET 2002


Someone must have done this before.  Only 1 (one) of the variables mentioned
in the Template part of the cfgmaker manual @ mrtg.org works.

This is my current temp file (mostly a bastardized template from mrtg.org)
if(not $problem_lines)
 {
   $target_lines .= <<ECHO;


Target[$target_name]: $if_snmp_alias&$if_ref:$router_connect
SetEnv[$target_name]: MRTG_INT_IP="$if_ip" MRTG_INT_DESCR="$if_snmp_descr"
ECHO
;

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

   $target_lines .= <<ECHO;
MaxBytes[$target_name]: $if_speed
Title[$target_name]: $router_name  -- $sysname
PageTop[$target_name]: <H1>$html_desc_prefix$html_if_title_desc --
$sysname</H1>
 <TABLE>
   <TR><TD>System:</TD>     <TD>$sysname in $html_syslocation</TD></TR>
   <TR><TD>Maintainer:</TD> <TD>$html_syscontact</TD></TR>
   <TR><TD>Description:</TD><TD>$html_if_description</TD></TR>
   <TR><TD>ifType:</TD>     <TD>$html_if_type_desc ($if_type_num)</TD></TR>
   <TR><TD>ifName:</TD>     <TD>$html_if_snmp_name</TD></TR>
ECHO
;

   $target_lines .= <<ECHO if defined $if_port_name;
   <TR><TD>Port Name:</TD>  <TD>$if_port_name</TD></TR>
ECHO
;

   $target_lines .= <<ECHO;
   <TR><TD>Max Speed:</TD>  <TD>$if_speed_str</TD></TR>
ECHO
;

   $target_lines .= <<ECHO if $if_ip;
<TR><TD>Ip:</TD>         <TD>$if_ip ($if_dns_name)</TD></TR>
ECHO
;

   $target_lines .= <<ECHO;
 </TABLE>
ECHO
;
 } else {
   $head_lines="";
   $problem_lines="";
   $target_lines="";
   $separator_lines="";
 }

I will admit firsthand I only know what some of this file does, so I COULD
(and likely am) doing something wrong.  Luckily I know purl and so knew how
to correct the code that was at the mrtg site.  Can anyone please give me a
little direction on WHERE in this file I would put in the correct
information to have proper titles on the graph.

Basically I want this in the titles
.1.3.6.1.2.1.31.1.1.1.18.1008

The 1008 is the port number of a particular device and is NOT part of the
mib.  Surely someone out there has done this type of thing before. I pray
this to be true as I am not talking about 1 or 2 devices.  I am talking 400
devices with about 2 dozen or more interfaces on each  So modifying each and
every interface would be a mountain of work.

So far I am thinking that my solution is going to lay in writhing a script
which smnpgets the info I need (because it IS accessible, just NOT via
anything in the template variables or NOT anyway I have been doing it.
Please feel free to correct me) storing the information I want.  And then
pumping that into a perl script to build all the cfg's I need.

In essence IF the template variable DID work the way I wanted. This is what
my template would look like.

if(not $problem_lines)
 {
   $target_lines .= <<ECHO;


Target[$target_name]: $if_snmp_alias&$if_ref:$router_connect
SetEnv[$target_name]: MRTG_INT_IP="$if_ip" MRTG_INT_DESCR="$if_snmp_descr"
ECHO
;

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

   $target_lines .= <<ECHO;
MaxBytes[$target_name]: $if_speed
Title[$target_name]: $router_name $IF_SNMP_ALIAS -- $sysname
PageTop[$target_name]: <H1>$html_desc_prefix$html_if_title_desc --
$sysname</H1>
 <TABLE>
   <TR><TD>System:</TD>     <TD>$sysname in $html_syslocation</TD></TR>
   <TR><TD>Maintainer:</TD> <TD>$html_syscontact</TD></TR>
   <TR><TD>Description:</TD><TD>$html_if_description</TD></TR>
   <TR><TD>ifType:</TD>     <TD>$html_if_type_desc ($if_type_num)</TD></TR>
   <TR><TD>ifName:</TD>     <TD>$html_if_snmp_name</TD></TR>
ECHO
;

   $target_lines .= <<ECHO if defined $if_port_name;
   <TR><TD>Port Name:</TD>  <TD>$if_port_name</TD></TR>
ECHO
;

   $target_lines .= <<ECHO;
   <TR><TD>Max Speed:</TD>  <TD>$if_speed_str</TD></TR>
ECHO
;

   $target_lines .= <<ECHO if $if_ip;
<TR><TD>Ip:</TD>         <TD>$if_ip ($if_dns_name)</TD></TR>
ECHO
;

   $target_lines .= <<ECHO;
 </TABLE>
ECHO
;
 } else {
   $head_lines="";
   $problem_lines="";
   $target_lines="";
   $separator_lines="";
 }

You can see in caps above all I want is $IF_SNIP_ALIAS (which is OID
.1.3.6.1.2.1.31.1.1.1.18.<port> on a Extreme box) in the title. THAT'S it.
However it doesn't seem doable via the "standard" methods.  If I am writing
the template wrong, PLEASE let me know.

Kevin


--
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