[mrtg] Re: Get a graph from an external source

DANIEL MAGNUSZEWSKI dmagnuszewski at mandtbank.com
Wed Jul 14 21:09:41 MEST 2004


>From my experience, you need to have the following outputs for all
external scripts:

<manual>

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. 

</manual>

Here's an example of necessary output for your script:

shell#>./etc/script_mrtg/cat_rw.sh
137246
137246
uptime
targetname
shell#>

>From this point, you can then choose to only graph either the incoming
or outgoing (value1 or value2) which are the same value. I use 14all.cgi
as my frontend, and the following is a config that just graphs the first
value (aka 'incoming bytes count'):

Target[target]: `/usr/bin/perl /usr/scripts/script.plx`
Title[target]: Mail Inbound Statistics
WithPeak[target]: wmy
Background[target]: #FFFFFF
MaxBytes[target]: 50000
AbsMax[target]: 50000
YLegend[target]: Mail Messages
Options[target]: nopercent,gauge,integer,noo
LegendI[target]: &nbsp;Number of Incoming Mail Messages:
LegendO[target]: &nbsp;Number of Incoming Mail Messages:
Legend1[target]: &nbsp;Number of Incoming Mail Messages:
Legend3[target]: &nbsp;Maximal Number of Incoming Mail Messages:
PageTop[target]: <H1> Mail Inbound Statistics
 <BR></H1>
 <TABLE>
   <TR><TD>Maintainer:</TD><TD>Joe Schmoe</TD></TR>
  </TABLE>

Also, to customize your graph, I'd recommend looking at the
Options[target] section of the docs.

Hope this helps.


Daniel Magnuszewski
CCNA
M & T Bank
dmagnuszewski at mandtbank.com

>>> "Stefano Giraldo" <stefano at neotokyo3.it> 7/14/2004 11:45:35 AM >>>
My script cat_rw take a value from a router,
as wrote on manual MRTG need only one value
to generate a graph, so my script output is only
one value.

This is what i put in mrtg.cfg file:

Include: /etc/script_mrtg/template.mrtg

And this is template.mrtg:

Target[router_name]: `/etc/script_mrtg/cat_rw.sh`
AbsMax[router_name]: 1000000
MaxBytes[router_name]: 500
WithPeak[router_name]: ymw
Options[router_name]: growright, gauge, absolute
ShortLegend[router_name]: Load
YLegend[router_name]: Load
Title[router_name]: Load
PageTop[router_name]: <H1>Load</H1>
  <TABLE>
    <TR><TD>System:</TD><TD>router_name</TD></TR>
    <TR><TD><FONT COLOR="#00FF00">In</FONT>:</TD><TD>Load 0</TD></TR>
    <TR><TD><FONT COLOR="#0000FF">Out</FONT>:</TD><TD>Load 1</TD></TR>
  </TABLE>

And cat_rw script give values near this:
137246

Now, when I restart MRTG it give theese errors:

Immediatly after the restart:
WARNING: Problem with External get '/etc/script_mrtg/cat_rw':
   Expected a Number for 'out' but nothing'

And after the processing of all router interfaces under monitoring:
ERROR: Target[router_name][_OUT_] ' $$target[156]{$mode} ' did not eval
into
defined data
WARNING: Skipping Update of router_name, outlast is not defined

Someone know why?
And why MRTG ask me for two values (IN and OUT)
when Tobi wrote that only one value is needed?

Thank's a lot for any suggestions.

Bye,

        Ste.

----- 
Stefano Giraldo
I.NET S.p.A. - Operations Department
Via Darwin, 85 20019 Settimo Milanese (MI), Italy
----- 

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