[mrtg] Re: Using External Script w/ RouterName or RouterUptime target

Eric Brander Eric_Mailing_List at rednarb.com
Wed Aug 4 20:10:36 MEST 2004


Grossman, Benjamin wrote:

> Can anyone tell me if it is possible to use a custom external script with
> either of these Optional Keywords?
> I am looking for a quick way to add some text to the generated web page
> based on the specific OS version of the specific device; and this looks like
> a reasonable place to hook it in for a quick-fix.
> 
> Or other suggestion for good ways to go about this.

Benjamin,

I'm not certain exactly what you're looking for but it seems this 
addresses it. You should be able to output the uptime and name of the 
target in your script, and therefore pass it to MRTG on lines 3 and 4 
respectively.

 From the manual:

External Monitoring Scripts
     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.

If you want to use a backtick in the command name this can be done but 
you must escape it with a backslash ...

If your script does not have any data to return but does not want mrtg 
to complain about invalid data, it can return 'UNKNOWN' instead of a 
number. Note though that only rrdtool is realy equipped to handle 
unknown data well.

HTH,

Eric Brander

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