Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Cacti installation details-Enterprise instance

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Cacti is a set of graphical analysis tools for network traffic monitoring based on PHP,MySQL,SNMP and RRDTool.

Cacti is through snmpget to obtain data, using RRDtool to draw graphics, it provides a very powerful data and user management functions, you can specify that each user can view the tree structure, host and any picture, but also can be combined with LDAP for user authentication, but also can add their own templates, very powerful and perfect. The interface is friendly, Cacti can also plug in Scripts and add Templates to make a variety of monitoring charts.

One. Install apache

1. Preparatory work

(1) install gcc and gcc-c++ in yum mode

# yum install gcc gcc-c++-y

(2) install pcre

Download address of pcre:

Http://jaist.dl.sourceforge.net/project/pcre/pcre/8.35/

# tar zxf pcre-8.35.tar.gz

# cd pcre-8.35

#. / configure prefix=/usr/local/pcre

# make & & make install

(3) install apr and apr-util

Download address for apr and apr-unit:

Http://archive.apache.org/dist/apr/

1) decompress the file

# tar zxf apr-1.5.0.tar.gz

# tar zxf apr-util-1.5.3.tar.gz

# tar zxf httpd-2.4.9.tar.gz

2) copy apr and apr-util to the srclib directory of http, and remove the version number

# cp-r apr-1.5.0 httpd-2.4.9/srclib/apr

# cp-r apr-util-1.5.3 httpd-2.4.9/srclib/apr-util

3) compile and install

Install apr

# cd httpd-2.4.9/srclib/apr

#. / configure-prefix=/usr/local/apr

# make & & make install

Install apr-util

# cd / root/httpd-2.4.9/srclib/apr-util/

#. / configure-prefix=/usr/local/apr-util-with-apr=/usr/local/apr/

# make & & make install

two。 Formal installation of apache

Download address of Apache:

Http://archive.apache.org/dist/httpd/

# cd httpd-2.4.9

#. / configure-prefix=/usr/local/apache-with-apr=/usr/local/apr/-with-apr-util=/usr/local/apr-util/-with-pcre=/usr/local/pcre/

# make & & make install

Start the apache service

# service httpd start

Install successfully, start httpd service and join boot boot

# chkconfig httpd on

II. Install mysql

1. Preparatory work

(1) install ncurses-devel in yum mode

# yum install ncurses-devel-y

(2) install cmake

Download address of cmake:

Http://wwwNaNake.org/files/v3.0/

# tar zxf cmake-3.0.0.tar.gz

# cd cmake-3.0.0

#. / configure

# make & & make install

two。 Create the installation directory and database storage directory for mysql

# mkdir / usr/local/mysql/date-pv

/ usr/local/mysql/ mysql installation directory

/ usr/local/mysql/data / / Database exists

3. Create mysql users and user groups

# groupadd mysql

# useradd-r-g mysql mysql

4. Install mysql in source mode

Download address of Mysql:

Http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.17.tar.gz

# tar zxf mysql-5.6.17.tar.gz

# cd mysql-5.6.17

# cmake. -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-DMYSQL_DATADIR=/usr/local/mysql/data-DWITH_INNOBASE_STORAGE_ENGINE=1-DMYSQL_TCP_PORT=3306-DMYSQL_UNIX_ADDR=/usr/local/mysql/data/mysql.sock-DWITH_DEBUG=0

# make & & make install

Parameter description:

-DCMAKE_INSTALL_PREFIX=/usr/local/mysql / / installation directory

-DMYSQL_DATADIR=/usr/local/mysql/data / / database storage directory

-DMYSQL_TCP_PORT=3306 / / Port number

-DENABLED_LOCAL_INFILE=1 / / allow data to be imported locally

5. Configure mysql

(1) set directory permissions

# chown mysql:mysql / usr/local/mysql/-R

(2) initialize mysql database

# cd / usr/local/mysql/

#. / scripts/mysql_install_db-user=mysql-datadir=/usr/local/mysql/data/-basedir=/usr/local/mysql/

(3) copy the mysql service startup script

# cp. / support-files/mysql.server / etc/init.d/mysqld

(4) configure environment variables

# vim / etc/profile

Add:

PATH=$PATH:/usr/local/mysql/bin:/usr/local/mysql/lib

Reload reboot takes effect

# source / etc/profile

(5) modify mysql main configuration file / etc/my.cnf

The full contents are as follows:

6. Start mysql

(1) start the daemon and generate pid

#. / mysqld_safe &

(2) start mysql

# service mysqld restart

7. Set the mysql administrator password

#. / mysqladmin password "123456"-u root

III. Install PHP

1. Preparatory work

1) install zlib

Download address of zlib:

Http://www.zlib.net/

# tar zxf zlib-1.2.8.tar.gz

# cd zlib-1.2.8

#. / configure-prefix=/usr/local/zlib

# make & & make install

2) install libpng

Download address of libpng:

Http://sourceforge.net/projects/libpng/postdownload?source=dlp

Note: it is recommended to download the libpng-1.5.18 version here, because there is a problem of version compatibility between libpng and zlib. If the version is not suitable, the Times of make will be wrong.

It is known that this problem exists between zlib-1.2.8 and libpng-1.6.10, and zlib-1.2.8 and libpng-1.5.18 can be installed normally. There is an article that describes this problem.

# tar zxf libpng-1.5.18.tar.gz

# cd libpng-1.5.18

#. / configure-prefix=/usr/local/libpng

# make & & make install

When compiling, add-- with-zlib-prefix=/usr/local/zlib/, or prompt the same error.

Obviously zlib has been installed, why prompt that zlib is not installed? it turns out that zlib-devel is not installed. Let's use yum to install zlib-devel.

# yum install zlib-devel

The following compilation is successful.

#. / configure-prefix=/usr/local/libpng-with-zlib-prefix=/usr/local/zlib/

Reinstall

3) install freetype

Download address of freetype:

Http://sourceforge.net/projects/freetype/files/freetype2/2.5.3/

# cd freetype-2.5.3

#. / configure-prefix=/usr/local/freetype

# make & & make install

4) install jpeg

Download address of jpeg:

Http://www.ijg.org/files/

# tar zxf jpegsrc.v9.tar.gz

# cd jpeg-9/

#. / configure-prefix=/usr/local/libjpeg

# make & & make install

5) install fontconfig, gd, libxml2*, libjpeg-devel in yum mode

# yum install fontconfig gd-y

# yum install libxml2* libjpeg-devel-y

two。 Formal installation of PHP

PHP download address: wget http://cn2.php.net/distributions/php-5.5.14.tar.gz

# tar zxf php-5.5.14.tar.gz

# cd php-5.5.14

# / configure-- prefix=/usr/local/php-- with-apxs2=/usr/local/apache/bin/apxs-- with-gd-- with-mysql=/usr/local/mysql/-- with-zlib-dir=/usr/local/zlib/-- with-png-dir=/usr/local/libpng/-- enable-gd-native-ttf-- with-ttf-- enable-gd-jis-conv-- enable-mbstring-- enable-sockets-- enable-xml-- disable-fileinfo

# make & & make install

Finally, establish a soft connection

Ln-s / usr/local/php/bin/* / usr/local/bin/

IV. Install rrdtool

1. Preparatory work

(1) install cairo-devel, pango, pango-devel, libpng-devel, libart_lgpl-devel, intltool, freetype-devel in yum mode

# yum install cairo-devel pango pango-devel libpng-devel libart_lgpl-devel intltool freetype-devel-y

(2) install perl-ExtUtils-CBuilder and perlExtUtils-MakeMaker in yum mode

# yum install perl-ExtUtils-CBuilder perlExtUtils-MakeMaker-y

two。 Formal installation of rrdtool

Download address of rrdtool:

Http://download.chinaunix.net/down.php?id=35595&ResourceID=9078&site=1

# tar zxf rrdtool-1.4.5.tar.gz

# cd rrdtool-1.4.5

#. / configure-prefix=/usr/local/rrdtool-disable-tcl

# make & & make install

two。 Add links

Ln-s / usr/local/rrdtool/bin/* / usr/local/bin/

V. Install net-snmp

(1) install net-snmp in yum mode

# yum install net-snmp*-y

(2) configure net-snmp (main configuration file / etc/snmp/snmpd.conf)

1) find:

Modified to:

192.81.128.66 is which host you allow to access you (that is, the cacti server)

2) find:

Remove the comments, that is:

3) find:

Remove the comments

(3) start net-snmp

Service snmpd start

The monitoring port is 161. Check to see if it is open.

Netstat-an | grep snmp

(4) verify whether there is data.

1) localhost

# snmpwalk-v 2c-c public localhost

2) Native ip test

# snmpwalk-v 2c-c public 192.81.128.66

192.81.128.66 is the IP of the monitored machine (here the test is native, so it is native IP)

VI. Install cacti

Download address of cacti:

Http://www.cacti.net/downloads/

1. After decompressing cacti, move the cacti directory to the htdocs directory where the web page is stored in httpd, and remove the version number

# tar zxf cacti-0.8.7h.tar.gz

# mv cacti-0.8.7h / usr/local/apache/htdocs/cacti

two。 Add cacti users and modify directory permissions

Cd / usr/local/apache/htdocs

Useradd catic

Chown-R cacti.cacti. /

Log in to mysql as 3.root, create new data and authorize

Mysql-uroot-p

> grant all on cacti.* to cacti@'localhost' identified by '123456'

> flush privileges

4. Import database

Cd / usr/local/apache/htdocs/cacti

# / sur/local/mysql/bin/mysql-u cacti-p123456 cacti < cacti.sql

Vim include / config.php

Here is the database type, user name and password information used for cacti connection, which can be configured according to your own needs.

And add: $url_path= "/ cacti/"

5. Configure apache (profile / usr/local/apache/conf/httpd.conf)

Find:

Modified to:

Check the configuration file syntax of httpd to restart the httpd service

/ usr/local/apache/bin/apachectl configtest

Yum install php-mysql-y

6. Turn off the firewall and selinux and access the cacti installation interface

Setenforce 0

Service iptables stop

7. Restart the apache service

Service httpd restart

7. Log in to cacti and install cacti

1. Enter http://192.81.128.66/cacti in the browser to enter the web interface

Click Next

two。 Appear as 1 interface

Still click Next

3. The following interface appears with no errors, perfect

Click Finish

Revisit and have a look.

This is the login interface of cacti.

4. The first login, user name, password are admin

7. This is a successful login to cacti.

When the above picture occurs, cacti has been installed and can be used normally.

But cacti uses cmc.php to draw pictures by default, but it is said that using spine saves system resources.

8. Generate drawing files

Click graphs in the interface, the graphics will not be displayed, and use the following command to generate the graphics file

/ usr/local/php/bin/php / usr/local/apache/htdocs/cacti/poller.php

At this point, the picture may be garbled, because there are no character files under / usr/share/fonts/.

The solution to this problem is very simple, just copy a .ttf file to / usr/share/fonts/

You can make a picture.

9. Join the crontab service

* / 5 * env LANG=C / usr/local/bin/php / usr/local/apache/htdocs/cacti/poller.php

10. After a while, there will be a data graph.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report