天天看點

centos4.7 + cacti監控配置

author:skate

time:2009-5-20

centos4.7 +cacti監控配置

最近在配置一套監控系統,cacti+nagios

CACTI: 的确是一款很友好的軟體,可以很直覺的檢視主機的性能負載,磁盤使用率,

       網絡流量等情況,但唯一遺憾就是不能實作對關鍵服務或程序進行監控的功能

       這個東東配置起來,還是比較容易的,隻要參考官文文檔,安裝很順利。

本機需要的元件的版本:

[[email protected] ~]# rpm -qa |grep httpd

httpd-2.0.52-41.ent.2.centos4

[[email protected] ~]# rpm -qa |grep php

php-4.3.9-3.22.15

php-snmp-4.3.9-3.22.15

php-mysql-4.3.9-3.22.15

[[email protected] ~]# rpm -qa |grep mysql

mysql-4.1.22-2.el4

mysql-server-4.1.22-2.el4

[email protected] ~]# rpm -qa |grep net-snmp

net-snmp-libs-5.1.2-13.el4_7.3

net-snmp-5.1.2-13.el4_7.3

net-snmp-utils-5.1.2-13.el4_7.3

net-snmp-devel-5.1.2-13.el4_7.3

net-snmp-libs-5.1.2-13.el4_7.3

net-snmp-perl-5.1.2-13.el4_7.3

Cacti requires that the following software is installed on your system.

1. RRDTool 1.0.49 or 1.2.x or greater

2. MySQL 4.1.x or 5.x or greater

3. PHP 4.3.6 or greater, 5.x greater highly recommended for advanced features

4. A Web Server e.g. Apache or IIS

操作步驟:

1. Required Packages for RPM-based Operating Systems

2. Ports for FreeBSD

3. Configure PHP

4. Configure the Webserver (Apache)

5. Configure MySQL

6. Install and Configure Cacti

7. (Optional) Install and Configure Spine

8. Apply Patches

一。系統需要安裝的元件(Required Packages for RPM-based Operating Systems)

httpd

php

php-mysql

php-snmp

mysql

mysql-server

net-snmp

因為我用的是centos,是以安裝這些元件很簡單,隻要yum就可以了

在安裝之前先檢查這些元件是否已經被安裝到系統上了

eg:

root> rpm -qa | grep httpd

安裝:

root> yum install httpd

root> yum install php

root> yum install php-mysql

root> yum install php-snmp

root> yum install mysql

root> yum install mysql-server

root> yum install net-snmp

二。Ports for FreeBSD

1. www/apache2

2. net/rrdtool

3. net/net-snmp

4. www/php4-cgi

5. lang/php4 (With MySQL and SNMP Support)

6. databases/mysql323-server

三。Configure PHP

Please find the file /etc/php.ini and make the following changes to it:

extension_dir = /etc/php.dThis will enable PHP to find more configuration directives in that very directory.

Activate the MySQL extension via /etc/php.d/mysql.ini

; Enable mysql extension module

extension=mysql.soActivate the SNMP extension via /etc/php.d/snmp.ini

; Enable snmp extension module

extension=snmp.soIf using PHP 4.3.5 or less include the following line. If using 4.3.6 or greater, you should remove this line if present.

session.save_path=/tmpIf you want to allow template importing, uncomment the following line:

file_uploads = On

四。Configure the Webserver (Apache)

一般就需要修改,我就沒有做任何修改;如果要修改,請按如下修改:

If you are using Apache 1.3.x, installation of PHP 5 is not recommended.

Please find the file /etc/httpd/conf/httpd.conf or equivalent and make the following changes to it:

# Load config files from the config directory "/etc/httpd/conf.d".

Include conf.d5 * * * * cactiuser php /var/www/html/cacti/poller.php > /dev/null 2>&1

Replace cactiuser with the valid user specified in the previous step.

Replace /var/www/html/cacti/ with your full Cacti path.

Point your web browser to:

http://your-server/cacti/

Log in the with a username/password of admin. You will be required to change this password immediately. Make sure to fill in all of the path variables carefully and correctly on the following screen.

七。(Optional) Install and Configure Spine

Spine is a very fast poller engine, written in C. It is an optional replacement for cmd.php. If you decide to use it, you will have to install it explicitely. It does not come with cacti itself.

The easiest way is to install Spine using rpm or ports. You will find packages for Spine at the main cacti site or from your distribution.

To compile Spine, please download it to any location of your liking. Then, please issue from the downloaded directory following commands

shell>aclocal

shell>libtoolize --force  (glibtoolize --force on Max OS)shell>autoheader

shell>autoconf

shell>automake

shell>./configure

shell>make

shell>make install

Assuming, you've managed to install Spine correctly, you will have to configure it. The configuration file may be placed in the same directory as Spine itself or at /etc/Spine.conf.

DB_Host 127.0.0.1 or hostname (not localhost)

DB_Database cacti

DB_User  cactiuser

DB_Password cacti

DB_Port  3306All other pre 0.8.6 settings are obsolete.

按着如上的文檔配置,一般是不會有問題的,都會成功

配置很簡單, 關鍵是如何使用

---end---

參考文檔如下:

CACTI官方安裝文檔

http://www.cacti.net/downloads/docs/html/index.html

http://gzmaster.blog.51cto.com/299556/72099

mysql使用

http://www.yesky.com/187/1754687_3.shtml

cacti的使用

http://blog.sina.com.cn/s/blog_4e424e2101000b6o.html