I wanted a quick way to skim through a group of similar graphs and have things needing attention jump out at me. I like using auto-scale graphs to see as much detail as possible. With it though, spikes are meaningless unless you take time to look at the scale on the left. OK for a couple of graphs, but if you want to look at the circuit utilization on 40 circuits, it gets to be more time consuming.

After 3 days of pulling my hair out fighting with data sources and CDEF's, I finally got this going. I'm using it for circuit utilization, but it could be massaged into pretty much anything. The example below isn't the most exciting... It's the weekend, so there's not much action on any of the circuits at the moment, but you can get an idea of what I mean.

Ok, so here's what I ultimately did... I've tried to make this as simple as possible so that anyone can follow it regardless of experience. (I've been a noob too!) That said, this is long.............

You need a lot of CDEF's, so let's do those first. It may be common knowledge, but I finally figured out the hard way that instead of hand building big long CDEF statements, you can just copy a string you've put together in Notepad (or wherever) into a single Custom String and shave a LOT of time off of the process. We'll do it that way.

1) Navigate to the CDEF section of Cacti
2) Click "Add"

1) Give the new CDEF a name. We'll call the first one "Bandwidth Percentage - 0 to 10%"
2) Click "Create"

1) We now have a new CDEF, but no formula defined. Click "Add" to enter a new statement.

1) Here's where the shortcut comes in. Change the CDEF Item Type to "Custom String".
2) Copy the string below and paste it into the "CDEF Item Value" field.

This one may be part of Cacti's general install. Check if you have it first...Name: Turn Bytes into Bits

Code:

CURRENT_DATA_SOURCE,8,*

All right. That takes care of entering the CDEF's. Before we leave them completely though, I want to explain a couple of things... I tried hopelessly for many many hours trying to get various combinations of the special "All Data Sources, No Dup's" and "Similar Data Sources, No Dup's" to work. I could get close sometimes, but it never quite worked. I ultimately placed variables in the CDEF (Notice the two sets of "a" and "b" in the code below... That's them).

These point to the data sources (Traffic_in and Traffic_Out) in the graph template. That in mind, it is important that if you go off and make your own graph template that you keep in mind the order that you enter your data sources. If you do something similar with 3 data sources for example, you will need to modify the CDEF to include a, b, and c. Or if you add a data source first that precedes two that you do want to be calculated, you'll need to change your variables in the CDEF from a & b to b & c. If this makes no sense to you, fear not... The graph template I used is included in this tutorial and it should not matter to you. Just keep this in mind if you venture off on your own!

Enough CDEF's. Onward!

Next you need to download the circ_util.xml attachment in this message and save it to a location of your choosing. We need to use it to import the graph template and save you a little work. I'm going to spare the details, but just go to the "Import/Export" section of Cacti's menu bar, select "Import Templates", browse to the folder you saved the file to, select "circ_util.xml", then click the "Save" button. You should see a screen showing the successful import.

Because of that, you'll probably get some wacky colors if you haven't done the same. It is not necessary to resort your colors, but you probably will want to go back into your new graph template and change the colors of each line into something that makes more sense. Mine looks like this:

If you know what you're doing, you should be able to manually make graphs at this point. I went ahead and made this part of the SNMP Interface Statistics Data Query though so that it is easily reachable when I'm adding new devices. Let's add that...

1) Give it a meaningful name. I chose "Circuit Utilization - Summary". This is what will show up in the drop-down menu when making new graphs.2) Select the graph template. If you've imported mine, it should be called "Interface - Circuit Utilization Summary"3) Select the "ifInOctets (Bytes In)" option from the drop-down to match this up with the "traffic_in" Data Source.4) Select the "ifOutOctets (Bytes Out)" option from the drop-down to match this up with the "traffic_out" Data Source.5) To help keep your Data Sources organized, give it a name here to make it recognizable and unique. I chose:

Code:

|host_description| - Ckt Util - |query_ifName|

6) Enter the key-word "name" here (no quotes).7) Click the "Add" button.8) Along similar lines as above, you will want for your graphs to have a meaningful and unique name. Enter as many titles as you'd like, but take note that Cacti always uses the one at the top of the list when making new graphs, so you may have to come back and re-sort these depending on your needs at the time. I added a ton, but chopped the list down to a couple for the screenshot below. In this case, I would go in and make new graphs from my "Atlanta B" router... Adding 10 - 15 VPN tunnels to this graph template. Each graph would be created called "Circuit Utilization Summary - Dixie to Atlanta "B" SomeTunnelName". I then go back in under Graph Management and change my generic "Dixie" to the appropriate city for each graph. So an example of what I entered here is:

Code:

Circuit Utilization Summary - Dixie to Atlanta "B" |query_ifDescr|

9) Enter the key-word "title" (again, no quotes) here.
10) Click "Add".
11) Once you have added all of the template names and graph titles that you need, click the "Save" button.

Now when you go to add a new device (or modify an existing one) and choose to "Create Graphs for this Host" you will see "Circuit Utilization - Summary" in your option of graphs to create assuming that you have chosen a Host Template ("Cisco Router", "Windows 2000/XP Host", etc.) that uses the "SNMP - Interface Statistics" Data Query to scan the host for interfaces that it has.

I'm pretty sure that encompasses everything that I did. I do have one last note though... In Cisco-world (and others, I'm sure) if you are doing this graph for tunnel interfaces (or other non-physical ones), you will need to modify the tunnel interface by adding the "bandwidth x" (where "x" is the speed of the circuit in kilobits... 1000 = 1Mb) line to each tunnel. I've used Cacti's |query_ifDescr| command extensively to obtain the bandwidth necessary for the math to calcualte the percentage used. Most physical interfaces should return a value to this request just fine w/o any extra work, but keep it in mind on tunnels and serial sub-interfaces.

I hope that you have found this useful! I need to throw in the disclaimer that this tutorial was written with the assistance of a few beers... I think I covered everything I did, but I will edit it accordingly if need-be.

I've got the graphing mentioned above working, but it seems to combine the input/output for an aggregate % utilization which ends up going over 100%, and could actually reach 200% since the connection is symmetrical and full duplex.

Example:

I haven't looked at the code much yet, but noticed this to be a problem. I will be looking into a way to graph input/output separate.

Dude you rock!! that is all I have to say about your technical writting skills.

Now for some questions.
1.) After creating a graph for an existing device I get an error message under Graph management.
4 [main] rrdtool 1244 handle_exceptions: Exception: STATUS_ACCESS_VIOLATION
and no graph created

I believe I have followed your steps carefully. Please let me know where I may have gone wrong.

What version of RRDtool? Please run a pass of viewing the graph in DEBUG mode from "Graph Management", and also post your CACTI2RRD line from the log file. Also, please TAR your RRD file(s) and attach as well.

Remember to change logging to LOW or NONE afterwards.

TheWitness

_________________True understanding begins only when we realize how little we truly understand...

I was asked at work to produce a color coded graph for our ops guys so that they could report when utilisation was over a certain level, but we needed to check if it was inbound or outbound traffic. we ended up using a three colour system for 0-50%, 50%-75% and 75%-100% but in keeping with this post I have shown it in 10% increments. The first attachment is what we ended up with for our pilot.

The second attachement is of our graph template, Items 1 to 12 are as per the original post and will show inbound traffic on the positive Y axis. Items 13 to 24 show the outbound on the negative Y axis. The CDEF for item 13 need to be set to negative values so it is.

b 8 * -1 * (negative bytes to bits rather than positive)

This produces the bits per second in the negative plane, and was already defined in my copy of cacti 0.8.6f. The following CDEFs are used to get correct color and values.

As an example the last attachement is how the item is defined in my graph template.

I hope this helps and make sense as I have downed several beers trying to work out how to post the graphics. I am a bit of a forum newbie!

Attachments:

File comment: The graph is of a 2Mb circuit, you may want to add additional text and detail to the graph but this was our first pass so detail was minimal.Cacti_html_m2e902751.gif [ 19.59 KiB | Viewed 63897 times ]

I may have chugged a few too many beers since I last looked at all of this (I've had to back-burner the monitoring project for a few months), but I have fuzzy memories of wondering the same thing about the NEGINF function. I believe that I tried it without that and found that the graph looked as if you had flipped it vertically... Everything that is colored/plotted became white space, and all of what used to be white space became colored.

by my understanding, (and I'm the first to admit that I don't know much about CDEF's myself) if both IF's are true, it get's plotted (by whatever NEGINF is doing) and of course if either IF is not true, the whole function is false and no action is taken. In theory, the CDEF's are lined up in a way that there can not be a value that one (and only one) CDEF does in fact have both IF's match.

Who is online

Users browsing this forum: No registered users and 3 guests

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum