天天看点

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