Using Graphs to Manage Networks and Devices with Cacti 0.8

Creating graphs

If you are familiar with RRDTool, then you know Cacti is designed to harness the power of RRDTool's data storage and graphing functionality. If you are not, don't worry—Cacti will create graphs without extensive configuration input from users. Built-in graph templates will make your life easier, so it is not necessary to understand the functionality of each field to create graphs for network-attached devices. Each graph stores different sets of parameters that control different aspects of each graph. If you want to know more about RRDTool, please visit

At the time of creating graphs, you will face a bit of a stiff learning curve. Stay on course, it will be over soon and you will be able to create graphs for different devices very quickly. Cacti can create graphs for any SNMP-enabled, network-attached devices. This can be a switch, router, server, desktop computer, printer, IPS, UPS, and so on. Initially, we will not talk about the custom template and the data-query script development for any SNMP-enabled devices. Instead, we will use the default options in Cacti. In order to build a custom template, we need to understand the SNMP protocol and command-line tools of the Net-SNMP application suite. Let's create graphs based on the available templates and devices.

Adding a device

Before we add a graph, we need to add a device for which you want to create the graph. In order to do that, click on Devices under Management. Cacti will open the Devices view panel. It will look like this:

Using Graphs to Manage Networks and Devices with Cacti 0.8

If you click Add in the top right-hand corner, it will open a new form to add a new device. The first two fields, Description and Hostname, are both required for the default configuration. The other fields in the Device section (Notes and Disable Device) can be left as is. If your host template exists in the drop-down, be sure to select the template. Since we are starting with an SNMP-enabled device, if you are not sure which template to select, you can select the Generic SNMP-enabled host template. It is important to know that adding a template to a device will not lock down the device to any specific configuration, as graph templates and queries can be added and removed from a device at anytime. The following screenshot shows how the Add a device form looks.

Using Graphs to Manage Networks and Devices with Cacti 0.8

If you look closely at the drop-down, there are very few templates. But you can add device-specific templates as required. The following web site has an excellent collection of Cacti scripts and templates.

This web site is aimed at providing tips and tricks to Debian users from novice to expert. The owner also collects and updates all sorts of scripts and templates from the Cacti forum for easy access:

Device fields definition

Every device that we add has different attributes and values. The following table will clarify the attributes. It is wise to understand all the fields before adding a device in Cacti.




Giving host a meaningful name. This name will be shown in the first column of the device view panel.


Fully qualified hostname or IP. If a fully qualified hostname is being used such as, Dynamic Name Services (DNS) will be used to resolve the hostname.

Host Template

Host template is responsible for the types of data that need to be gathered from a specific type of host.


Adding notes for the host, anything that is specific to the host.

Disable Host

Check this box to disable all the checks for this device. This means no polling for this device.

Downed Device Detection

NONE: Disable downed device detection.

Ping and SNMP: Perform both tests.

SNMP: Perform SNMP check.

Ping: Use ping method.

Ping Method

ICMP Ping: Perform ICMP test. ICMP on Linux/Unix require root privileges.

TCP Ping: Perform a TCP test.

UDP Ping: Perform UDP test.

Ping Port

This option is available for only TCP and UDP Ping. Define the port number here and make sure the firewall is not blocking that port.

Ping Timeout Value

This value is measured in milliseconds. After the defined time, the test will fail.

Ping Retry Count

Defines how many times Cacti will ping a host before failing.

SNMP Version

Version 1: Supported by most of the SNMP-enabled devices. One thing you need to remember is that it doesn't support a 64-bit counter.

Version 2: This is also known as SNMPv2c. Supported by most of the SNMP-enabled devices.

Version 3: Version 3 supports authentication and encryption.



SNMP Community

SNMP read community for the device.


UDP port number to use for SNMP (default is 161).

SNMP Timeout

Maximum number of milliseconds Cacti will wait for an SNMP response (does not work with PHP-SNMP support).

Maximum OID's Per Get Request

This feature only works when you use the spine poller. Specifies the number of OIDs that can be obtained in a single SNMP get request. This is a performance feature.

SNMP Username (v3)

SNMP v3 username for the device.

SNMP Password (v3)

SNMP v3 password for the device.

SNMP Auth Protocol (v3)

SNMPv3 authorization protocol. There are two options: MD5 which is default and SHA.

SNMP Privacy Passphrase (v3)

Passphrase specifies privacy when encryption happens for all SNMP packets. You can choose the encryption protocol below.

SNMP Privacy Protocol (v3)

DES is the default option, you can also use AES. DES means Data Encryption Standard. DES encryption is 56 bits long. AES means Advance Encryption Standard. AES keys can be 128, 192, or 256 bits long.

SNMP Context

SNMP Context needs to be used when the same OID tree is proxied to multiple devices. When using View-Based Access Control Model (VACM), it is possible to specify an SNMP Context when mapping a community name to a security name with a com2sec directive, with the group directive and the access directive. This allows defining special access models.

I have used following information for the device, which is a computer running Cacti:

  • Description: CactiBox
  • Hostname:
  • Host Template: Local Linux Machine
  • Downed Device Detection: Ping and SNMP
  • Ping Method: UDP Ping
  • Ping Port: 23
  • Ping Timeout Value: 400
  • Ping Retry Count: 1
  • SNMP Version: Version 2
  • SNMP Community: Public
  • SNMP Port: 161
  • SNMP Timeout: 500
  • Maximum OID's Per Get Request: 10 (this performance function does not work if you don't use the spine poller).

After creating the device, Cacti redirects you to the same form with additional information. If it is successful, a successful information screen will be shown:

Using Graphs to Manage Networks and Devices with Cacti 0.8

If you see an SNMP error, there is a SNMP problem between the device running Cacti and the device you are attempting to graph.


You can use snmpwalk in the command line to debug the issue. The following command will print interface table. Before using snmpwalk, check whether snmpd is running or not and that it is configured to listen from other interfaces.

snmpwalk -v 2c -c public sysUpTimeInstance

If the SNMP implementation is working on your machine, you will see an output like the following (I have just shown one portion of the output):

DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (13072) 0:02:10.72

For further information on snmpwalk please visit the following web site

At the bottom of the previous image, you will see two more options:

  • Associated Graph Templates
  • Associated Data Queries
Using Graphs to Manage Networks and Devices with Cacti 0.8

If you have selected host template in the previous page, then you may see a few items in both sections. If you didn't select a host template, you will not see any items in either section. In order to create a graph in the next step, it is best to have at least one item in the Associated Graph Templates or Associated Data Queries. If you don't have the right template for the host device, please consult the Cacti template repository.

Cacti template repository—

SNMP support in Cacti

Simple Network Management Protocol (SNMP) is an application layer protocol, which processes the exchange of management information between devices. It is a part of the transmission control protocol suite (TCP/IP). SNMP helps the network administrator to manage network performance, find and solve network problems, and plan for network growth. Three versions of SNMP exist: SNMP version 1 (SNMPv1), SNMP version 2 (SNMPv2c), and SNMP version 3 (SNMPv3). How SNMP will work with your Cacti installation depends on which version you choose. Version 1 is limited on most devices, and should be avoided unless you have no other option. If you want access to greater resources (for example, implement high-speed counter (64bits)) then you can choose version 2. For secure and authenticated implementation, you can choose SNMPv3. Cacti has implemented version 3 fully from 0.8.7 version onwards. The Cacti Group recommends version 2c for ease of use and general support.




Supported Option

External SNMP

Calls Net-SNMP and its binaries that are installed on your system

Supports all versions

Internal SNMP

Uses PHP's SNMP function that calls Net-SNMP or ucd-snmp at compile time

Supports version 1

Spine SNMP

Links directly against usd-snmp or Net-SNMP and calls API

Supports all versions

Creating a graph for the device

Now that we have created a device in the system, it is time to create some graphs for this device. You can jump to creating a graph from two different places: select New Graphs under Create or if you are still in editing mode of the device, click Create Graph for this Host. After clicking the option, you can see a form like the following. You might have different options based on which device/host you choose from the drop-down box.

Using Graphs to Manage Networks and Devices with Cacti 0.8

In this example, I am creating a graph for the CactiBox itself. So, you are not seeing some options in the Data Query section. We will see that section when we create a graph for a network interface. It's pretty much straight forward to create a graph for a device. You just need to check the option next to different rows that are shown in the Graph Templates and Data Query sections. After checking the options, click on the Create button. You will see another form where you can choose Legend Color and some additional options, if the templates require additional input. After inputting the required values in this page, press the Create button again to create the graphs. Cacti will then schedule the creation of graphs for the device.

Organizing graphs

In Cacti, graphs can be organized in a hierarchical tree structure. Each graph tree contains zero or more branches containing either hosts or individual graphs. Even each node of the tree could have multiple branches. In this way, we can organize graphs functionally.

You can access Graph Trees under Management. In the Graph Trees page, click on the add button for a new graph tree.

Using Graphs to Manage Networks and Devices with Cacti 0.8

Choose a name and select a sorting type from the drop-down box. There are four sorting types in the drop-down box:

  • Manual Ordering: Each graph/device that is added can be re-ordered within the tree/branch
  • Alphabetic Ordering: Each graph/device is ordered alphabetically
  • Numeric Ordering: Each graph/device is ordered numerically
  • Natural Ordering: Alphanumeric ordering taking into account numeric increasing

You can choose the sorting that will fi t your requirements.

In this example, I use a tree name LinuxBox and sorting type Manual Ordering.

Using Graphs to Manage Networks and Devices with Cacti 0.8

If we click on Graph Trees under Management, we can see LinuxBox Click on Linux to add graphs to the tree.

Using Graphs to Manage Networks and Devices with Cacti 0.8

Now, press Add on the following page to add host, header, and graphs to the node. There is an option called Tree Item Type where you can choose the type of tree item—host, header, or graph. In this example, we will add host first, which is Cactibox.

Using Graphs to Manage Networks and Devices with Cacti 0.8

Now, we will add two headers called Server Stuff and Server Traffic. When it is done, we will add graphs to both headers. In order to do that, click Add and the following screen will appear.

Using Graphs to Manage Networks and Devices with Cacti 0.8

In the Parent Item drop-down box, select Server Stuff, graph in Tree Item Type, Cactibox – Disk Space – /dev/sda1 in Graph, and Hourly (1 Minute Average) in Round Robin Archive. In the same way, add the following graphs under Server Stuff:

  • Load Average
  • Logged in Users
  • Memory Usage
  • Processes

At the end, add Traffic under Server Traffic. When you are done, the LinuxBox graph tree will look like the following image.

Using Graphs to Manage Networks and Devices with Cacti 0.8

Now, I can see the graphs like the following one by clicking the Graphs tab at the top. In order to show the graphs in three columns, I have changed some settings.

Using Graphs to Manage Networks and Devices with Cacti 0.8


In this article, we have learned to create devices, add graph templates, and monitor network-attached devices. Though we have used built-in templates and data-queries, they are powerful enough to monitor the average activities of a network. As I mentioned before, if you want to monitor specific devices with a specific data query, please consult the Cacti template repository. You can find a complete list of templates at If you can not find one, you have to develop your data-query and template; for help, post your requirement to the Cacti official forum.

You've been reading an excerpt of:

Cacti 0.8 Network Monitoring

Explore Title