The cacti of Linux monitoring software

Source: Internet
Author: User
Tags php language rrd rrdtool snmp snmp error


First, Introduction

1) cacti is a PHP language implementation of a software, its main function is to use the SNMP service to obtain data, and then use RRDtool to store and update data, when the user needs to view the data with the RRDtool to generate a chart presented to the user. Therefore, SNMP and RRDtool are the key to cacti. SNMP is related to the collection of data, RRDtool is related to data storage and chart generation.

2) MySQL with PHP program to store some variable data and call the variable data, such as: Host name, host IP, SNMP community name, port number, template information and other variables.

3) The SNMP catch data is not stored in MySQL, but exists in the RRDtool generated RRD file (under the Rra folder in the cacti root directory). RRDtool Data Update and storage is the RRD file processing, the RRD file is a fixed size of the file (roundrobinarchive), it can store the number of data is defined at the time of creation.


Ii. Environmental Notes

Cacti's operation is based on the lamp environment first we install the lamp environment. Lamp environment is installed in two ways, the first is the source of the installation, the second is the installation of Yum.

The experiment was done in the CentOS6.5 system, and all the software was installed through Yum.

Service side [Hostname:server ip:192.168.0.112]

Client [Hostname:client ip:192.168.0.113]


Three, installation configuration

1. on the server side, perform the following actions:

1) Install Epel extension source

[email protected] ~]# Yum install-y epel-release


2) Install httpd, PHP, MySQL (lamp)

[[email protected] ~]# yum install-y httpd php php-mysql mysql mysql-server mysql-devel php-gd libjpeg libjpeg-devel Lib PNG Libpng-devel


3) Install cacti, NET-SNMP, RRDtool

[email protected] ~]# Yum install-y cacti net-snmp net-snmp-utils rrdtool


4) Start the service

[[email protected] ~]#/etc/init.d/mysqld start

[[email protected] ~]#/etc/init.d/httpd start

[[email protected] ~]#/ETC/INIT.D/SNMPD start


5) Edit the httpd configuration file

[Email protected] ~]# vim/etc/httpd/conf.d/cacti.conf

Find the first "Deny from all" and change to "Allow from all"

[Email protected] ~]#/etc/init.d/httpd restart


6) Import the data and create the cacti library

[[email protected] ~]# mysql-uroot-e "CREATE DATABASE Cacti"//create databases for cacti

[[email protected] ~]# MYSQL-UROOT-E "Grant all on cacti.* to ' cacti ' @ ' 127.0.0.1 ' identified by ' cacti ';" Authorize and create the user as cacti, password is cacti

[[email protected] ~]# mysql-uroot cacti </usr/share/doc/cacti-0.8.8b/cacti.sql//import SQL file


7 ) Edit cacti configuration file

[Email protected] ~]# vim/usr/share/cacti/include/config.php

$database _type = "MySQL";
$database _default = "cacti";

$database _hostname = "127.0.0.1";
$database _username = "cacti";
$database _password = "cacti";
$database _port = "3306";
$database _ssl = false;


8) Web Access cacti and installation

Browser input HTTP://192.168.0.112/CACTI will the following interface appears (to turn off Iptab les.)

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/74/5F/wKioL1YbrIah7ZVbAANHhheM5-E596.jpg "title=" 1.jpg " alt= "Wkiol1ybriah7zvbaanhhhem5-e596.jpg"/>

Installation point two "next" and a "finish" can be installed after the completion of the prompt to enter the user password, all default to Admin

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/74/63/wKiom1YbrQSxRYRqAAEwfBCWpGY953.jpg "title=" 2.jpg " alt= "Wkiom1ybrqsxryrqaaewfbcwpgy953.jpg"/>

after login will be prompted to change the password, we changed to save into the cacti home, but after clicking on graphs we will find no graphics. Because the poller.php script also needs to be executed.


9 ) Execute the poller.php script, generate the graph, and join the scheduled task

[Email protected] ~]#/usr/bin/php/usr/share/cacti/poller.php

Will prompt Waring, said not set timezone, below we set timezone

[[email protected] ~]# Vim/etc/php.ini//Add a line

Date.timezone= ' asia/chongqing '

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/74/60/wKioL1YbsGDRcN0bAAHRhcSA8vE326.jpg "title=" 5.jpg " alt= "Wkiol1ybsgdrcn0baahrhcsa8ve326.jpg"/>

Execute the script again, the Waring will not appear

[Email protected] ~]#/usr/bin/php/usr/share/cacti/poller.php

Then we can see that there is a graphic in the graphs.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/74/64/wKiom1YbsReDoc4aAAUID6CyGrU768.jpg "title=" 6.jpg " alt= "Wkiom1ybsredoc4aaauid6cygru768.jpg"/>


Then add the script to the scheduled task

[Email protected] ~]# CRONTAB-E

*/5 * * * */usr/bin/php/usr/share/cacti/poller.php//every 5 minutes



2. Perform the following actions on the client:

1) Install SNMP

[email protected] ~]# Yum install-y net-snmp


2) Modify snmpd.conf

[Email protected] ~]# vim/etc/snmp/snmpd.conf

Locate syslocation and syscontact Root and change to

Syslocation 0.113 //can write client host IP, also can write domain name

Syscontact Root [email protected] //admin mailbox


3) Start SNMP

[[Email protected] ~]# service SNMPD start



3. Increase Customer Host

1) Login cacti management Backstage, point console, then click Device, in the upper right corner add, fill in the following parameters, point to the bottom right corner of create.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/74/61/wKioL1Ybt4vD7ExTAAbMf3dvsBo133.jpg "title=" 8.jpg " alt= "Wkiol1ybt4vd7extaabmf3dvsbo133.jpg"/>


2) "Create Graphs for this Host" in the top right corner after creating a successful ability

Graph Types: Select Snmp-interface Statistics
Select the network card you want to monitor in the box below, for example, I choose Eth0, tick the right side of the small box, then click Create in the lower right corner.

Graph Types: Then choose graph Template Based
In the box below, select the item you want to monitor, such as ucd/net-load average, tick the right small box, then click Create in the lower right corner.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/74/64/wKiom1YbvPCQAmBhAAP6lsh8yYg805.jpg "title=" 9.jpg " alt= "Wkiom1ybvpcqambhaap6lsh8yyg805.jpg"/>


Note: SNMP error

If the NIC is not displayed after selecting Snmp-interface statistics, edit the client configuration file

[Email protected] ~]# vim/etc/snmp/snmpd.conf

Found: View SystemView included. 1.3.6.1.2.1. 1
Modified to: View SystemView included. 1.3.6.1.2.1

Then restart the SNMPD service;
[Email protected] ~]#/etc/init.d/snmpd restart

Before deleting, re-fill in the parameters to solve the problem.


3) Add to graph Trees

Point to the left of graph Trees, select Default Tree, point to the upper right corner of the Add,tree Item Type select "Host"
Host Select the machine IP that we just added, click Create in the lower right corner

4) Graphs the top left corner of the dot
On the left you can see that the Defaut tree below has added the host we just added, the graphics will not come out so soon, it will be a little while.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/74/61/wKioL1YbwGrQCTOOAARK6FUmAa8897.jpg "title=" 10.jpg "alt=" Wkiol1ybwgrqctooaark6fumaa8897.jpg "/>

After that we can see that a file with the beginning of 13 is generated in the server-side/usr/share/cacti/rra/folder

[Email protected] ~]# ls-l/usr/share/cacti/rra/

Total Dosage 860

-rw-r--r--1 root root 47840 October 03:45 _cpu_nice_8.rrd

-rw-r--r--1 root root 47840 October 03:45 _cpu_system_9.rrd

-rw-r--r--1 root root 47840 October 03:45 _cpu_user_10.rrd

-rw-r--r--1 root root 47840 October 03:45 _load_15min_12.rrd

-rw-r--r--1 root root 47840 October 03:45 13_load_1min_11.rrd

-rw-r--r--1 root root 47840 October 03:45 13_load_5min_13.rrd

-rw-r--r--1 root root 47840 October 03:45 13_mem_buffers_14.rrd

-rw-r--r--1 root root 47840 October 03:45 13_mem_cache_15.rrd

-rw-r--r--1 root root 47840 October 03:45 13_mem_free_16.rrd

-rw-r--r--1 root root 94664 October 03:45 13_traffic_in_17.rrd

-rw-r--r--1 root root 141488 October 03:45 localhost_load_1min_5.rrd

-rw-r--r--1 root root 47840 October 03:45 localhost_mem_buffers_3.rrd

-rw-r--r--1 root root 47840 October 03:45 localhost_mem_swap_4.rrd

-rw-r--r--1 root root 47840 October 03:45 localhost_proc_7.rrd

-rw-r--r--1 root root 47840 October 03:45 localhost_users_6.rrd




Reference articles

http://www.linuxfly.org/post/552/

Http://www.it165.net/admin/html/201310/1956.html


This article is from the "M April Days" blog, please be sure to keep this source http://1015489314.blog.51cto.com/8637744/1702299

The cacti of Linux monitoring software

Related Article

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.