[mrtg] hwto integrate something external

R Dicaire kritek at gmail.com
Sun Dec 28 03:12:44 CET 2008

On Sat, Dec 27, 2008 at 8:19 PM, Levente Kovacs <leventelist at gmail.com> wrote:
> Could you please point me a documentation describing what should my external
> code emit? How can I integrate my stuff into the MRTG system?

>From http://oss.oetiker.ch/mrtg/doc/mrtg-reference.en.html:

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.


     Target[myrouter]: `/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.
Hope that helps...

aRDy Music and Rick Dicaire present:

More information about the mrtg mailing list