Cacti is an excellent tool to use to monitor your company’s bandwidth usage. It is also very simple to add your routers into your cacti configuration. (Note: If you need instructions on installing cacti, see Install Cacti on CentOS 6). Cacti uses the SNMP protocol (Simple Network Management Protocol) to monitor all sorts of devices and has most of the templates that you need to quickly monitor most network and server devices without installing additional plugins. So, let’s begin to Monitor Cisco Routers with Cacti:
Enable SNMP on the Cisco Router
In order to enable cacti to monitor any device, you must enable SNMP on therouter itself. Nearly every network device will have a method for doing this, Cisco routers in particular require that you have lines similar to the following in your running-config.
SNMP Configuration in Cisco Router:
snmp-server community mycommunitystring RO
snmp-server location 1234 StreetName Parkway, Mycity, Mystate, other location information...
snmp-server contact Jeff Staten 123-456-7890
Other options are also available that will control which IP Addresses can contact your router with SNMP. Review your router’s documentation for more details specific to your router.
Configure Cacti to Monitor a Cisco Router
Once your router is configured to allow SNMP monitoring, you can now add your router to cacti so you can graph your routers CPU, load average, and interface statistics. To begin, login to your cacti administration tool using your browser, and under the console tab, choose Devices and then choose the “Add” option from the top right.
You will need to populate the fields similar to how I did above in the example:
- Description – Give your router’s name here.
- Hostname – Enter your router’s IP address or resolved hostname that cacti can use to contact your router.
- Host Template – Choose the appropriate template for your router. Most routers will work just fine with the “ucd/net SNMP Host” template. However, if your router is a Cisco, you can use the built in “Cisco Router” template that comes by default with cacti.
- Downed Device Detection – Typically any of the available options will work fine.
- SNMP Version – You will need to match this to the version that you enabled in your router. Typically versions 1 and 2 are the defaults.
- SNMP Community – Put your community string here. This is kind of a password that is used to communicate with the device.
- SNMP Port – Port 161 is the default and is more than likely what you should use here.
After you enter the fields above, hit the “Save” button. It should add the device to the cacti host configuration.
If the information that you entered above is adequate for connecting to the router, you should the SNMP information text in the top center of the screen as shown on the right. If you don’t see the SNMP text information, you didn’t connect successfully to the SNMP port of the device. You will need to investigate if the device is configured properly or if you entered the proper connection information.
Create Interface Graphs in Cacti
The next step in graphing your Cisco’s bandwidth and other information in your Cacti server is to create the graphs. To create the graphs, you need to have graph templates and data queries. You can see that I used the “Cisco CPU Usage” graph template and the default “SNMP – Interface Statistics” data query in my example. You can actually see the snmpwalk of that data queries by clicking on the “Verbose Query” option. You will want to see the Success status to be sure that your graphs can get the data it needs.
Cacti – Create Graphs for This Host
Ok. Now it is time to create the actual graphs for your device. You should see the option shown on the right to “Create Graphs for this Host”. Choose this link.
This will bring you to the Create New Graphs page shown above. You can choose from the various interfaces and other monitorable options that cacti found using its snmpwalk of your device. Click the ones that you want to graph and leave the others off the list. Hit the “Create” button when you are done and ready to move on.
You will see a list of the graphs that you chose to create similar to the list shown to the left.
Make the Device Graphs Available
Now that you have done all of the work of getting your router configured with SNMP and added to your Cacti server. You need to add your device to the Graph Trees in your Cacti server so you can view the device graphs under the big blue “graphs” tab.
Choose the “Graph Trees” option under the Console tab.
For organizational purposes, you may want to Add a Graph Tree for your routers. Choose the organization that you want to use in this graph trees area. I chose to create a Graph Tree named “Network Infrastructure” to group my routers under. Whatever you choose, it isn’t permanent. Choose an existing graph tree or create a new one, then select that graph tree and then add your device as a “Tree Item” in your graph tree’s configuration. To add the router device you will want to choose the “Host” option under the “Tree Item Type”. This will make your new device an option under the host drop-down list. Choose the defaults for the other options. Choose the “Create” button when ready.
Viewing Your Cacti Device Graphs
Finally! We are ready to view our graphs. Go to the “graphs” tab on the top, and then navigate through the Graph Tree in the left column to find your device. Clicking on it should show you your device’s graphs. If your device has just been added, there may be no data to display in the graph. Give it 1/2 hour or so and you shoud begin to see data in your graphs like those displayed in the image to the right.
That’s it. You have configured your Cacti server to monitor and graph your Cisco or other router’s network interface usage, load average, and other metrics.