How to merge two images in Cacti

Source: Internet
Author: User
Tags rrd

How to merge two images in Cacti

Cacti is a great open-source network monitoring system that is widely used to display network elements, such as bandwidth, storage, processor, and memory usage. With its Web-based interface, you can easily create and organize various charts. However, it does not provide some advanced functions by default, such as merging images, creating aggregated images using multiple sources, and migrating Cacti to another server. You still need some experience to use these Cacti features. In this tutorial, we will see how to merge the two Cacti images into one.

 

Let's look at this example. In the past six months, Client A has been connected to Port 5 of vswitch. An error occurs on Port 5, so the client is migrated to port 6. Since Cacti uses different diagrams for each interface/element, the client's bandwidth history is divided into ports 5 and 6. The result is that we have two images for one client-one for six months and the other for subsequent data.

In this case, we can actually combine two images to add the old data to the new graph, so that a separate graph is used to save historical and new data for a user. This tutorial explains how to do this.

Cacti stores the data of each image in its own RRD (round robin database) file. When you request an image, the image is generated based on the value saved in the corresponding RRD file. In Ubuntu/Debian, the RRD file is stored in/var/lib/cacti/rraIn CentOS/RHEL/var/www/cacti/rra.

The idea behind image merging is to change these RRD files so that the values in the old RRD file can be added to the new RRD file.

Scenario

The service of a client has been running on eth0 for more than one year. Due to hardware corruption, the client is migrated to the eth1 interface of another server. We want to show the bandwidth of the new interface and keep the historical data for more than one year. The client only needs to be shown in one graph.

Determine the RRD file of the graph

The first step of graph merge is to determine the RRD file associated with the graph. You can open the graph check file in debug mode. To do this, go to the Cacti menu: Console> Manage graph> select graph> Open Graph debugging mode.

Old diagram:

New diagram:

From the sample output (based on the Debian system), we can determine the RRD file of the two images:

  • Old figure:/var/lib/cacti/rra/oldGraphTrafficIn8. rrd
  • New figure:/var/lib/cacti/rra/newGraphTrafficIn10. rrd
Prepare scripts

We will use an RRD cut script to merge two RRD files. Download the PHP script and install it to/var/lib/cacti/rra/rrdsplice. php (Debian/Ubuntu system) or/var/www/cacti/rra/rrdsplice. php (CentOS/RHEL system ).

Next, confirm that the Apache user owns the file.

In Debian or Ubuntu, run the following command:

  1. # chown www-data:www-data rrdsplice.php

Update rrdsplice. php. Find the following row:

  1. chown($finrrd,"apache");

Replace the following statement:

  1. chown($finrrd,"www-data");

In CentOS or RHEL, run the following command:

  1. # chown apache:apache rrdsplice.php
Merge two images

Run the script without any parameters to obtain the script syntax.

  1. # cd /path/to/rrdsplice.php
  2. # php rrdsplice.php
  1. USAGE: rrdsplice.php --oldrrd=file --newrrd=file --finrrd=file

Now we are ready to merge two RRD files. You only need to specify the names of the old RRD file and the new RRD file. We will rewrite the merged results to the new RRD file.

  1. # 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 the data in the old RRD file has been appended to the new RRD file. Cacti writes any new data to the new RRD file. If you click the graph, we can see that the weekly, monthly, and yearly records of the old graph have been added. The second graph in the following chart shows the weekly record of the old graph.

In short, this tutorial shows how to simply merge two Cacti images into one. This tip is useful when the service is migrated to another device/interface and we want to process only one image instead of two images. This script is very convenient because it can merge images regardless of whether the source device is the same, such as the Cisco 1800 router and the Cisco 2960 switch.

I hope this will help you.

-------------------------------------- Split line --------------------------------------

In RHEL6.4, the Cacti + Spine monitoring host is used to send mail alarms.

Use Cacti + Spine to monitor remote hosts in RHEL6.4

CentOS 5.5 complete installation of Cacti + Spine

Cacti construction document under CentOS 6

Detailed description of Cacti monitoring deployment under RHEL5.9

How to install Cacti in CentOS 6.3

Quick installation and configuration of Cacti in CentOS Linux

-------------------------------------- Split line --------------------------------------

Cacti details: click here
Cacti: click here

Via: http://xmodulo.com/combine-two-graphs-cacti.html

Author: Sarmed Rahman Translator: ictlyh Proofreader: wxy

This article was originally translated by LCTT and launched with the Linux honor in China

This article permanently updates the link address:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.