As a Linux SA, the most important thing in daily life is to ensure the normal and stable operation of the website. We need to monitor the running status of the website and server in real time, in this case, you need to use open-source software (cacti, Nagios, zabbix, and so on) monitoring.
Cacti is a software implemented in PHP. Its main function is to use the SNMP service to obtain data and then use rrdtool to store and update data, when you need to view data, use rrdtool to generate charts and present them to users. Therefore, SNMP and rrdtool are the key to cacti.
SNMP is related to data collection, and rrdtool is related to data storage and chart generation. The data captured by SNMP is not stored in MySQL, but stored in the RRD file generated by rrdtool (generally named RRA as the Suffix in the RRA folder of the cacti root directory ). The simple schematic is as follows:
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/37/6C/wKiom1Os2O-h1kmkAADKNeR4dkU658.jpg "Title =" qq 40627103231.jpg "alt =" wKiom1Os2O-h1kmkAADKNeR4dkU658.jpg "/>
Download cacti-related software on the official website. Three software are required:
Http://www.cacti.net/downloads/cacti-0.8.8a.tar.gz
Http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.4.5.tar.gz
Http://www.cacti.net/downloads/spine/cacti-spine-0.8.8a.tar.gz
The yum installation method is used here. The installation command is as follows:
Yum install httpd MySQL mysql-server PHP-mysql PHP-json php-PDO-y
Install the corresponding lib library before installing rrdtool:
Yum install Cairo-devel libxml2-devel pango-devel-y
Tar xzf rrdtool-1.4.5.tar.gz;
CD rrdtool-1.4.5;
./Configure -- prefix =/usr/local/rrdtool/
Make & make install;
Ln-S/usr/local/rrdtool/bin/*/usr/local/bin/ln-S is a soft link, which is equivalent to a windows shortcut. The first is the original file, followed by the linked file directory
Yum install net-snmp-utils-y
Service snmpd start
Service snmpd Status view the status of snmpd
Tar xzf cacti-0.8.8a.tar.gz & amp; MV cacti-0.8.8a/var/www/html/cacti/
Mysql-uroot-P enter your password to enter the database, and then create the database:
Create Database cacti; Create a database
Grant all on cacti. * [email protected] 'localhost' identified by "123456"; create a user and authorize
Flush privileges; refresh permission
After configuring MySQL, import the cacti data to the cacti database.
Mysql-ucacti-p123456 cacti </var/www/html/cacti. SQL
After configuring MySQL, we need to set the cacti RRA and log directory permissions. Here we set the permission to 777:
Chmod-r 777/var/www/html/cacti/RRA/
Chmod-r 777/var/www/html/cacti/log/
VI/var/www/html/cacti/include/config. php is configured as follows:
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/37/8E/wKioL1OtJ9eR5rpvAAFm7Oj9gY8182.jpg "Title =" 1.jpg" alt = "wkiol1otj9er5rpvaafm7oj9gy8182.jpg"/>
*/5 */usr/bin/PHP/var/www/html/cacti/poller. php>/tmp/cacti_rrdtool.log 2> & 1
The following page is displayed through http: // ip/cacti/. click Next.
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/37/8E/wKioL1OtKCPDdPHOAAGyiPCBJrU725.jpg "Title =" 2.jpg" alt = "wkiol1otkcpddphoaagyipcbjru725.jpg"/>
By default, click Next:
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/37/8F/wKiom1OtKHPBMaFkAAExNmx5mig674.jpg "Title =" 3.jpg" alt = "wkiom1otkhpbmafkaaexnmx5mig674.jpg"/>
Go to the logon page and change the password for the first time:
Default: Account: Admin Password: Admin
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/37/8F/wKiom1OtKMzCDWfdAADK7EKptbM090.jpg "Title =" 5.jpg" alt = "wkiom1otkmzcdwfdaadk7ekptbm090.jpg"/>
Go to the cacti Configuration Management page
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/37/8E/wKioL1OtKNXA8vF9AADLhlpRcdM058.jpg "Title =" 6.jpg" alt = "wkiol1otknxa8vf9aadlhlprcdm058.jpg"/>
Click device to add a device. The server 127.0.0.1 is displayed by default. Add in the upper-right corner to add devices.
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/37/8F/wKioL1OtKhDz3JpjAADMoOpbL6g450.jpg "Title =" 9.jpg" alt = "wkiol1otkhdz3jpjaadmoopbl6g450.jpg"/>
Click localhost to view the specific settings, including the SNMP Protocol version and monitoring Name:
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/37/8F/wKioL1OtKknjxeXMAAEq9O01Bmk872.jpg "Title =" 10.jpg" alt = "wkiol1otkknjxexmaaeq9o01bmk872.jpg"/>
If an SNMP error occurs, check whether the SNMP service is started or whether it has permissions. If the above information is displayed, it indicates that it is normal.
Click the second button in the upper left corner to view the cacti image.-select localhost host-the right side will display the monitoring image of cacti every 5 minutes.
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/37/90/wKioL1OtKnTxNka0AAEdSfl7eJs058.jpg "Title =" 11.jpg" alt = "wkiol1otkntxnka0aaedsfl7ejs058.jpg"/>
Add monitoring host:
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/37/98/wKioL1OtNmqDbuz5AAQbWdqfFLk537.jpg "Title =" 12.jpg" alt = "wkiol1otnmqdbuz5aaqbwdqfflk537.jpg"/>
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/37/99/wKioL1OtN9ijY9y6AAaWH53_OSE327.jpg "style =" float: none; "Title =" 13.jpg" alt = "wkiol1otn9ijy9y6aaawh53_ose327.jpg"/>
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/37/9A/wKiom1OtOAeSK8YmAAQNnrFmLcU003.jpg "style =" float: none; "Title =" 14.jpg" alt = "wkiom1otoaesk8ymaaqnnrfmlcu003.jpg"/>
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/37/9B/wKioL1OtOl-ThB-GAAJ7C-1tg68071.jpg "Title =" 16.jpg" alt = "wKioL1OtOl-ThB-GAAJ7C-1tg68071.jpg"/> 650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/37/9B/wKioL1OtOrnSskjfAAQta6XY7vY452.jpg "Title =" 17.jpg" alt = "wkiol1otornsskjfaaqta6xy7vy452.jpg"/> 650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/37/9D/wKiom1OtO6mimfOvAAaFCvCnVdc231.jpg "Title =" 18.jpg" alt = "wkiom1oto6mimfovaaafcvcnvdc231.jpg"/> 650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/37/9D/wKiom1OtO9nQDQW9AAR_GwtWzfM967.jpg "Title =" 19.jpg" alt = "wkiom1oto9nqdqw91__gwtwzfm967.jpg"/>
Can't locate extutils/makemaker. pm IN @ INC (@ INC contains: /usr/local/lib64/perl5/usr/local/share/perl5/usr/lib64/perl5/vendor_perl/usr/share/perl5/vendor_perl/usr/lib64/perl5/usr /share/perl5 .) at makefile. PL Line 1.
Begin failed -- Compilation aborted at makefile. pl Line 1.
Make [3]: *** [Perl-piped/makefile] Error 2
Make [3]: Leaving directory '/root/rrdtool-1.4.7/bindings'
Make [2]: *** [All-recursive] Error 1
Make [2]: Leaving directory '/root/rrdtool-1.4.7/bindings'
Make [1]: *** [All-recursive] Error 1
Make [1]: Leaving directory '/root/rrdtool-1.4.7'
Make: *** [all] Error 2
System: the error above occurs when centos 6.3 64bit rrdtool is compiled.
Solution:
Yum install Perl-CPAN-y
This article is from the "David 0512" blog, please be sure to keep this source http://gjr0512.blog.51cto.com/6518687/1431675