Graphing and Monitoring With Cacti

  • (4.0)

Cacti is a go-to tool for DevOps engineers who want a complete network graphic solution that handles the power of RRDTool’s data storage and graphing functionality. With its intuitive interface, Cacti is perfect for every job, from LAN-sized installations to complex networks with hundreds of devices.

I think of Cacti as the granddaddy of Graphite. It is just like a round robin database–based statistics graphing tool primarily targeted at network equipment using SNMP (Simple Network Management Protocol). It’s not trendy and it’s not written in Node, so why would you consider it? Cacti is a great fit when you need to poll devices to gather information instead of having them report data in. The configuration is centralized to the server it runs on, and for the most part, it Just Works™.

Cacti provides the Web UI that you need to get up and going quickly, including user, device, and graph management. For the backend, Cacti leverages RRDTool to store the time-series data collected from all the devices that you have configured.

Enthusiastic about exploring the skill set of Devops? Then, have a look at the DEVOPS TRAINING  together additional knowledge. 

RRD is convenient for storing this data for a set period of time, as the file never grows. Cacti handles longer retention by storing data in multiple round robin archives (RRAs). RRAs define how many data points to store (Rows) over a specific length of time (Timespan), and how to aggregate that data (Steps). Steps is the number of data points to average into one data point for that RRA.

You can, of course, adjust the defaults as well as create your own RRAs for 18 months, 2 years, or any other time span that you want. The important items to note here are the Steps and Rows. The step size defines how many data points are aggregated into one data point in the RRA. Timespan defines how many seconds to use while creating the actual graph from the data.

One of the strengths of Cacti is template-based configuration, which allows for excellent customization. To start, there are templates for different types of devices called Host Templates. The Host Template defines which Graph Templates are associated with a certain type of device. For example, there is a built-in Host Template named Cisco Router. When you assign this to a device, Cacti knows which graph templates are relevant. It would quickly become overwhelming if you had to sort through the entire graph template list!

So how would Cacti know how many ports your switch has? The short answer is that Cacti asks the device using SNMP or another custom Data Query. Yes, SNMP is getting long in the tooth, but it’s still a quick and easy way to get structured data, and that’s where Cacti’s Data Queries come into play. Data Queries like SNMP – Interface Statistics know that there is an index value within the result and use that to walk through the results and gather the relevant information. If you have the data that is not available via SNMP, Cacti supports custom scripts that are run on the server to collect data via whatever means required.

Configuring a new device is done through a simple web form that asks a lot of questions, but it boils down to Description, Hostname, and Host Template. Most other settings can be inherited from the system-wide defaults, such as timeouts and the SNMP connection details. When configuring SNMP on the remote hosts, be sure to change the community and not to use the default of “public.” It is also strongly recommended to limit which hosts can query SNMP data or even what data those hosts are able to see.

Once you have successfully created the host, you’ll be redirected to the details of that host and have the option to create graphs. Clicking on that link brings you to a page listing the Graph Templates, that are associated with the device. Simply check the box next to the graphs that you want to create and click Create.

Within the next five minutes (the default polling interval), you should start seeing new data being graphed for the device you have just created. Here is an example of Hourly graph for a very low-usage switch port. The stair steps are due to the default polling cycle, which at five minutes is probably a bit too long for today’s standards.

Frequently asked Devops Interview Questions

The green area is the inbound traffic, and the blue line represents the outbound. This graph template also includes the 95th percentile (not actually visible on the graph) –a very common way of billing network traffic, which is usually bursty in nature.

You can easily look at graphs for a specific host, but that’s not always the most useful way to see the data. Another feature of Cacti is called Graph Trees. Graph Trees allow you to create a folder-like structure for sorting and viewing your graphs. Want to look at the network throughput of all of your Raspberry Pis at once? No problem! Here we create a Switch heading in the Default Tree that only contains graphs we care about:

To view all our hard work, we move away from Console to the Graph view in Cacti. These two modes distinguish configuration from normal use and slightly change the interface. Don’t worry, though: it’s just clicking what looks like a tab at the top of the page to toggle back and forth.

This is the Graphs view of Cacti, which contains the Graph Tree on the left, a quick filter across the top, and the resulting graphs in the main body. This is also where Cacti shows some of its age. While the page is mostly dynamic content, there is no AJAX in use, so the page refreshes via a meta tag, and you cannot directly interact with the graphs to change the time range you’re looking at.

If you’re paying close attention, you might have noticed that these graphs are for the Last Hour and are showing data from the Hourly RRA. If you want to see all the time periods for a specific graph, just click on it and you will be taken into the entire stored history of that data. This is very useful for identifying trends over time, which hopefully lets you plan for future growth.

Key Features:

  • Unlimited number of graph items can be defined for each graph optionally utilizing CDEFs or data sources from within Cacti
  • Automatic grouping of GRPRINT graph items to AREA, STACK, and LINE for quick graph item resequencing
  • Supports RRD files with more than one data source and can use an RRD file stored anywhere on the local file system
  • User-based management for creating users and assigning different levels of permissions
Explore Devops Sample Resumes! Download & Edit, Get Noticed by Top Employers!Download Now!


Popular Courses in 2018

Get Updates on Tech posts, Interview & Certification questions and training schedules