# Is it possible show difference between two graphs in cacti?

I have cacti with a lot of graphs (interface statistics) and I need show the difference between two of them. Something like traffic=traffic1-traffic2 where traffic1 and traffic2 are interfaces on two separate switches.

Is it possible?

## 2 Answers

Yes, its possible. For a good example of a similar, but not exactly the same, howto read the following thread and examples:
http://forums.cacti.net/viewtopic.php?t=8532

• looks like not the same. I dont whant 1 graph with several lines, i want 1 graph with 1 line wich calculated as operation on another 2 graphs – Korjavin Ivan Jan 19 '12 at 7:21
• Its the same idea. Its just another CDEF calculation! Read the examples and modify according to your needs! – Mattias Ahnberg Jan 19 '12 at 7:49
• Check the link from the post I pasted above, and you will come to forums.cacti.net/viewtopic.php?t=8415 where you find section 7 a long CDEF. You have to make it a,b,- or whatever keys your values will get. Then you will have a new total, and you graph this as one single line in the new graph, just as you ask for! – Mattias Ahnberg Jan 19 '12 at 7:51
• thank you. I think you right, but i really stupid and after tons of try cant do that. Looks like i need "cdefs steb by step for idiots" – Korjavin Ivan Jan 24 '12 at 8:49
• Maybe gregsowell.com/?p=280 or oss.oetiker.ch/rrdtool/tut/cdeftutorial.en.html can be a good beginning for you? :) Good luck! Its a really powerful tool, so I am sure you will do it with some practice! – Mattias Ahnberg Jan 24 '12 at 10:55

Yes. You need to create a custom cdef.

http://www.cacti.net/downloads/docs/html/cdefs.html

Assuming the DEFs are as such Total = a Used = b The cdef=a,b,- should do. It is position dependant; that's bad. But the cure, a COMPUTE data source, will not be introduced until cacti 088 Reinhard

http://forums.cacti.net/about30395.html

Go to Graph Management->CDEFs

Take a look at

Total All Data Sources

and

x Negate CDEF

.