Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Cacti 0.8 Network Monitoring

You're reading from  Cacti 0.8 Network Monitoring

Product type Book
Published in Jul 2009
Publisher Packt
ISBN-13 9781847195968
Pages 132 pages
Edition 1st Edition
Languages
Concepts

Chapter 7. Data Management

To generate graphs, Cacti needs to collect data. Cacti, by default, comes with some data queries and data input methods, which are enough for small and medium networks, but if you have a large network with 100+ computers, routers, and network devices, writing some data queries and input methods may save you time.

In this chapter, we will learn:

  • How to create data input method.

  • How to create data query.

  • SNMP query XML syntax.

  • Script query XML syntax.

  • Creating graph for single SNMP OID.

In Cacti, data is collected by two methods:

  1. 1. The data input method.

  2. 2. The data query method.

Data input method

In Chapter 4, we learned about the data input method. Here, we'll learn to create data input methods. Data input methods are the basic system that Cacti uses to collect data for generating graphs.

In the above figure, we can see the list of input methods that come with Cacti. For most small networks, you don't need to add or create a custom data input method. For larger networks...

Data input method


In Chapter 4, we learned about the data input method. Here, we'll learn to create data input methods. Data input methods are the basic system that Cacti uses to collect data for generating graphs.

In the above figure, we can see the list of input methods that come with Cacti. For most small networks, you don't need to add or create a custom data input method. For larger networks, writing your own data input method may help you as then, you have more control over your graph.

For example, a web server administrator might want to know how many Apache child processes are running. With Cacti, you can show the number of processes on a device without adding any new data input methods. However, if we want to count the instances of a particular process, one option is to create a new data input method. In the following example, we will assume that the process is on the local Cacti box.

To do this, we will use a Perl script. First, create a file called num_process.pl in the Cacti script...

Data queries


Data queries are not a replacement for data input methods in Cacti. Instead, they provide an easy way to query or list data based upon an index making the data easier to graph. The most common use of a data query within Cacti is to retrieve a list of network interfaces via SNMP. If you want to graph the traffic of a network interface, first Cacti must retrieve a list of interfaces on the host. Second, Cacti can use that information to create the necessary graphs and data sources. Data queries are only concerned with the first step of the process that is obtaining a list of network interfaces and not creating the graphs/data sources for them. While listing network interfaces is a common use for data queries, they also have other uses such as listing partitions, processors, or even cards in a router.

Data queries are not a replacement for data input methods in Cacti. Instead, they provide an easy way to query or list data based upon an index making the data easier to graph. The...

SNMP query XML syntax


This topic is for advance users only. Here, I am giving an example of an SNMP Query XML.

<query>
<name>Get SNMP Interfaces</name>
<description>Queries a host for a list of monitorable interfaces</description>
<oid_uptime>.1.3.x.x.x</oid_uptime>
<oid_index>.1.3.6.1.2.1.2.2.1.1</oid_index>
<oid_index_parse>OID/REGEXP:.*\.([0-9]{1,3}\.[0-9]{1,3})$</oid_index_parse>
<oid_num_indexes>.1.3.6.1.2.1.2.1.0</oid_num_indexes>
<index_order>ifDescr:ifName:ifIndex</index_order>
<index_order_type>numeric</index_order_type>
<index_title_format>|chosen_order_field|</index_title_format>
<fields>
<ifIndex>
<name>Index</name>
<method>walk</method>
<source>value</source>
<direction>input</direction>
<oid>.1.3.6.1.2.1.2.2.1.1</oid>
</ifIndex>
</fields>
</query>

Here are the details of...

Script Query XML


If you need to write Script query XML, here is the syntax:

<query>
<name>Get Unix Mounted Partitions</name>
<description>Queries a list of mounted partitions on a unix-based host with the 'df' command.</description>
<script_path>perl |path_cacti|/scripts/query_unix_partitions.pl </script_path>
<arg_index>index</arg_index>
<arg_query>query</arg_query>
<arg_get>get</arg_get>
<arg_num_indexes>num_indexes</arg_num_indexes>
<output_delimeter>:</output_delimeter>
<index_order>dskDevice:dskMount</index_order>
<index_order_type>alphabetic</index_order_type>
<index_title_format>|chosen_order_field|</index_title_format>
<fields>
<dskDevice>
<name>Device Name</name>
<direction>input</direction>
<query_name>device</query_name>
</dskDevice>
</fields>
</query>

And here is the detail...

Creating a graph for single SNMP OID


At some point, you may want to generate a graph for a single SNMP OID. In this section, we will learn to create a graph for SNMP OID.

To create a graph for SNMP OID we will use the SNMP Generic OID Template that comes with all Cacti version 0.8.5 and above. Let's start!

Click New Graph from the Create section.

Now, from dropdown menu, select the host where you want to create the graph. From the next dropdown menu, select SNMP Generic OID Template and click on the create button.

In the following page, you will need to fill in the fields.

Fields details of this form:

Summary


This is very important chapter for advanced users. Here, we learned to create a new data input method and data query. Also, we learned the details of SNMP query XML and Script query XML. At the end of this chapter, we saw how to create a graph for a single SNMP OID.

lock icon The rest of the chapter is locked
You have been reading a chapter from
Cacti 0.8 Network Monitoring
Published in: Jul 2009 Publisher: Packt ISBN-13: 9781847195968
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}

Field

Details

Title

Give the title for the new graph. Give a meaningful name, so that you can identify this graph later. It is always good idea to keep |host_description| as it is, just add your desired title after this.

Vertical Label

This will be printed on the graph left side (y-axis). It's generally used to describe units, such as 'bytes' or 'percent'.

Legend Color

The color...