Cacti is a great open source network monitoring system, which is widely used for the graphical display of network elements, such as bandwidth, storage, processor, and memory usage. Use its Web-based interface, you can easily create and organize a variety of charts. However, it does not default to provide some advanced features, such as merge pictures, graphics create an aggregate using multiple sources, Cacti migrated to another server. Cacti use these functions you need some experience. In this tutorial, we'll see how the two will be merged into one picture Cacti.
Look at this example. In the past six months, the client A is connected to Switch A port 5. Port 5 error occurred, so the client moved to port 6. Since Cacti for each interface / element with a different view of the history of the bandwidth will be divided into client ports 5 and 6. The results for a client we have two pictures - one is six months old data, and the other one holds the following data.
In this case, we can actually merge the two images of the old data to the new figures, so that with a single picture shows a user the preservation of historical and new data. This tutorial will explain how to do this.
Cacti will each picture data is stored in its own RRD (round robin database, circulation database) file. When requesting a picture, save in accordance with the corresponding values in RRD files generated map. In Ubuntu / Debian systems, RRD files are stored in / var / lib / cacti / rra, in CentOS / RHEL systems is / var / www / cacti / rra.
Thinking behind the merger is to change the image of these old RRD RRD files such values in the file can be appended to the new RRD file.
A client service operation for more than a year on eth0. Due to hardware damage, client migration to the eth1 interface to another server. We want to show the bandwidth of the new interface, while retaining the historical data for over a year. The client wants only displayed in a diagram.
OK graph RRD files
The first step is to determine the merger FIG diagram associated with the RRD files. We can check by opening the file in debug mode in FIG. To do this, the Cacti menu: Console> Management Figure> Select Figure> Open Graph debug mode.
From the sample output (Debian based system), we can determine the two pictures of RRD files:
Old Figure: /var/lib/cacti/rra/oldgraphtrafficin8.rrd
New Figure: /var/lib/cacti/rra/newgraphtrafficin10.rrd
We will use a script to merge two splice RRD RRD files. Download the PHP script to install /var/lib/cacti/rra/rrdsplice.php (Debian / Ubuntu systems) or /var/www/cacti/rra/rrdsplice.php (CentOS / RHEL system).
Next, make sure the Apache user who owns the file.
In Debian or Ubuntu system, run the following command:
# Chown www-data: www-data rrdsplice.php
And update rrdsplice.php. Look for the following line:
chown ($ finrrd, "apache");
Replace with the following statement:
chown ($ finrrd, "www-data");
In CentOS or RHEL system, run the following command:
# Chown apache: apache rrdsplice.php
Merge two plans
Through without any parameters to run the script can get the script syntax.
# Cd /path/to/rrdsplice.php
# Php rrdsplice.php
USAGE: rrdsplice.php --oldrrd = file --newrrd = file --finrrd = file
Now we are ready to merge the two RRD files. Only you need to specify the name of the old file and the new RRD RRD files. The results of our combined rewritten to a new RRD file.
# Php rrdsplice.php --oldrrd = old_graph_traffic_in_8.rrd --newrrd = new_graph_traffic_in_10.rrd --finrrd = new_graph_traffic_in_10.rrd
Now data from the old RRD files have been added to the new RRD file. Cacti any new data will be written to the new RRD file. If we click on the map, we can see also has added a week old chart, month and year record.
In summary, this tutorial shows how simply two Cacti pictures merged into one. When the service moved to another device / interface, we only want to deal with a picture instead of two when the tips very useful. The script is very convenient because it can regardless of the source device is not the same image can be combined, for example, Cisco 1800 routers and Cisco 2960 switches.
I hope this can help you.