Cacti full use of the manual (let you quickly personalize the use of cacti)

Source: Internet
Author: User
Tags curl memory usage rrd snmp snmp error

I. Overview
Cacti and Nagios monitoring system can be said to be widely used and support the rich and the operational personnel at home and abroad need to master a set of monitoring system, the advantages of this system is the use of cacti powerful drawing and custom drawing ability, as well as Nagios controllable alarm. But most of the content on the Internet is how to install, in the installation of how to use the aspects of the very few, and really began to use, in order to work need to constantly go to cacti official website to view the use of documents, or forums to go over others ' posts, very troublesome. So I decided to write a manual on the use of the system so that people would really use it.

Ii. The use of cacti

Cacti most of the common server paint is done using the form of templates, and cacti installed itself with a part of the template, although these templates are available, but there are too few supporting projects, so we seek more templates and more optimized content.
Cacti's official Template gallery: http://docs.cacti.net/templates

General loading methods for 1:cacti templates:

A cacti template generally consists of two parts. Part is the XML template file, the other part is the XML data collection file, although both of these files are in XML format, but you can clearly distinguish their differences. Because their file size is not similar at all.
For a simple example:


This is a Windows monitoring template, we can simply according to the size of the file to look at.
* The size is greater than 10KB, that is the XML template file.
* The size is less than 10KB, that is the XML data collection file.
The XML template file is added to the import templates item in the Console tab of the Cacti Web page:

The XML data collection file, then, is placed in the cacti/resource/snmp_queries of the cacti installation directory on Linux:

As long as the two types of XML are correctly imported/put into place, the template is added successfully.

2: How to add a new host on the cacti and monitor related content: (To add Linux host for example)

1. Create paint A. Cacti Web page console->import templates to import responses to an XML template file.
B. Put the template-related XML data collection file in Cacti/resource/snmp_queries on Linux. and to ensure that the owners and groups are cacti.
C. Click Console->devices to open the Device Management page.
D. Click the Add in the upper right corner to add a new machine

E. When the information of the host is filled in, click Create
F. At this point, your page should display the upper-left corner: Save successful, and has shown host information and SNMP information, if SNMP information displays SNMP error, please check the final issue overview.
G. At this point, we can add the corresponding monitoring items, in the bottom of the page associated graph templates to add a graphics template, in the associated data queries add a template.

H. After adding the appropriate template, click Save. Save successful appears in the upper left corner.
I. Click the Create Graphs for this Host in the upper right corner to paint the data that you just obtained from the template.
J. Select the item that needs to be drawn, which is still divided into two parts:
The content in the graph templates needs to be checked, and data query gets more detail, so you can choose on demand.
K. Select a good need to draw the item, click on the lower right corner of the create, the upper left corner will be created by the drawing items.

2. Display the newly added host in the graphs interface.

A. In the cacti web interface graph trees, select the appropriate column (or default tree of the system).
B. After entering the tree, click Add in the upper-right corner to add a new display item.
C. Select host in the tree Item type, and then select the hosts that we just created in the following host. Click Create.
D. At this point, then enter the graphs interface, you can see under the default tree to join our newly created host.

Iii. Common templates for cacti

The basic contents of the

1.Windows common templates
    Windows general need to be monitored are:
    1.    cpu use
&nb Sp   2.    memory use
    3    disk size
    4.    interface  traffic

    To resolve the basic monitoring items, we need the following template.
    A.    cacti_snmp_informant_standard_metrics_v12.zip
    B.    CACTI _host_template_ucdnet_snmp_host.gz

     We also need to install a software on the Windows host, To ensure that SNMP can send more information to provide us with data collection: Informant-std-16.exe

    using a template to monitor Windows CPU projects
    Use B template to monitor network, hard disk, memory. &NBSP
    Finally, add the related template, after creating the Windows host, after the devices->your windows host -> The various templates that are correctly added below the page are as follows:

    is data queries under Windows templates. So make sure that after you add the relevant data queries, all items should be in the status of success and can see a lot of items and rows. This indicates that the data is correctly collected, if not, please go to the final question summary of question 4.
    Last added and drawing monitoring results:

 

2.Linux Common templates
Linux is basically the same content as Windows monitors:
1. CPU Use
2. Load Average
3. Memory Usage
4. Swap Usage
5. Disk I/O
6. Disk Size
7. Interface Traffic
To solve the Linux monitoring content, we use the following template:
A. cacti_host_template_ucdnet_snmp_host.gz
B. Cacti_graph_template_ucdnet_-_memory/swap_usage_linux.xml
C. Data_query_snmp_-_get_disk_io
Finally, after you have added the relevant templates, after you create the Linux host, the various templates that are correctly added under the Devices->your Linux hosts-> page are as follows:

The following additions to all Linux controls are as follows:

3.Switch && Router Related templates
Because of the number of switch and router in the market, and different models may require different templates, not like Windows and Linux to unify, so when you need to monitor switch and router, please Google Response model template, Or find it in the official template Library of cacti. The process of adding after the lookup is similar, no longer repeat here.

IV: Customizing script additions and Monitoring

Many times, we need to specify the monitoring content for our unique environment, then how to make it. You can collect data by writing your own scripts. Here I use an example to monitor the number of QQ online.

Preparatory work:
1. We need a script, the language of the script is arbitrary, as long as the Linux machine can be used to run and have the return content. Like the script we're about to use: #!/bin/bash echo "Qq_now: ' Curl im.qq.com/online.shtml | grep Qqdata | Cut-d ":"-F 3 | Cut-d ">"-F 2 | Cut-d "<"-F 1 ' "

After this script runs, the output reads:

Only the last line in this one is useful, and the other is the Curl crawl information.
2. Our scripts should be placed in a location that ensures that cacti users can access them. The common place is: cacti/scripts/*, then when the script is ready, start our monitoring work.

1. Create Data entry mode

1. Click Data Input Methods in console-->
2. Click the Add in the upper right corner to add a new way to get data


3. Click Create, new items appear
4. New projects include input Fields and output Fields, that is, input content and outputs, the input is actually to the script transfer function, our script does not need to pass what parameters in, so there is no, only output Fields.
5. Click Add on the output fields to add the new output.
6. In Field[output] Enter the output of our script: Here I fill in "Qq_now"
7. Enter the contents of the interpretation output item in friendly name, free of content.
8. After checking the update RRD file, click Create
9. Then view our entire data acquisition mode information, click Save, the upper left corner should appear "Save successful"

2. Create a data source

1. Click Data Sources in console-> to enter the interface
2. Click the Add in the upper right corner to add a new data source
3. Ensure that the data template and host are none. Direct Click Create
4. Enter relevant content in the newly-appearing information panel

5. Click Create, at this point the upper left corner will appear save successful
6. Note that the system automatically to generate the Rrd file path, to ensure that there will be no consecutive two backslash path information. If it appears, manually modify it to a backslash. such as: <PATH_RRA>/1194.RRD
7. Click Save to see Save successful, the data source was created successfully.

3. Creating images

1. Select Console--> Graph Management, enter image management
2. Click the Add in the upper right corner to add a new image

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.