[HOWTO] Sexy Traffic Graphs

If you figure out how to do something interesting/cool in Cacti and want to share it with the community, please post your experience here.

Moderators: Moderators, Developers

Author
Message
ptaylor874
Posts: 45
Joined: Fri Jan 04, 2008 11:45 am

[HOWTO] Sexy Traffic Graphs

#1 Post by ptaylor874 » Wed Jan 23, 2008 1:10 am

Ok - Maybe not "Sexy", but better looking... :)

I've not used Cacti for very long, so perhaps this is a common thing people do that I've not seen, but I thought I'd let everyone else know anyhow.

Personally, I didn't like the default Traffic Graphs in Cacti. I just upgraded to version 0.8.7a, and found that I had the new opacity features, so I played around with them for quite some time, but just couldn't come up with two areas that looked decent when they overlapped. Finally, I came upon a graph on (of all things) a political website that looked great and gave me an idea...

Graph the same data twice - Once as a 100% opaque line, and again as an area with 10% opacity. This would (at least in theory) give a nice solid edge to the lightly colored area, and the areas would blend together fairly well. (I first did this on a different graph and used red and blue - Makes a nice purple!) The Green and Blue don't blend quite as nicely, but it still looks very good.
Attachments
ishot-3.png
Configuration screenshot
ishot-3.png (24.77 KiB) Viewed 70360 times
ishot-1.png
Sexy Traffic Graph
ishot-1.png (51.91 KiB) Viewed 70360 times

User avatar
gandalf
Developer
Posts: 22375
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

#2 Post by gandalf » Wed Jan 23, 2008 7:39 am

Thank you for your contribution. But you definitively should turn green into deep red to make it more sexy :D :lol:
Reinhard

LightwaveNet
Posts: 2
Joined: Tue Jan 23, 2007 12:43 pm
Contact:

export template please

#3 Post by LightwaveNet » Thu Jan 31, 2008 9:46 am

Can someone who has implemented this export a graph template for it please. I seem to have goofed. (or some other change I made recently borked everything.) Trying to narrow down which :p

Oh finaly found it. I forgot to add a color to the traffic_out line added :p

hosierd
Posts: 19
Joined: Wed Jun 09, 2004 10:55 am
Location: Rockville, Maryland

Re: [HOWTO] Sexy Traffic Graphs

#4 Post by hosierd » Mon Mar 24, 2008 1:29 pm

[/quote]Graph the same data twice - Once as a 100% opaque line, and again as an area with 10% opacity. This would (at least in theory) give a nice solid edge to the lightly colored area, and the areas would blend together fairly well. (I first did this on a different graph and used red and blue - Makes a nice purple!) The Green and Blue don't blend quite as nicely, but it still looks very good.[/quote]

Great looking graphs! Thanks for the tip.

How did you get the legend to line up so well ?

Thanks.

Doug

User avatar
gandalf
Developer
Posts: 22375
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: [HOWTO] Sexy Traffic Graphs

#5 Post by gandalf » Mon Mar 24, 2008 4:43 pm

hosierd wrote:How did you get the legend to line up so well ?
Check <HR> of the last Graph Item.
Reinhard

wishbone
Posts: 5
Joined: Thu Dec 14, 2006 7:11 pm
Contact:

Re: [HOWTO] Sexy Traffic Graphs

#6 Post by wishbone » Tue Mar 25, 2008 12:30 am

hosierd wrote: Great looking graphs! Thanks for the tip.

How did you get the legend to line up so well ?

Thanks.

Doug
It's all in the font choice. You need to select a font that is very "monospaced".

BTW thanks for the tip. The graphs look VERY nice. As soon as the ubuntu packages catch up, I'll be trying this for sure.

ben_c
Cacti User
Posts: 203
Joined: Mon May 14, 2007 8:12 pm
Location: Melbourne, Australia.

#7 Post by ben_c » Tue Apr 08, 2008 9:34 pm

This is handy to know, but i'm interested if this increases processing load on the box as it has to render two lines instead of just the one line/area?

I always need to consider this with a large number of datasources.

User avatar
gandalf
Developer
Posts: 22375
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

#8 Post by gandalf » Wed Apr 09, 2008 12:40 pm

ben_c wrote:This is handy to know, but i'm interested if this increases processing load on the box as it has to render two lines instead of just the one line/area?

I always need to consider this with a large number of datasources.
IMHO, no problem. Graph rendering is done on request only. And you hopefully will never create all 16k graphs in one run
Reinhard

Kilrathy
Posts: 11
Joined: Thu Nov 27, 2008 3:38 am

#9 Post by Kilrathy » Thu Dec 04, 2008 1:41 am

Okay, it's an very old thread, but maybe someone likes my "updated" version of sexy graph also! :)

What I added is, that my graphs has a positive and negative site - so outbound traffic is negativ and goes "down" :)
But first we need som preps:

First you need to create a new CDEF, as I always take graphs with Bits, I made a new CDEF "Turn Bytes into Bits -1" - as you see on the picture, the only thing I changed is a - in the front of the 8.

Image

Second, we edit or duplicate, what ever you want, the graph template "Interface - Traffic (bits/sec)". For coloring you can do it like ptaylor874 described it.

Then change the Auto Scale Options to Use --alt-autoscale (ignoring given limits) as shown on the picture.

Image

Third, you need to change for every(!) outgoing item the CDEF to your new created -8 CDEF in the first step.

Image

Save your new graph template and look your results, if you did everything right (and I didn't miss someting :lol: ) you should have graphes like these:

Image

Cheers,
Kilrathy

User avatar
gandalf
Developer
Posts: 22375
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

#10 Post by gandalf » Sun Dec 07, 2008 2:09 pm

This looks nice, indeed.
My recommendation would be to add a LINE1 associated with the MAX CF of both in/out (out to the negative y-axis for sure). This way, you see both AVERAGEs (related to total traffic transferred) as well as MAX (related to top if usage) in one graph. The effect is seen on historical vies only.
This would be my favourite for the standard cacti traffic graph!
Reinhard

User avatar
danno
Posts: 34
Joined: Wed Feb 16, 2005 2:35 pm
Location: Boca Raton, FL
Contact:

#11 Post by danno » Mon Dec 15, 2008 1:24 pm

excellent work!

I have three remaining problems-

-I'm using the 95th percentile traffic, and I noticed that the numbers for the negative graphing are actually negative numbers, unlike yours. I'm looking for 95th percentile on both inbound outbound traffic separately. Maybe I'm asking for too much :)


- I can't get the equivalent 95th percentile line for the negative graphing to work properly... it just uses the 'positive' number and overlaps the actual

- The maximum outbound appears to give an incorrect amount.

Attached is a typical graph from where I'm currently at. I appreciate any insights offered.
Attachments
graph_image.php.png
typical display of my current configuration.
graph_image.php.png (30.35 KiB) Viewed 59643 times

Findarato
Posts: 29
Joined: Wed Feb 06, 2008 2:56 pm

#12 Post by Findarato » Tue Dec 16, 2008 2:34 pm

you dont have to change the legend's values to -, just the graphing parts.
[b]Cacti Version[/b] - 0.8.7d [b]Plugin Architecture[/b] - 2.4 [b]Poller Type[/b] - CMD.php [b]Server Info[/b] - Linux 2.6.18-164.9.1.el5 [b]Web Server[/b] - Apache/2.2.3 (CentOS) [b]PHP[/b] - 5.1.6 [b]PHP Extensions[/b] - libxml, xml, wddx, tokenizer, sysvshm, sysvsem, sysvmsg, standard, SimpleXML, sockets, SPL, shmop, session, Reflection, pspell, posix, mime_magic, iconv, hash, gmp, gettext, ftp, exif, date, curl, ctype, calendar, bz2, zlib, pcre, openssl, apache2handler, dbase, gd, mysql, mysqli, PDO, pdo_mysql, pdo_sqlite, snmp[b]MySQL[/b] - 5.0.77 [b]RRDTool[/b] - 1.4.2 [b]SNMP[/b] - 5.3.2.2

User avatar
danno
Posts: 34
Joined: Wed Feb 16, 2005 2:35 pm
Location: Boca Raton, FL
Contact:

#13 Post by danno » Tue Dec 16, 2008 4:39 pm

done. That changes the hard values- thanks!

hamish
Posts: 29
Joined: Tue Aug 05, 2008 7:40 am
Location: London

#14 Post by hamish » Fri Jan 09, 2009 10:57 am

Does anyone else get borked graph definitions when you edit existing graph templates to make them look like this?

I've had endless problems with graphs that stop working when I add lines or transparent areas that are duplicates of existing data templates... Mostly ahere the graph seems to lose the link between the data template and the data query... Or is it that the data query loses the link between the data template and the XML attribute...

Anyway... It's B:L*&^Y annoying...

H

User avatar
danno
Posts: 34
Joined: Wed Feb 16, 2005 2:35 pm
Location: Boca Raton, FL
Contact:

#15 Post by danno » Fri Jan 09, 2009 1:12 pm

Are you sure to place it all in the right order? Not saying I would know that misordering it would cause the problem, but just being sure that you have it in order anyway.

Post Reply