[mrtg] Re: Getting IP address

Daniel J McDonald dan.mcdonald at austinenergy.com
Fri Oct 31 13:46:51 MET 2003

On Fri, 2003-10-31 at 05:50, Adell Querol, Christian wrote:
> Yes, I have been looking the cfgmaker documentation and I know the
> possibility of get the IP address by cfgmaker, but my two questions refer to
> the operation with manual configuration with target's OIDs.

After fiddling with manual configuration for about 5 years, I've come to
the realization that the best thing is to make a template and run
cfgmaker against the template.
> For example, I want to get data from OID X.X.X.X.X.X.X.X, but this data is
> not a number but is a text. 

But mrtg doesn't graph text.  So, we have to assume that you are going
to turn this text into some sort of number.  You can use the new
ConversionCode feature in mrtg 2.10 to write a perl subroutine that will
convert the text into a number that can be graphed.

> Another example, the OID Y.Y.Y.Y.Y.Y.Y.Y
> contains the duplex mode, but how can I specify the port which I want to
> monitor?
There is a large section of the mrtg manual devoted to this.  The
easiest way, though, is to write a template.  Something like:
# Example 
if (not $problem_lines) {
$target_lines .= <<TONSOSNOT
Target[$target_name]: y.y.y.y.y.y.y.y.y$if_ref
routers.cgi*ShortDesc[$target_name]: $html_if_snmp_name -
bb*host[$target_name]: $router_name
Directory[$target_name]: $directory_name
MaxBytes[$target_name]: 2
Options[$target_name]: guage
LegendI[$target_name]: duplex
LegendO[$target_name]: something else
WithPeak[$target_name]: wmy
Title[$target_name]: $html_if_snmp_name - $html_if_snmp_alias
PageTop[$target_name]: <H1>$html_if_snmp_alias - Why ask Why? </H1>

Be careful not to let any lines wrap - that will drive mrtg batty....

if you called this file "yy.template" you could then run:

/usr/local/mrtg-2/bin/cfgmaker --if-template=yy.template
--if-filter=(not $if_is_ciscovlan and not defined($if_vlanid))
--ifref=name --output=myrouter.yy.cfg
my_obscure_community at myswitch.mydomain.tld:::::2

That if-filter would identify just trunk ports.  Much more elaborate
filters can be written, but that gives you an idea...

> thanks,
> Christian
> -----Mensaje original-----
> De: Koelstra, J. (Jan) [mailto:JKoelstra at minszw.nl]
> Enviado el: viernes, 31 de octubre de 2003 12:24
> Para: Adell Querol, Christian; mrtg at list.ee.ethz.ch
> Asunto: RE: [mrtg] Getting IP address
> Did you have a look in the cfgmaker documentation?
> Look for --ifref=  and/or ifdesc=
> HTH,
> Jan.
> -----Original Message-----
> From: Adell Querol, Christian [mailto:cadell.r at tvcatalunya.com] 
> Sent: Friday, October 31, 2003 11:46 AM
> To: 'mrtg at list.ee.ethz.ch'
> Subject: [mrtg] Getting IP address
> >  I am working with MRTG on W2K. I have some basic questions about MRTG
> > operation.
> > 1- How can I get text data?
> > 	For example, I want to obtain the device's IP address or
> description, 
> > but by default the data is numerical, so which type of data can I use?
> > 2- How can I get port information?
> > 	Explanation: The OID for port information is unique on a device,
> but
> > the device has a lot of ports and I want to specify the information of
> a
> > precise port, for example 	the  duplex information, so how can I
> choose
> > the port?

Daniel J McDonald <dan.mcdonald at austinenergy.com>
Austin Energy

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