Everything under control-building a Cacti server management and monitoring system

Source: Internet
Author: User
Tags rrdtool

Cacti is a common performance monitoring software for large-scale networks, it can monitor various data such as CPU load, memory usage, number of Running Processes, disk space, and nic traffic.

Cacti is only a Management Suite written in PHP language. It needs to use the Net-SNMP tool to collect monitoring data and use the RRDtool to poll the database tool) to record data and draw images, the web page is displayed to the administrator user.

Schematic diagram;

650) this. width = 650; "onclick = 'window. open (" http://blog.51cto.com/viewpic.php? Refimg = "+ this. src) 'height = "383" border = "0" src = "http://www.bkjia.com/uploads/allimg/131227/09153a000-0.jpg" alt = "clip_image003" title = "clip_image003" style = "border: 0px none;"/>

Software acquisition:

650) this. width = 650; "onclick = 'window. open (" http://blog.51cto.com/viewpic.php? Refimg = "+ this. src) 'height = "14" border = "0" src = "http://www.bkjia.com/uploads/allimg/131227/0915392429-1.gif" alt = "clip_image001" title = "clip_image001" style = "border: 0px none;"/>CactiDownload

P site: http://www.cacti.net

650) this. width = 650; "onclick = 'window. open (" http://blog.51cto.com/viewpic.php? Refimg = "+ this. src) 'height = "14" boder = "0" src = "http://www.bkjia.com/uploads/allimg/131227/091539EY-2.gif" alt = "clip_image001 [1]" title = "clip_image001 [1]" style = "border: 0px none; "/>RRDTool

P Round Robin Database Tool, Round-Robin Database Tool

P site: http://oss.oetiker.ch/rrdtool

Requirements:

Redhat 5.4 or CentOS5.5 system, which uses the text installation mode to minimize installation and build YUM.

Steps:

1. Configure snmpd on the monitored end)

Install the net-snmp package on the tested linux host and configure to start the snmpd service to allow the Cacti system to collect data.

1. Install the net-snmp Software Package

The Hardware monitoring module provided by lm_sensors is required for the net-snmp software. When installing the software, use the rpm package file on the system disc and install lm_sensors and net-snmp in sequence. The snmpd service needs to be installed on the monitored server, and net-snmp-utils-5.3.2.2-7.el5.i386.rpm needs to be installed on the monitoring server)

[Root @ www ~] # Mount/dev/cdrom/media/mnt/

[Root @ www ~] # Cd/media/mnt/Server/

[Root @ www Server] # rpm-ivh lm_sensors-2.10.7-4.el5.i386.rpm

[Root @ www Server] # rpm-ivh net-snmp-5.3.2.2-7.el5.i386.rpm

[Root @ www Server] # rpm-ivh net-snmp-utils-5.3.2.2-7.el5.i386.rpm

2. Configure and start the snmpd service

Modify the/etc/snmp/snmpd. conf file

Modification content:

Set com2sec notConfigUser default public

Access notConfigGroup "" any noauth exact systemview none

# View all supported ded. 1 80

Change

Com2sec notConfigUser 192.168.1.111 public

Access notConfigGroup "" any noauth exact all none

View all supported ded. 1 80

3. Start snmpd and set startup

[Root @ www ~] # Service snmpd start

[Root @ www ~] # Chkconfig -- level 35 snmpd on

2. Configure the monitoring server Cacti)

The Cacti monitoring server must support Apache, Mysql, and PHP websites, and install software packages such as gd and zlib in advance.

1. Install LAMP platform, start the service, and set startup

[Root @ www ~] # Yum install httpd *-y

[Root @ www ~] # Yum install mysql *-y

[Root @ www ~] # Yum install php *-y

[Root @ www ~] # Service httpd start

[Root @ www ~] # Service mysqld start

[Root @ www ~] # Chkconfig -- level 35 httpd on

[Root @ www ~] # Chkconfig -- level 35 mysqld on

2. Install the rrdtool package

Software packages required by rrdtool

Libart_lgpl-2.3.17-4.i386

Libpng-1.2.10-7.1.el5_3.2.i386

Freetype-2.2.1-21.el5_3.i386 must be pre-installed

[Root @ www ~] # Tar zxf rrdtool-1.2.27.tar.gz

[Root @ www ~] # Cd rrdtool-1.2.27

[Root @ www rrdtool-1.2.27] # ../configure -- prefix =/usr/local

The [root @ www rrdtool-1.2.27] # make

[Root @ www rrdtool-1.2.27] # make install

3. install and configure Cacti server suite

Install the Cacti file package, decompress it to the WEB directory of the WEB server, and add users who read and write monitoring data.

[Root @ www ~] # Cd/var/www/html/

[Root @ www html] # tar zxf cacti-0.8.7b-cn-utf8.tar.gz

[Root @ www html] # Music cacti-0.8.7b-cn-utf8 cacti

[Root @ www html] # useradd cactiuser

[Root @ www html] # chown-R cactiuser: cactiuser cacti/rra/cacti/log/

Set monitoring database.

Create a database and table for storing monitoring data, and set the user and password authorized to access the database.

[Root @ www html] # service mysqld start

[Root @ www html] # mysql-u root-p

Mysql & gt; create database cactidb default character set utf8;

Mysql & gt; grant all on cactidb. * to cactiuser @ localhost identified by '123 ';

Mysql & gt; exit

[Root @ www html] # mysql-u cactiuser-p cactidb <cacti/cacti. SQL // import data tables

4. Install PA, Thold, and Monitor plug-in extensions

[Root @ www ~] # Cd/var/www/html/cacti

[Root @ www cacti] # tar zxf cacti-plugin-arch.tar.gz

[Root @ www cacti] # mysql-u cactiuser-p cactidb & lt; cacti-plugin-arch/pa. SQL

[Root @ www cacti] # gunzip-c cacti-plugin-0.8.7b-PA-v2.1-cn-utf8.diff.gz> PA-utf.diff

[Root @ www cacti] # patch-p1-N <PA-utf.diff

[Root @ www cacti] # cd plugins

[Root @ www plugins] # tar zxf settings-0.5.tar.gz

[Root @ www plugins] # tar zxf monitor-0.8.2.tar.gz

[Root @ www plugins] # tar zxf thold-0.3.9.tar.gz

[Root @ www plugins] # mysql-u cactiuser-p cactidb & lt; thold/thold. SQL

[Root @ www plugins] # mysql-u cactiuser-p cactidb & lt; monitor/monitor. SQL

5. Adjust the Cacti configuration file

[Root @ www cacti] # vi include/config. php

& Lt ;? Php

$ Database_type = "mysql ";

$ Database_default = "cactidb ";

$ Database_hostname = "localhost ";

$ Database_username = "cactiuser ";

$ Database_password = "123 ";

$ Database_port = "3306 ";

$ Config ['url _ path'] = "/";

$ Plugins = array ();

$ Plugins [] = "settings ";

$ Plugins [] = "thold ";

$ Plugins [] = "monitor ";

/* Default session name-Session name must contain alpha characters */

# $ Cacti_session_name = "Cacti ";

?>

6. Adjust httpd settings

[Root @ www ~] # Vi/etc/httpd/conf/httpd. conf

Modify the http. conf file to support automatic search for index. php and use UTF-8 as the default Chinese character set.

Listen 192.168.1.111: 80

DocumentRoot "/var/www/html/cacti"

<Directory "/var/www/html/cacti">

Options None

AllowOverride None

Order allow, deny

Allow from all

</Directory>

DirectoryIndex index. php

Adddefacharcharset UTF-8

7. Restart the httpd service and view its port

[Root @ www ~] # Service httpd restart

[Root @ www ~] # Service mysqld restart

[Root @ www ~] # Netstat-anpt | grep: 80

8. Add a Task Scheduler

[Cactiuser @ www ~] $ Php/var/www/html/cacti/poller. php

[Cactiuser @ www ~] $ Crontab-e

The content is as follows;

*/5 */usr/bin/php/var/www/html/cacti/poller. php & gt;/dev/null

[Cactiuser @ www ~] $ Exit

[Root @ www ~] # Service crond start

[Root @ www ~] # Chkconfig -- level 2345 crond on

650) this. width = 650; "onclick = 'window. open (" http://blog.51cto.com/viewpic.php? Refimg = "+ this. src) 'height = "105" border = "0" src = "http://www.bkjia.com/uploads/allimg/131227/09153954B-3.jpg" alt = "clip_image005" title = "clip_image005" style = "border: 0px none;"/>

9. initialize and install cacti on the web page

Access the Cacti server using a web browser. When you access the Cacti page for the first time, the initialization and Installation Wizard Page of Cacti is automatically displayed ., Click Next.

650) this. width = 650; "onclick = 'window. open (" http://blog.51cto.com/viewpic.php? Refimg = "+ this. src) 'height = "530" border = "0" src = "http://www.bkjia.com/uploads/allimg/131227/09153930P-4.jpg" alt = "clip_image007" title = "clip_image007" style = "border: 0px none;"/>

650) this. width = 650; "onclick = 'window. open (" http://blog.51cto.com/viewpic.php? Refimg = "+ this. src) 'height = "293" border = "0" src = "http://www.bkjia.com/uploads/allimg/131227/0915394227-5.jpg" alt = "clip_image008" title = "clip_image008" style = "border: 0px none;"/>

650) this. width = 650; "onclick = 'window. open (" http://blog.51cto.com/viewpic.php? Refimg = "+ this. src) 'height = "516" border = "0" src = "http://www.bkjia.com/uploads/allimg/131227/0915395Q0-6.jpg" alt = "clip_image010" title = "clip_image010" style = "border: 0px none;"/>

650) this. width = 650; "onclick = 'window. open (" http://blog.51cto.com/viewpic.php? Refimg = "+ this. src) 'height = "522" border = "0" src = "http://www.bkjia.com/uploads/allimg/131227/09153950R-7.jpg" alt = "clip_image012" title = "clip_image012" style = "border: 0px none;"/>

650) this. width = 650; "onclick = 'window. open (" http://blog.51cto.com/viewpic.php? Refimg = "+ this. src) 'height = "532" border = "0" src = "http://www.bkjia.com/uploads/allimg/131227/0915393360-8.jpg" alt = "clip_image014" title = "clip_image014" style = "border: 0px none;"/>

650) this. width = 650; "onclick = 'window. open (" http://blog.51cto.com/viewpic.php? Refimg = "+ this. src) 'height = "531" border = "0" src = "http://www.bkjia.com/uploads/allimg/131227/09153a037-9.jpg" alt = "clip_image016" title = "clip_image016" style = "border: 0px none;"/>

In order to monitor the normal Chinese characters in the image, you also need to set the Chinese font path used by RRDtool. The path of this version should be "/usr/share/fonts/zh_TW/TrueType/bsmi00lp. ttf, click Save in the lower right corner.

650) this. width = 650; "onclick = 'window. open (" http://blog.51cto.com/viewpic.php? Refimg = "+ this. src) 'height = "443" border = "0" src = "http://www.bkjia.com/uploads/allimg/131227/09153a2O-10.jpg" alt = "clip_image018" title = "clip_image018" style = "border: 0px none;"/>

650) this. width = 650; "onclick = 'window. open (" http://blog.51cto.com/viewpic.php? Refimg = "+ this. src) 'height = "605" border = "0" src = "http://www.bkjia.com/uploads/allimg/131227/09153914E-11.jpg" alt = "clip_image020" title = "clip_image020" style = "border: 0px none;"/>

650) this. width = 650; "onclick = 'window. open (" http://blog.51cto.com/viewpic.php? Refimg = "+ this. src) 'height = "582" border = "0" src = "http://www.bkjia.com/uploads/allimg/131227/09153954C-12.jpg" alt = "clip_image022" title = "clip_image022" style = "border: 0px none;"/>

This article from the "feng shui Yun Tian-Le Cheng" blog, please be sure to keep this source http://yueyuanyuan.blog.51cto.com/1342062/382968

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.