[mrtg] Template with if statement based on hardware type?

Shane Presley shane.presley at gmail.com
Tue Sep 26 15:39:35 MEST 2006


Hello,

I use a host template for my switches.  In addition to interface
information, I also gather CPU stats.   So that looks like:

#Host Template#
if(not $problem_lines)
{
my $target_name = $router_name . "-cpu";
$target_lines .= <<ECHO;
Target[$target_name]:1.3.6.1.4.1.9.2.1.58.0&1.3.6.1.4.1.9.2.1.58.0:$router_connect
MaxBytes[$target_name]: 100
Title[$target_name]: $router_name: CPU Load
PageTop[$target_name]: <H1>$router_name CPU Load</H1>
ShortLegend[$target_name]: %
YLegend[$target_name]: CPU Utilization
Legend1[$target_name]: Total CPU in % (Load)
Legend3[$target_name]:
Legend4[$target_name]:
LegendI[$target_name]:  CPU
Options[$target_name]: nopercent, gauge, unknaszero, noo
ECHO
} else {
 $head_lines="";
 $problem_lines="";
 $target_lines="";
 $separator_lines="";
}
#end host template#


However, on SOME of my switches, they also support temperature
readings.  Would it be possible within my template to use an IF
statement that somehow checked the model?  There are several OIDs that
would return a string that contains the model #.

Or would I be better off just using a different template?

Thanks
Shane

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