Re: Doing math on multiple datasources and graphing result

Paolo Cesare BERVA <[email protected]> Thu, 10 Jan 2008 08:53:05 +0100
Newsgroups gmane.network.cricket.user
Message-ID <[email protected]>
Clarke Morledge wrote:
> I am trying to figure out if Cricket can do some math on multiple 
> datasources and somehow graph the result along with other datasources 
> in a single graph.
> 
> Let's say part of my config file looks like this:
> 
> datasource      linkByteCount
>          ds-source   =   snmp://%snmp%/linkByteCount.%inst%
>  	desc        =   "Lower 32 bits of byte count"
> 
> datasource      linkByteCountHi
>          ds-source   =   snmp://%snmp%/linkByteCountHi.%inst%
>          desc        =   "Upper 32 bits of byte count"
> 
> datasource      linkReTxByteCount
>          ds-source   =   snmp://%snmp%/linkReTxByteCount.%inst%
>          desc        =   "Retransmitted Bytes"
> 
> Basically, instead of giving me a single 64-bit counter for "byte count", 
> the vendor decides to give me only two, 32-bit SNMP mib variables that I 
> must combine together to form the 64-bit value.
> 
> Ideally, what I'd like to do is something like this in Reverse Polish 
> Notation (RPN):
> 
> ByteCount = linkByteCountHi,2,32,*,linkByteCount,+
> 
> and then create a targetType:
> 
> targetType      databytes
>    ds  =  "ByteCount, linkReTxByteCount"
>    view  =  "Bytes: ByteCount linkReTxByteCount"
> 
> and then graph a target with it.  Unfortunately, I am unable to figure out 
> how to combine two datasources together with the extra math to 
> create a new datasource to make this happen.
> 
> I would settle for some RPN work using either "mtargets" or using "scale" 
> on the graph, but I haven't been able come up with anything useful.
> 
> I could do this with the ds-source that uses EXEC to call a script that 
> collects the SNMP values for me and then does the math to create a new ds, 
> but it would be a whole lot cleaner if I can do it all inside of Cricket 
> and not have to mess with an external script.
> 
> Does anyone have any suggestions?
> 
> Thanks.
> 
> Clarke Morledge
> College of William and Mary
> Information Technology - Network Engineering
> Jones Hall (Room 18)
> Williamsburg VA 23187
> 
Hi Clarke,
I think you are looking for something like rrd-ds-type = COMPUTE
You can find it documented in file CHANGES of cricket 1.0.5 tarball.

In the specific case:

datasource ByteCount
         rrd-ds-type = COMPUTE
         rrd-cdef    = ds1,2,32,*,ds0,+

targetType      databytes
#               ds0             ds1            ds2          ds3
     ds  =  "linkByteCount,linkByteCountHi,ByteCount,linkReTxByteCount"
     view  =  "Bytes: ByteCount linkReTxByteCount"

Regards
Paolo

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace