[mrtg] Re: Can mrtg just read from file instead of SNMP?

Stieers, Ken KStieers at dainrauscher.com
Wed Oct 6 16:55:42 MEST 1999


Clint, 

To use an external script (not an SNMP poll) take the following steps:

1.  Write a script or program that gets your data and has output to STDOUT
(usually the screen) that looks like this:

<in value>
<out value>
<uptime>
<name or description>

Lets say that we call it myscript.pl and that it takes one parameter.
Uptime and name are just strings and I've seen them as a single blank
character as well as full strings.  The script just has to put out 4 lines,
with the first two as integers and the last two as strings. 

2.  Create a cfg file (we'll call it mrtg.cfg) with the Target line that
looks something like this:

Target[router.1]: `myscript.pl myscriptparameter1`

and the other settings as needed. 

3.  Set up cron or some other scheduler to call MRTG with your config file
every five minutes.  i.e it runs the following command line:

MRTG MRTG.CFG 

 

HTH, 

Ken 



> -----Original Message-----
> From: Clint Alexander [mailto:Clint.Alexander at corp.ptd.net]
> Sent: Wednesday, October 06, 1999 9:26 AM
> To: 'MRTG List'
> Subject: [mrtg] Re: Can mrtg just read from file instead of SNMP?
> 
> 
> <quote>
> if you want to monitor something which does not provide data 
> via snmp you
> can use some external program to do the data gathering. 
> The external command must return 4 lines of output: 
>      Line 1 
>           current state of the first variable, normally 
> 'incoming bytes
> count' 
>      Line 2 
>           current state of the second variable, normally 
> 'outgoing bytes
> count' 
>      Line 3 
>           string (in any human readable format), telling the 
> uptime of the
> target. 
>      Line 4 
>           string, telling the name of the target. 
>      Depending on the type of data your script returns you 
> might want to use
> the 'gauge' or 'absolute' arguments for the Options keyword. 
>      Example: 
>       Target[ezwf]: `/usr/local/bin/df2mrtg /dev/dsk/c0t2d0s0`
>      Note the use of the backticks (`), not apostrophes (') around the
> command. 
> </quote>
> 
> Maybe this is what they are talking about.
> This is a quote out of the 'config.html' file
> on the Target[]: section. I read this, and do
> not quite understand what to do in this scenario.
> I want to pretend that none of our routers can
> respond via snmp query, but still build the graphs.
> 
> The config.html does not quite explain how to do this in its entirety.
> Is anyone else familiar with this procedure?
> 
> Clint Alexander
> 
> 
> > This is what I was told, when mrtg runs, it queries the 
> > routers via snmp for
> > information.
> > There was a way that instead of mrtg querying the routers, 
> it can read
> > information (usage) from a file
> > instead if given a switch on the command line. If possible, 
> > you can have
> > mrtg read from a file instead of
> > querying routers for the information, then build the log file 
> > for rateup. We
> > want to build the file mrtg can
> > read from, then build the log files for rateup.  So, in other 
> > words, mrtg
> > will work local on the machine,
> > and not do network requests at all.
> > 
> > Does this make sense ?
> 
> 
> > > You mean you want to make the log files on your own? 
> > > 
> > > Ken 
> > > 
> > 
> > > > Yes, I'm aware that cfgmaker --vendor community at router 
> > mrtg.cfg
> > > > will give u a proper config file. You run ./mrtg mrtg.cfg  
> > > afterward.
> > > > However, I mean, when ./mrtg mrtg.cfg runs, does it not query 
> > > > the routers
> > > > again to pull down stats, and build the log files for rateup?
> > > > This is what we want to make on our own.
> > > > 
> > > >  
> > 
> > > > > MRTG reads its cfg file fromt the disk.  CFGmaker will make 
> > > > > that cfg file by
> > > > > pulling data from the router you want to monitor.  You can 
> > > > > write your own
> > > > > cfg files as long as you do it in the proper format. 
> > > > > 
> > > > > I'm not sure what you mean by a command switch as MRTG only 
> > > > takes one
> > > > > parameter, the cfg file. 
> > > > > 
> > > > > HTH, 
> > > > > 
> > > > > Ken 
> > > > > 
> > 
> > > > > > Curious...
> > > > > > Can you configure mrtg to read configurations from a file, 
> > > > > instead of
> > > > > > querying the router via snmp?
> > > > > > I keep hearing there is a command switch that mrtg 
> uses, but 
> > > > > > I can't seem to
> > > > > > find it.
> > > > > > Does anyone know of this ?
> > > > > >  
> > > > > > Thanks In Advance.
> 
> --
> * To unsubscribe from the mrtg mailing list, send a message with the
>   subject: unsubscribe to mrtg-request at list.ee.ethz.ch
> * The mailing list archive is at http://www.ee.ethz.ch/~slist/mrtg
> 

--
* To unsubscribe from the mrtg mailing list, send a message with the
  subject: unsubscribe to mrtg-request at list.ee.ethz.ch
* The mailing list archive is at http://www.ee.ethz.ch/~slist/mrtg

--
* To unsubscribe from the mrtg mailing list, send a message with the
  subject: unsubscribe to mrtg-request at list.ee.ethz.ch
* The mailing list archive is at http://www.ee.ethz.ch/~slist/mrtg


More information about the mrtg mailing list