(ii) Cacti monitoring

Source: Internet
Author: User

First, Cacti the installation

1. Installation environment:RedHat as 4

2. Install Apache, MySQL, PHP

(1). Install MySQL

: http://dev.mysql.com/downloads/mysql/5.0.html

Check to see if MySQL is already installed on the system, and if it is uninstalling all packages starting with MySQL.

# Rpm–qa | grep MySQL

# rpm–e mysql-*

Look for/etc/my.cnf (MySQL option profile), if you have to delete it, so as not to affect the start of the new installation version.

# RM–F/ETC/MY.CNF

# TAR–ZXVF Mysql-standard-5.0.27-linux-i686-glibc23.tar.gz

# CP–RF mysql-standard-5.0.27-linux-i686-glibc23/usr/local/

Create a symbolic link, if you have a new version of MySQL later, you can simply extract the source code to a new path, and then re-make a symbolic link. This is very convenient and the data is more secure.

# Ln–s Mysql-standard-5.0.27-linux-i686-glibc23/usr/local/mysql

Add users and user groups to start MySQL (if you have previously installed MySQL, users and user groups may already exist).

# useradd MySQL

# Groupadd MySQL

Initialize Authorization table

# Cd/usr/local/mysql

# scripts/mysql_install_db

Modify the ownership of the MySQL directory

# cd/usr/local

# chgrp–r MySQL mysql-standard-5.0.27-linux-i686-glibc23

# chgrp–r MySQL MySQL

# chown–r MySQL Mysql-standard-5.0.27-linux-i686-glibc23/data

# chown–r MySQL Mysql/data

# ln–s/usr/local/mysql/bin/*/usr/local/bin/

Start MySQL

# Bin/safe_mysqld--user=mysql &

Configure the system to start MySQL automatically when it starts

# CP Support-files/mysql.server/etc/rc.d/init.d/mysqld

# chkconfig--add mysqld

Modify the maximum number of connections for MySQL

# VI/ETC/MY.CNF

Add the following line

[Mysqld]
set-variable=max_connections=1000
set-variable=max_user_connections=500

set-variable=wait_timeout=200

Max_connections Setting the maximum number of connections is 1000

Max_user_connections Setting the maximum number of connections per user is 500
Wait_timeout indicates that the idle connection will be closed after 200 seconds, but does not affect the working connection.

Save exit and restart MySQL

After restarting MySQL, use the following command to see if the changes were successful

# mysqladmin-uroot-p variables

Password:

You can see the following entry indicating the success of the modification

| max_connections | 1000

| max_user_connections | 500

| Wait_timeout | 200

(2). Installing Apache

: http://httpd.apache.org/

# TAR–ZXVF Httpd-2.2.4.tar.gz

# CD httpd-2.2.4

#./configure--prefix=/usr/local/apache--enable-so

Compile-time plus load module parameters--enable-so

# make

# make Install

#vi/usr/local/apache/conf/httpd.conf

Modify the Apache configuration file, add servername www.yourdomain.com (or servername native IP)

# vi/etc/rc.d/rc.local

Add a row/usr/local/apache/bin/apachectl–k start on the rc.local, and the Apache service starts when the system starts.

(3). Install PHP

Install Zlib,freetype,libpng,jpeg first to allow PHP to support the GD library (cacti's Weathermap plugin must be more supported than the new GD library)

Library files: http://oss.oetiker.ch/rrdtool/pub/libs/
1). Install zlib

Tar zlib-1.2.3.tar.gz
CD zlib-1.2.3
./configure--prefix=/usr/local/zlib
Make
Make install

2). Install libpng

Tar zxvf Libpng-1.2.16.tar.tar
CD libpng-1.2.16
CD scripts/
MV Makefile.linux. /makefile
Cd..
Make
Make install
Note that the makefile here is not built with./configure, but instead directly from the scripts/.

3). Install FreeType

Tar zxvf freetype-2.3.4. tar.gz
CD freetype-2.3.4
./configure--prefix=/usr/local/freetype
Make
Make install

4). Install JPEG

TAR-ZXF jpegsrc-1.v6b.tar.gz
CD jpeg-6b/
Mkdir/usr/local/libjpeg
Mkdir/usr/local/libjpeg/include
Mkdir/usr/local/libjpeg/bin
Mkdir/usr/local/libjpeg/lib
Mkdir/usr/local/libjpeg/man

Mkdir/usr/local/libjpeg/man/man1

You can create a multi-tiered directory with Mkdir-p/usr/local/libjpeg/man/man1

./configure--prefix=/usr/local/libjpeg--enable-shared--enable-static
Make && make install
Note that this configure must take the--enable-shared parameter, otherwise, the shared library will not be generated

5). Install Fontconfig

TAR-ZXVF fontconfig-2.4.2.tar.gz
CD fontconfig-2.4.2

./configure--with-freetype-config=/usr/local/freetype

Make
Make install

6). Install GD

TAR-ZXVF gd-2.0.34.tar.gz
CD gd-2.0.34
./configure--PREFIX=/USR/LOCAL/LIBGD--with-png--with-freetype=/usr/local/freetype--with-jpeg=/usr/local/ Libjpeg

Make
Make install

The following information is displayed at compile time:

* * Configuration Summary for GD 2.0.34:
Support for PNG Library:yes
Support for JPEG Library:yes
Support for Freetype 2.x Library:yes
Support for Fontconfig Library:yes
Support for XPM Library:no
Support for Pthreads:yes

7). Edit/etc/ld.so.conf, add the following lines to this file.

/usr/local/zlib/lib

/usr/local/freetype/lib

/usr/local/libjpeg/lib

/usr/local/libgd/lib

and execute the ldconfig command to load the shared library using the dynamic loader

8). Install Libxml,redhat as 4 the Libxml package is installed by default, but the version is too low, PHP5 requires a later version of the Libxml package.
# TAR–ZXVF Libxml2-2.6.25.tar.gz
# CD libxml2-2.6.25
#./configure
# make
# make Install

9). Install PHP

Php:http://www.php.net/downloads.php#v5

TAR-ZXVF php-5.2.3.tar.gz
CD php-5.2.3
#./configure--prefix=/usr/local/php--with-apxs2=/usr/local/apache/bin/apxs--with-mysql=/usr/local/mysql-- WITH-GD=/USR/LOCAL/LIBGD--enable-gd-native-ttf--with-ttf--enable-gd-jis-conv--with-freetype-dir=/usr/local/ FreeType--with-jpeg-dir=/usr/local/libjpeg--with-png-dir=/usr--with-zlib-dir=/usr/local/zlib--enable-xml-- Enable-mbstring--enable-sockets

# make

# make Install

# CP Php.ini-recommended/usr/local/php/lib/php.ini

# ln–s/usr/local/php/bin/*/usr/local/bin/

# vi/usr/local/apache/conf/httpd.conf

Find AddType application/x-compress. Z

AddType application/x-gzip. gz. tgz

Add AddType Application/x-tar under it. tgz

AddType application/x-httpd-php. php

AddType Image/x-icon. ico

Modify DirectoryIndex line, add index.php

Modified to DirectoryIndex index.php index.html Index.html.var

# vi/usr/local/apache/htdocs/test.php

Add the following line:

PHP tags (with < instead of [)

[? php

Phpinfo ();

?]

Wq Save exit.

#/usr/local/apache/bin/apachectl–k Stop

#/usr/local/apache/bin/apachectl–k start

Enter: http://www.yourdomain.com/test.php for testing in the browser.

Explanation of the PHP compilation options:

--prefix=/usr/local/php//Specify the installation directory for PHP

--WITH-APXS2=/USR/LOCAL/APACHE2/BIN/APXS//Support Apache module

--with-mysql=/usr/local/mysql//Support MySQL

--WITH-GD=/USR/LOCAL/LIBGD//Support GD Library

--ENABLE-GD-NATIVE-TTF//activating support for local TrueType string functions

--WITH-TTF//Activate support for FreeType 1.x

--with-freetype-dir=/usr/local/freetype//Activate support for FreeType 2.x

--WITH-JPEG-DIR=/USR/LOCAL/LIBJPEG//Activate support for jpeg-6b

--WITH-PNG-DIR=/USR//activating PNG support

--with-zlib-dir=/usr/local/zlib//Activate support for zlib

--enable-mbstring//Activating mbstring module

--enable-gd-jis-conv//Make jis-mapped available, support Japanese fonts

--with-mail//Support mail function

--enable-xml//Support XML

--enable-sockets//Support sockets

1. Installing RRDtool

Because rrdtool-1.2.23 requires some library file support, you need to install the configured supported environment before compiling the installation. Run the following bash script directly to complete the installation:
Note: cgilib-0.5.tar.gz, zlib-1.2.3.tar.gz, libpng-1.2.18.tar.gz, freetype-2.3.5.tar.gz, libart_lgpl-2.3.17.tar.gz, Rrdtool-1.2.23.tar.gz into the/root/rrdtool-1.2.23 directory, save the script as/root/rrdtool-1.2.23/rrdtoolinstall.sh, and give the Execute permission chmod u+x/ Root/rrdtool-1.2.23/rrdtoolinstall.sh.
The following link is a rrdtool-1.2.23 installation package that I have re-punched, which includes all the library files used and the installation script, download and execute the script rrdinstall.sh can complete the RRDtool installation.
Click to download rrdtool-1.2.23.tar.gz

If the above script installation fails, you can try the following installation packages:

Http://61.156.20.41/autodownload/rrdtool-1.2.11.tar.gz

#!/bin/sh
build_dir= ' pwd '
Install_dir=/usr/local/rrdtool
CD $BUILD _dir
Tar zxf cgilib-0.5.tar.gz
CD cgilib-0.5
make CC=GCC cflags= "-o3-fpic-i."
Mkdir-p $BUILD _dir/lb/include
CP *.h $BUILD _dir/lb/include
mkdir-p $BUILD _dir/lb/lib
CP libcgi* $BUILD _ Dir/lb/lib
CD $BUILD _dir
tar  zxf zlib-1.2.3.tar.gz
CD zlib-1.2.3
env cflags= "-o3-fpic"./configure --prefix= $BUILD _dir/lb
Make
Make install
CD $BUILD _dir
Tar zxvf libpng-1.2.18.tar.gz
CD libpng-1.2.18
Env cppflags= "-i$build_dir/lb/include" ldflags= "-l$build_dir/lb/lib" cflags= "-o3-fpic" \
./ Configure--disable-shared--prefix= $BUILD _dir/lb
Make
Make install
CD $BUILD _dir
Tar zxvf freetype-2.3.5.tar.gz
CD freetype-2.2.5
env cppflags= "-i$build_dir/lb/include" ldflags= "-l$build_dir/lb/lib "cflags="-o3-fpic "\
./configure--disable-shared--prefix= $BUILD _dir/lb
make
make install

CD $BUILD _dir
Tar zxvf libart_lgpl-2.3.17.tar.gz
CD libart_lgpl-2.3.17
Env cflags= "-o3-fpic"./configure--disable-shared--prefix= $BUILD _dir/lb
Make
Make install

Ir=-i$build_dir/lb/include
cppflags= "$IR $IR/libart-2.0 $IR/freetype2 $IR/libpng"
Ldflags= "-l$build_dir/lb/lib"
Cflags=-o3
Export Cppflags ldflags CFLAGS

CD $BUILD _dir
Tar zxf rrdtool-1.2.23.tar.gz
CD rrdtool-1.2.23
./configure--prefix= $INSTALL _dir--disable-python--disable-tcl && make && make INSTALL

Establish a symbolic connection after completion

ln–s/usr/local/rrdtool/bin/*/usr/local/bin/

Perform rrdtool to see if the installation is correct

2. Installing NET-SNMP

Redhat The SNMP service is installed by default, but it does not seem to have snmpwalk,snmpget these two commands, so you need to compile and install NET-SNMP.

NET-SNMP Official website: http://www.net-snmp.org/

# tar ZXVF net-snmp-5.2.4.tar.gz

#cd net-snmp-5.2.4
#./configure--prefix=/usr/local/net-snmp--enable-developer
#make
#make Install

# ln–s/usr/local/net-snmp/bin/*/usr/local/bin/

#cp example.conf/usr/local/net-snmp/share/snmp/snmpd.conf

Modify snmpd.conf (Modify community, allow host to crawl SNMP data, fetch data range, etc.).

#/USR/LOCAL/NET-SNMP/SBIN/SNMPD//Start SNMP Service

# vi/etc/rc.d/rc.local

Add a row of/usr/local/net-snmp/sbin/snmpd on rc.local and start the SNMP service when the system starts.

3. Installing cacti

Cacti Official website: www.cacti.net/

# TAR–ZXVF Cacti-0.8.6j.tar.gz

# Mv–r Cacti-0.8.6j/usr/loca/apache/htdocs/cacti

# vi/usr/local/apache/htdocs/cacti/include/config.php

$database _type = "MySQL";

$database _default = "cacti";

$database _hostname = "localhost";

$database _username = "cacti";

$database _password = "cacti";

Add Cacti User

# Useradd Cacti

Take ownership of the RRA directory to cacti users

# Chown–r Cacti/usr/loca/apache/htdocs/cacti/rra

Modify the cacti directory to belong to a group

# Chgrp–r Cacti/usr/loca/apache/htdocs/cacti

To add a cron task to a cacti user

# SU–CACTI

# crontab–e

*/5 * * * */usr/local/bin/php/usr/local/apache/htdocs/cacti/poller.php >/dev/null 2>&1

Note: Use the cacti user when you first execute poller.php, otherwise the generated RRD file cacti will not have write access.

4. Installing Cactid

The following support is required for Cactid installation:

o net-snmp-devel (add--enable-developer option if you need to compile and install NET-SNMP)

o MySQL

o mysql-devel (MySQL source file compiled after installation by default support)

o Openssl-devel (redhat default installation)

# TAR-ZXVF Cacti-cactid-0.8.6i.tar.gz

# CD Cacti-cactid-0.8.6i

#./configure--with-mysql=/usr/local/mysql--with-snmp=/usr/local/net-snmp

# make

At this point you will see more cactid, cactid.conf two files in this directory

# Mkdir/usr/local/cactid

# CP Cactid Cactid.conf/usr/local/cactid

# vi/usr/local/cactid/cactid.conf//Modify Cactid configuration file

Db_host 127.0.0.1

Db_database cacti

Db_user cacti

Db_pass cacti

5. Database Configuration

#mysql –uroot–p

Password:

mysql> CREATE database cacti;

Query OK, 1 row Affected (0.00 sec)

Mysql> Grant all on cacti.* to [e-mail protected] identified by "cacti";

Query OK, 1 row Affected (0.00 sec)

Mysql>exit

# CD/USR/LOCAL/APACHE/HTDOCS/CACTI

# Mysql–uroot–p Cacti < Cacti.sql

Password:

6. Complete the installation of the cacti

1). In the browser, type: http://www.yourdomain.com/cacti/

Default User name: admin Password: admin

2). Change Password

3). Set the command path used by the cacti

snmpwalk Binary Path /usr/local/bin/snmpwalk

snmpget Binary Path /usr/local/bin/snmpget

RRDTool Binary Path /usr/local/bin/rrdtool

PHP Binary Path /usr/local/bin/php

Cacti Log File Path /usr/local/apache/htdocs/cacti/log/cacti.log

cactid poller File Path /usr/local/cactid/cactid

4). Make sure to change the following location after entering cacti: (e.g.)

console> Settings >general

console> Settings >poller

Transferred from: http://blog.sina.com.cn/s/blog_4e424e2101000b5y.html

(ii) 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.