Cacti full user manual (allowing you to use Cacti quickly and individually)
I. Overview
The monitoring system of Cacti and Nagios is a monitoring system that is widely used and supports a wide range of O & M personnel at home and abroad, the benefits of this system are the use of Cacti's powerful drawing and custom drawing capabilities, as well as Nagios's controllable alarm. However, most of the content on the Internet is about how to install it, and there are few introductions on how to use it successfully. After it is actually used, you need to constantly go to the Cacti official website to view the usage documentation for work needs, it is very troublesome to translate others' posts on the forum. So I decided to write a manual on usage so that everyone could use this system.
II. Use of Cacti
Most of Cacti's commonly used servers use templates for drawing. After Cacti is installed, it comes with some templates. Although these templates are available, there are too few projects supported, so we need to look for more templates and more optimized content.
Official template library for Cacti: http://docs.cacti.net/templates
1: General method of loading cacti templates:
A Cacti template consists of two parts. Some are xml template files, and the other is xml data collection files. Although both files are in xml format, you can clearly differentiate them. Because their file sizes are not similar at all.
A simple example:
This is a windows monitoring template. We can simply view it based on the file size.
* The xml template file is larger than 10 KB.
* The xml data collection file is smaller than 10 KB.
The Xml template file is to add the Import Templates item in the Console Tab Of the cacti web page:
Xml data collection files should be stored in the Cacti/resource/snmp_queries installation directory of cacti on Linux:
As long as the two types of xml are correctly imported/put into the appropriate location, the template is successfully added.
2: how to add a new host on Cacti and monitor related content: (add a Linux host as an example)
1. Create a drawing
A. On the Cacti Web page Console-> Import Templates, Import the xml template file for the response.
B. Put the template-related xml data collection file in cacti/resource/snmp_queries on Linux. Make sure that both the owner and group are cacti.
C. Click Console-> Devices to go to the device management page.
D. Click add in the upper right corner to add a new machine.
E. After the host information is filled in, click Create
F. At this time, the upper left corner of your page should display: Save Successful, and host information and SNMP information are displayed. If SNMP information displays SNMP error, please refer to the final problem summary.
G. Now we can add corresponding monitoring items. Add a graphic template to Associated Graph Templates at the bottom of the page and add a Data template to Associated Data Queries.
H. After adding the template, click Save. Save Successful appears in the upper-left corner.
I. Click Create Graphs for this Host in the upper-right corner to draw a picture of the data obtained through the template.
J. Select the items to be drawn, which are still divided into two parts:
The content in Graph Templates needs to be selected, and the content obtained by Data Query is more detailed, so you can select as needed.
K. Select the project to be drawn and click Create in the lower-right corner. The created project appears in the upper-left corner.
2. The newly added host is displayed on the Graphs interface.
A. On the Cacti Web interface Graph Trees, select the corresponding column (or the 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 Tree Item Type, and then select the Host we just created in the Host below. Click Create.
D. Now, go to the Graphs interface and you will see that the new host is added to the Default Tree.
III. Common Cacti templates
1. Common Windows templates
The basic content to be monitored in Windows is as follows:
1. CPU Use
2. Memory Use
3. Disk Size
4. Interface Traffic
To solve basic metrics, 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 a Windows host to ensure that SNMP can send more information to provide us with data collection: informant-std-16.exe
Use A template to monitor Windows CPU Projects
Use the B template to monitor networks, hard disks, and memory.
Finally, after adding the template, after creating a Windows host, you can add the following Templates correctly at the bottom of the page:
Because Data Queries is used in Windows templates. Therefore, make sure that after the related Data Queries are added, the Status of all projects should be Success and many Items and Rows can be seen. This indicates that the data is correctly collected. If not, go to issue 4 at the end of the step.
Finally, the monitoring results after adding and drawing are as follows:
2. Common Linux templates
The content of Linux and Windows monitoring is basically the same:
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 adding the template, after creating a Linux host, you can add the following Templates correctly at the bottom of the page:
The added content for all Linux monitors is as follows:
3. Related templates of Switch & Router
Since there are many Switch and Router models on the market, different models may need different templates and cannot be unified like Windows and Linux, so when you need to monitor the Switch and Router, please search for the template of the model that Google responds to or in the official template library of Cacti. The process of adding after searching is similar, so I will not go into details here.
IV: Add and monitor custom scripts
In many cases, we need to specify the monitoring content for our unique environment. How should we develop it? You can collect data by writing scripts on your own. Here I will use an example to monitor the number of online QQ users.
Preparations:
1. We need a script. The script language is random, as long as it can be run on a Linux machine and has returned content. For example, the script we are 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"
After this script is run, the output content is:
Only the last row is useful, and the rest is the curl capture information.
2. Our scripts should be placed in a location that ensures that Cacti users can access. Commonly used: In cacti/scripts/*, when the script is ready to stop, we will start monitoring.
1. Create a Data Input Method
1. on the Console, click Data Input Methods.
2. Click Add in the upper right corner to Add a new data acquisition method.
3. Click Create to display a new project.
4. the new project includes Input Fields and Output Fields, that is, the Input content and Output content. The Input content is actually to pass the function to the script. We do not need to pass any parameters in this script, so no, only Output Fields is supported.
5. Click Add on Output Fields to Add new Output content.
6. input the Output item of our script in Field [Output]: Here I fill in "QQ_Now"
7. Enter the content of the output item in Friendly Name. The content is random.
8. Check Update RRD File and click Create
9. Then, view the information of the entire data acquisition method. Click Save. "Save Successful" should appear in the upper-left corner"
2. Create a data source
1. Click Data Sources on the Console to go to the Data Source Page.
2. Click Add in the upper right corner to Add a new data source.
3. Make sure that both the Data Template and Host are None. Click Create directly
4. Enter relevant content in the new information panel
5. Click Create. Save Successful will appear in the upper left corner.
6. Note that the system automatically sends the generated RRD file path to ensure that there are no two consecutive backslash paths in it. If yes, manually change it to a backslash. For example:
/1194.rrd
7. Click Save to see Save Successful. The data source is created successfully.
3. Create an image
1. Choose Console> Graph Management to go to image Management.
2. Click Add in the upper right corner to Add a new image.
3. Select Graph Template and Host as None, and then click Create
4. Enter the image name in the Title. And click Create
5. Then you will see the extra Graph Items and a Red Cross in the middle, because this Graph is not defined yet.
6. Click Add in Graph Items to Add drawing rules.
7. After adding the drawing content, click Create/Save to return to the previous page, and then add the data display content.
8. Click Add in Graph Items again. This time, the data display is added to display the current value.
9. Click Create to Create the project, and then follow this method to Create the maximum, minimum, and average values.
10. added content.
4. Add the custom image to the Graphs panel.
1. In the Cacti Web interface Graph Trees, select the corresponding column (or the Default Tree of the system ).
2. After Entering the Tree, click Add in the upper right corner to Add a new display item.
3. Select Graph in Tree Item Type, and then select the image we just created in the Graph below. Click Create.
4. In this case, go to the Graphs page and you will see that the newly created image is displayed under the Default Tree.
V. Cacti Q &
1. After the Drivers information is filled in, the red SNMP error is displayed.
This is due to the SNMP settings of the monitored machine. We have not allowed the monitored machine to perform monitoring, or the Community does not match.
In Linux, you can modify/Add the machine for sending snmp and community in/etc/snmp/snmpd. conf.
In Windows, you can add machines that allow sending Snmp and community in the snmp service.
2. After adding the image, the image still cannot be drawn after countless times. The red X is reported to us.
First, if you create an image by using an added template, it may not be displayed because the template is too old or the template is incorrect. You can consider updating the author's latest template to redraw a picture. Of course, if the image cannot be drawn, we can enable the Debug log of the drawing for troubleshooting.
Go to Graph Management, select the Host in which the Graph cannot be drawn from the Host, and click Go. All the images in the Host are listed below, click the list that cannot be drawn. This enters the image settings page of the selected host. We should be able to see that there is still a red X below this page, proving that we cannot draw pictures, so click "Turn on Graph Debug Mode" in the upper right corner. "to open the Debug log. At this time, we can see the" RRD Tool Command: "list at the bottom of the page, which describes in detail how the RRD Tool draws images for us, this is not the key. The key is the final RRD Tool Says: for example
Here, the RRD Tool tells us why it cannot be painted. We can see that the reason why my current example is not painted is 316. the rrd file does not exist. This indicates that rrd did not correctly create the file during creation, which may be due to a problem with the template used.
Here, this is a good place to check why the image is not drawn. The RRD Tool will tell us one by one that we only need to modify it according to what it says, until RRD Tool Says: OK
3. There are images and everything, but the data is N/A. What is the problem?
This solution is similar to the solution that cannot be used for drawing. We can view the Debug log of the data.
Enter Data Sources, select the Host without Data in the Host, and then select the graph without Data in the list below. Go to the Data settings page, click "Turn on Data Source Debug mode" in the upper right corner, and analyze its error.
4. When adding metric items of Data Query to the host, no Data is obtained.
At this time, if it cannot obtain data, we cannot draw a picture for it. Because no content is displayed on the graph created for it.
In this case, you can directly click the relevant content under Debugging to directly open Debug to view the status.
In this case, we can see the feedback. For example, we can find that SNMP cannot obtain data. Of course there are others, such as the MIB file does not exist. You can solve the problem by looking at it carefully and knowing the root cause of the problem. After the data is retrieved, you can click the green circle on the right to refresh the data retrieval status.
5. About file permissions under cacti.
The content permissions in the Cacti directory are not uniform, and few permissions are required, not as much as what Nagios requires. We can simply keep the owner and group of the entire Cacti directory as Cacti. However, there are two special exceptions:
The first is the cacti/rra directory. The content in the directory is automatically generated in the drawing file of RRD. After the file is generated, the owner and group of the file are determined by the user who created the file, which is controlled in the crontab of Cacti, if we use the crontab added by the root user, the content owner and group in the rra directory are root. Similarly, if our crontab is set in cacti, the content owner and group in the rra directory are both cacti.
The second directory is the cacti/scripts directory. Most of the scripts stored here are our custom scripts. Make sure that the scripts are executable by cacti users. The best check method is to su to the cacti user, enter this directory, manually run the script to check whether the script is successfully executed.
-------------------------------------- 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
This article permanently updates the link address: