Cacti has been around for over a decade and is a terrific tool for graphing everything on your network from interface traffic to temperature and voltage. Unfortunately the default templates give you bland-looking graphs. Since you’re going to be eying your graphs on a daily basis why not give them a little more pizzazz? The information presented in this post can be also be found by scouring the Cacti forums. I’ve taken the best ideas, added my own enhancements, and consolidated them down to a single step-by-step process.
What Will My Graphs Look Like?
There are a lot of examples of custom graph templates on the Cacti forums (links at the end of this post) with folks doing everything from graphing on the negative axis to using non-conventional colors. It’s all a matter of personal preference, so experiment and find something that works for you.
My graphs stick with the classical Cacti graph colors of green for inbound traffic and blue for outbound.
Here are a few examples of how graphs using my template settings look:
There are five steps for dressing up your graphs…
1. Make full use of your Interface “description” field
Put as much relevant information as you can in the description field for every physical and virtual interface on your devices. You want to know exactly what each interface is connected to when looking at the graphs.
Personally I like to use the following standards for each connection type:
- Port-Channel Interface
hostname: interface1,interface2…interface x
(config-if)# description SW-R03-01A: G0/26,28
- Port-Channel Member
hostname: interface [Port-Channel ID]
(config-if)# description SW-R03-01A: G0/26 [Po12]
- Virtual Port-Channel Member
hostname: interface [vPC ID]
(config-if)# description SW-R08-02A: Te1/1 [vpc10]
(config-if)# description DNS01: eth0
- VLAN Interface
IP Subnet <VLAN-description>
(config-if)# description 10.3.0.0/22 Ads
2. Add leading numerals to the name of each graph template
When you apply multiple graph templates to a host they will be ordered alphabetically. If you have a preference for which types of graphs are displayed first (I want Traffic before Errors), you’ll have to change the graph template name to reflect it.
Easiest way to do this is by adding numerals:
3. Modify the Title field in the “Interface – Traffic (bits/sec)” Graph Template
Add some variables to the Title field and tell Cacti to name all of the graphs it creates accordingly. Please note that you need to un-check the box for “Use Per-Graph Value (Ignore this Value)”, otherwise it won’t be displayed. Here’s the string to paste in:
|host_description| – |query_ifName| – |query_ifAlias| – Traffic
4. Add Graph Template Items
The default look of the “Interface – Traffic (bits/sec)” graphs are to have Inbound traffic represented by green shaded areas and Outbound traffic represented by blue lines. We want to change this so the Outbound and Inbound traffic are both represented by lines and shaded area. In order for this to work, we need to change the opacity of the shaded areas so that they don’t cancel one another out.
So let’s add blue shading to our graph by creating a new AREA Graph Item Type.
From within the “Interface – Traffic (bits/sec)” template click “Add” in the Graph Template Items and configure a new AREA item as shown below and save it.
Let’s repeat the process to add a green line to our Inbound traffic graphs using the settings below and save it.
Note: “Line 1” is a thin line, “Line 2” is medium, and “Line 3” is very thick.
Now let’s reduce the opacity of the AREA Graph Item Type for Inbound traffic from 100% to 20%. We are going to use 20% rather than 10% so the blue shading doesn’t drown out too much of the green when the graphs overlap.
Now that you have everything added in, it’s time to order them properly. Use the up/down arrows and position your new Graph Template Items as shown:
Once you are done save the template.
5. Update Visualization Settings
Now we need to make sure our graphs can display all the useful description information we added to our interface descriptions in Step#1 by changing fonts and increasing the Maximum Title Length.
Go to the Cacti Configuration Settings page and select the “Visual” tab. Adjust the Maximum Title Length, Maximum Field Length, and Font settings similar to the screen shot below. If you want to experiment with different fonts, be sure to use the pango convention for font names.
Note: The secret to getting the legend data in your graphs to line up nicely is by using a mono-space font, such as Courier New and including a Hard Return on the last item in the Graph Template Items. This can be seen in the last screenshot of Step #4 and is denoted as <HR>.
That’s it! You’re graphs should now be looking 10x better than before you started the process! Aren’t you glad you did it?
Problem: The traffic data in my graph is incorrect
- Be sure your graphs are created with the “In/Out Bits (64-bit Counters)” Graph Template
Problem: New graph template names are not appearing on new graphs
- Go back to the Graph Template and open it for editing, but do nothing other than save it. This should re-apply the new names.
- Run the poller_graphs_reapply_names.php script from your cacti installation directory. Be sure to do this from the account cacti is running under so you don’t mess up file permissions.
- Make the Title string listed in Step #3 the default for the “In/Out Bits (64-bit Counters)” Data Query Graph Template. Go to Console ->Data Queries -> SNMP Interface Statistics -> In/Out Bits (64-bit Counters) and set like this:
Although the focus of this post will be Interface Traffic graphs, the principles outlined can be applied to any and all types of Cacti graphs. Enjoy!