[mrtg] Script returns 4 values, Plot values via MRTG/routers2?

MMartin at jwpepper.com MMartin at jwpepper.com
Wed Jan 2 20:10:19 CET 2013


Hey Keith,

Here's just a thought, maybe point you in the right direction...

You could have your script take say 4 separate arguments. One argument for 
each of the values you plan to output, I 
think you said you are outputting 4 Values...?

Then You would have 4 "sections" in you .cfg File, one for each of the 
values the script outputs. Then for each "Target:" 
line you would use that specific argument to get that specific value...

For Instance, let's say your script (call it "get_cpu-usage") is printing 
CPU-Usage and the 4 Values printed are:
        Line 1 == 1-Min Avg
        Line 2 == 5-Min Avg
        Line 3 == 10-Min Avg
        Line 4 == 1-Hour Avg

So lets say that is what it prints now (above)... Now what you can do is 
change the Script to print "ONLY 1 Value/ONLY 1 Line" at a time.
So to print the 1-Minute average you call your script like this:
        /path/to/script/get_cpu-usage 1-Min

Where "1-Min" is the argument Passed...

So for each of your sections in the .cfg File, they would use one argument 
for each section's "Target:" Line

So the cfg would look something like these: (*NOTICE THE "argument" PASSED 
in BOLD)

        "Section 1 --- 1-Minute Average":

                Target[target_name]: `/path/to/script/get_cpu-usage 1-Min` 
        #*Backticks `` NOT Single Quotes ''
                Title[target_name]: CPU-Usage 1-Min Average
                :....


        "Section 2 --- 5-Minute Average":

                Target[target_name]: `/path/to/script/get_cpu-usage 5-Min`
                Title[target_name]: CPU-Usage 1-Min Average
                :....


        AND SO ON.............


Hope that helps...
If I've confused you more, just let me know and I'll try to explain a 
little better

Thanks,
Matt





From:   Keith <kwoody at citytel.net>
To:     <mrtg at lists.oetiker.ch>
Date:   01/02/2013 01:32 PM
Subject:        [mrtg] Script returns 4 values, Plot values via 
MRTG/routers2?
Sent by:        <mrtg-bounces+mmartin=jwpepper.com at lists.oetiker.ch>




Have a device that I cannot poll via SNMP for some values. I wrote
a little expect/shell script to get me those values.

I use small perl scripts to poll data and feed those into MRTG but
those just return two values, which are used to build graphs and
work just fine.

The expect/shell script actually returns 4 integer values.
I have read that it appears I can only use RRD and routers2 to be
able to combine and display all 4 values on a graph.

I have seen some examples of how others have done this, but the
few I have seen are polling multiple devices and combining those into
one graph.

I am polling one device that returns 4 values.

How can I create a .cfg file that can take those 4 values and create
one graph?

Thanks,
Keith



_______________________________________________
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/20130102/620c7010/attachment.htm 


More information about the mrtg mailing list