graph the ratio of two data sources

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
Hashar
Posts: 3
Joined: Thu Jun 17, 2004 6:20 am

graph the ratio of two data sources

Post by Hashar »

Hello ! :o)

I have cacti working and collecting lot of datas with some standards graphs (cpu temp / load / network use). Now I would like to reuse the existents datasources and produce a graph showing the ratio between them.

A simple example: I would like to graph is the actual bytes / second of an interface vs the number of unicast packets / second.

I firstly created a divide function ( a,b,/ ). Then I created a graph, added the two datasources as Line1 & Line2 then a dummy source that just call the divide function.

The trouble I am facing now is that I am not able to hide the graphing of the two data sources to only keep my special divide function. I tried the comments / gprint / legend statements but then they aren't def= by cacti .

Any idea / howto welcome :o)


Then it could also be used to graphs cpu usage / cpu temp or load / process and hopefully produce some cool graphs :o)
Hashar
Posts: 3
Joined: Thu Jun 17, 2004 6:20 am

Post by Hashar »

And here is a rrdtool call that does that:

/usr/bin/rrdtool graph - \
--imgformat=PNG --start=-86400 --end=-300 \
--title="Localhost - Traffic vs Packets" \
--base=1000 --height=120 --width=500 \
--alt-autoscale-max --lower-limit=0 --vertical-label="" \
DEF:b="/usr/share/cacti/rra/localhost_unicast_in_75.rrd":unicast_in:AVERAGE \
DEF:a="/usr/share/cacti/rra/localhost_traffic_in_24.rrd":traffic_in:AVERAGE \
CDEF:cdefc=a,b,/ \
AREA:cdefc#FF3932:""


Attached is the output of the script.
Attachments
TraVsPack.png
TraVsPack.png (4.22 KiB) Viewed 2627 times
Lux
Cacti User
Posts: 195
Joined: Tue Nov 11, 2003 10:57 am
Location: Luxembourg

Post by Lux »

Set the color of the other data sources to none in your graph template. They should disappear from the graph then.

Mike
Hashar
Posts: 3
Joined: Thu Jun 17, 2004 6:20 am

Post by Hashar »

Yup they disappear but the Y axis still get scaled according to the not showing datas. I am going to look if Y axis can be scaled only according to one data.
Lux
Cacti User
Posts: 195
Joined: Tue Nov 11, 2003 10:57 am
Location: Luxembourg

Post by Lux »

You can always force the scale of the Y axis in the graph template.

Mike
User avatar
o_dupuis
Posts: 18
Joined: Fri Mar 18, 2005 12:55 pm
Location: Paris/France

Post by o_dupuis »

Instead of setting the Y-axis scale.
Create a CDEF that multiplies the Current-data-rouce-item by zero.
Then apply the CDEF to the data you don't want to graph.
Hence you still can use auto scaling, which is handy if what you graph is not a percentage but a rate for example
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests