[mrtg] Help needed with MRTG

MMartin at jwpepper.com MMartin at jwpepper.com
Wed Mar 14 16:08:15 CET 2012


Hey Nitesh,

I'm not an expert on MRTG but I have been working with it for about 6 
months or so now and have setup quite a few External Monitoring Scripts.
Yes, you can use it with your own scripts to collect data instead of SNMP.

What you do is simply this:
        First just create a script that gets the information that you want 
to collect. 
        As far as I know, as long as the data is numbers you can use 
MRTG/RRDtool with anything.
        The script should have the following lines as it's output...

        Line 1: The current value of the first variable. For most things 
like CPU Usage, or 
                 temperature this is the ONLY line of output that you 
need. The rest are optional. 
                 All of my scripts only have one line of output except for 
one or two that have 2 lines of output.
                 So basically for one that get CPU-Usage my output would 
just be for example --> 92.4   (i.e. For 92.4% CPU-Usage)

        Line 2: The current value of the second variable. This line is 
optional...

        Line 3: A string (in human readable form), telling the uptime of 
the target. This can be blank as it is
                 NOT used when MRTG is running in RRDtool mode. This line 
is optional as well...

        Line 4: A string telling the name of the target. Also, this can be 
left blank as it is NOT used in RRDtool mode.

And that's all you need to do for the script!
For example, I have one that remotely logs into a server runs a couple of 
commands like "vmstat" and outputs the CPU load.
In your MRTG cfg file. The ONLY thing different then a regular MRTG cfg 
file is the "Target[_]:" line.

Here is an example of the Target[_]: line:
 
        Target[192.168.1.1_cpu-usage]: 
`/full/path/to_the/script/get_cpu-usage.pl`     -->  Note that the script 
is surrounded by "backticks/back-quotes"   NOT  "single-quotes" 


I thought I'd throw my 2 cents out there since this forum helped me a lot 
when I started with MRTG.
Hope that helps, let me know if it does.

Thanks,
Matt






From:   nitesh bansal <nitesh.bansal at gmail.com>
To:     <mrtg at lists.oetiker.ch>
Date:   03/14/2012 09:42 AM
Subject:        [mrtg] Help needed with MRTG
Sent by:        <mrtg-bounces+mmartin=jwpepper.com at lists.oetiker.ch>



Hello,

I am new to the MRTG world. I have heard people using MRTG to collect data 
from SNMP enabled devices like routers. I want to use MRTG to work with 
non SNMP devices, i have certain statistical data from my servers like 
number of calls, number of failed calls and use MRTG to display this data. 
Please help me out, i am not able to find any suitable documentation for 
this task.

Regards,
Nitesh Bansal_______________________________________________
mrtg mailing list
mrtg at lists.oetiker.ch
https://lists.oetiker.ch/cgi-bin/listinfo/mrtg

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.oetiker.ch/pipermail/mrtg/attachments/20120314/de0136c7/attachment.htm 


More information about the mrtg mailing list