Construction of cacti monitoring

Source: Internet
Author: User
Tags apache error log mysql query php error rrdtool snmp

Nagios monitoring is currently used online, but recently there is a need to monitor the switch traffic and be able to visualize the monitoring, although Nagios is able to monitor but not be able to meet the requirements in drawing, and the MRTG plot does not meet our need to freely view the traffic for a certain period of time , so we still use cacti, we can perfect the drawing, but also in line with our future nagios and cacti integration to achieve more detailed monitoring, below to understand it.

One. Use yum to install the lamp environment.

1. Installing the mysql-5.6 Database

[Email protected] ~]# RPM-UVH Http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm[[email protected] ~ ]# yum install mysql-community-server[[email protected] ~]# Rpm-qa |grep Mysqlmysql-community-release-el6-5.noarchmysql-community-libs-compat-5.6.22-2.el6.x86_ 64mysql-community-libs-5.6.22-2.el6.x86_64mysql-community-client-5.6.22-2.el6.x86_ 64mysql-community-server-5.6.22-2.el6.x86_64php-mysql-5.3.3-40.el6_6.x86_ 64mysql-community-common-5.6.22-2.el6.x86_64

2. Installing Apache

[Email protected] ~]# yum-y install httpd [[email protected] ~]# Rpm-qa |grep httpdhttpd-tools-2.2.15-39.el6.centos.x86 _64httpd-2.2.15-39.el6.centos.x86_64
3. Install PHP

[[email protected] ~]# yum-y install PHP php-mysql^c[[email protected] ~]# rpm-qa |grep phpphp-5.3.3-40.el6_6.x86_64php- Gd-5.3.3-40.el6_6.x86_64php-common-5.3.3-40.el6_6.x86_64php-cli-5.3.3-40.el6_6.x86_64php-mysql-5.3.3-40.el6_6. X86_64php-pdo-5.3.3-40.el6_6.x86_64
4. Install the required library files

[[email protected] ~]# yum-y install zlib[[email protected] ~]# yum-y install freetype[[email protected] ~]# Yum-y Inst All Libjpeg[[email protected] ~]# yum-y install fontconfig[[email protected] ~]# yum-y install gd[[email protected] ~]# Yum-y install Libxml2[[email protected] ~]# yum-y install zlib freetype libjpeg fontconfig gd libxml2 PHP-GD
Two. Installing the RRD tool

[[email protected] ~]# yum-y install rrdtool rrdtool-devel[[email protected] ~]# rpm-qa |grep rrdrrdtool-1.3.8-7.el6.x86 _64rrdtool-devel-1.3.8-7.el6.x86_64
Three. Install and configure the SNMP tools required for monitoring

1. Installation

[[email protected] ~]# yum-y install NET-SNMP net-snmp-devel net-snmp-utils[[email protected] ~]# rpm-qa |grep NET-SNMPN Et-snmp-libs-5.5-50.el6_6.1.x86_64net-snmp-devel-5.5-50.el6_6.1.x86_64net-snmp-5.5-50.el6_6.1.x86_ 64net-snmp-utils-5.5-50.el6_6.1.x86_64
2. Configuring SNMP

[[email protected] ~]# vim/etc/snmp/snmpd.confcom2sec notconfiguser  default public       change to: Com2sec Notconfiguser  127.0.0.1       publicaccess  notconfiggroup ""      any       noauth    exact  systemview None None change to: Access  notconfiggroup "" Any       noauth    exact all  none None#view all    included  . 1                               80 Remove comments
Start related services after completion of the above

[[Email protected] ~]# service httpd start[[email protected] ~]# service mysqld start[[email protected] ~]# service SNMPD Start
Four. Install and configure the cacti

1. Installing cacti

[Email protected] ~]# wget http://www.cacti.net/downloads/cacti-0.8.7e.tar.gz-P/usr/local/src[[email protected] ~]# Cd/usr/local/src[[email protected] ~]# tar-zxvf cacti-0.8.7e.tar.gz[[email protected] ~]# mv Cacti-0.8.7e/var/html/www /cacti
2. Configure MySQL

[Email protected] ~]# mysql-u rootmysql> CREATE database cacti;grant all on cacti.* to [email protected] identified B Y ' cacti '; grant all on cacti.* to [e-mail protected] identified by ' cacti '; use cacti;source/var/www/html/cacti/cacti.sql; #创建相关表flush privileges;
In the execution cacti.sql times error: Error 1064:you has an error in your SQL syntax; Check the manual-corresponds to your MySQL server version for the right syntax-to-use near ' Type=myisam ' on line 6.

This is because the MySQL query statement type=myisam too old, on the mysql5.5 has been disabled, the installation program Type=myisam all changed to Engine=myisam.

3. Configure cacti

[Email protected] ~]# vim/var/www/html/cacti/include/config.php $database _type = "MySQL"; $database _default = "cacti"; $database _hostname = "localhost"; $database _username = "cacti"; $database _password = "cacti"; $database _port = "3306";
4. Set the relevant permissions

Useradd cacti-d/var/www/html/cacti-s/bin/falsechown-r cacti/var/www/html/cacti/rra/var/www/html/cacti/log
5. Set up Scheduled Tasks

[[email protected] ~]# CAT/ETC/CRONTAB*/5 * * * * root/usr/bin/php/var/www/html/cacti/poller.php >/dev/null 2>&A Mp;1
Five. Initialize cacti

1. Visit http://192.168.3.133/cacti



2. Click Next directly


3. Click Next directly


4. Click Finish directly



5. Enter the default username admin password Admin, you need to re-change the password before entering



6.ok, has entered the page, we click on the upper left corner of the "graphs", the monitoring of the axis will appear.



Note: If there is no axis or "X" image can not be displayed, you need to view the Apache error log, or run/usr/bin/php/var/www/html/cacti/poller.php directly to see the error content, mainly due to the PHP version is too high, The next source code needs to be modified to accommodate the new version of the syntax.

(1) View error log php warning:date (): It is not safe to rely on the system ' s timezone settings

Vim /etc/php.ini

Date.timezone = ' Asia/shanghai '

(2) Direct Operation/usr/bin/php/var/www/html/cacti/poller.php Error PHP deprecated:assigning The return value of new by reference is DEP recated in/var/www/html/cacti/lib/adodb/adodb.inc.php on line 866

vim/var/www/html/cacti/lib/adodb/adodb.inc.php because php5.3 does not support "=&", Change All "=&" to "="

(3) Log error PHP deprecated:function split () is Deprecated in/var/www/html/cacti/poller.php on line 77

Or because of a version issue

Vim /etc/php.ini

; error_reporting;   Default Value:e_all & ~e_notice;   Development Value:e_all | e_strict;   Production Value:e_all & ~e_deprecatederror_reporting = E_all & ~e_deprecated
Restart Apache when you're done modifying it to see if it's all displayed.






Construction of cacti monitoring

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.