当前位置: 首页 > others > 正文

Cacti网络监控软件的安装、配置与使用连载 (1) — By 2hei

1 系统介绍

Cacti是一种免费的网络监控系统,监控端通过SNMP(简单网络管理协议)来获取被监控系统的相关信息,具有很强的数据管理和用户管理功能,一台机器可以监控多台服务器,并且提供了树状的管理结构图,可以直观地对多台主机在一个控制台上进行分类维护。还可以根据需要定制系统监控信息,做出符合需求的监控图。

2 系统安装

2.1 系统所需软件(for linux)

net-snmp http://net-snmp.sourceforge.net/download.html

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

apache2 http://httpd.apache.org/download.cgi

php(gd) http://www.php.net

rrdtool http://www.rrdtool.org

cacti http://www.cacti.net

以上软件建议到官方网站Download较新的版本。

2.2 服务器端安装步骤

2.2.1 安装Mysql( source code版本)

# groupadd mysql

# useradd -g mysql mysql

# gunzip < mysql-VERSION.tar.gz | tar -xvf – # cd mysql-VERSION # ./configure --prefix=/usr/local/mysql # make # make install # cp support-files/my-medium.cnf /etc/my.cnf # cd /usr/local/mysql # bin/mysql_install_db --user=mysql # chown -R root . # chown -R mysql var # chgrp -R mysql . # bin/mysqld_safe --user=mysql & //启动mysql 2.2.2 安装Apache #tar –zxvf httpd-2.*.*.tar.gz //建议使用apache2 #cd httpd-2.*.* #./configure --prefix=/usr/local/apache --enable-so #make && make install #cd /usr/local/apache/bin #./apachectl start //启动apache 测试:http://youIP 2.2.3 安装PHP 因为需要GD库支持,在安装php前安装GD 安装GD库 #tar –zxvf gd-2.0.33.tar.gz #cd gd-2.0.33 #./configure #make && make install 安装libpng #tar –zxvf libpng-1.2.8-config.tar.gz #cd libpng-1.2.8-config #./configure #make && make install 安装php #tar –zxvf php-VERSION.tar.gz #cd php-VERSION.tar.gz #./configure --prefix=/usr/local/php >–with-apxs2=/usr/local/apache/bin/apxs

>–with-config-file-path=/usr/local/php

>–enable-sockets

>–with-mysql=/usr/local/mysql

>–with-zlib-dir=/usr/include

>–with-gd

#make && make install

#cp php.ini-dist /usr/local/php/php.ini

vi /usr/local/conf/httpd.conf

在文件最后加入:

###############for php and cacti###################

AddType application/x-tar .tgz

AddType application/x-httpd-php .php

AddType image/x-icon .ico

DirectoryIndex index.php index.html index.html.var

#######################over########################

/usr/local/apache/bin/apachectl restart

2.2.4 为Cacti设置Mysql

/usr/local/mysql/bin/mysql -u root –p

mysql> set password for [email protected]=password(‘cactipw’);

mysql> Query OK, 0 rows affected (0.00 sec)

mysql> create database cactidb;

mysql> grant all on cacti.* to root;

mysql> grant all on cacti.* to [email protected];

mysql> grant all on cacti.* to cactiuser;

mysql> grant all on cacti.* to [email protected];

mysql> set password for [email protected]=password(‘cactipw’);

mysql> flush privileges; (See cacti docs/INSTALL)

mysql> exit

2.2.5 安装rrdtool

#tar –zxvf rrdtool-1.0.50.tar.gz //rrdtool-1.2.8 测试安装不成功

#./configure configure –prefix=/usr/local/rrdtool-1.0.50

#make && make install

2.2.6 安装net-snmp

默认Linux是安装了snmp的,建议安装最新版本的snmp

#tar –zxvf net-snmp-5.1.3.1.tar.gz

#cd net-snmp-5.1.3.1

#./configure

#make && make install

2.2.7 安装cacti

#cp cacti-0.8.6g.tar.gz /usr/local/apache/htdocs //目前最新版0.8.6h

#tar xzvf cacti-0.8.6g.tar.gz

#mv cacti-0.8.6g cacti

#cd cacti

#/usr/local/mysql/bin/mysql –u root –psccmrtg cacti < cacti.sql #chown –R cactiuser rra/ log/ 修改cacti配置文件 #vi /usr/local/apache/htdocs/cacti/include/config.php $database_type = “mysql”; $database_default = “cactidb”; database_hostname = “localhost”; $database_username = “cactiuser”; $database_password = “cactipw”; 增加cactiuser #useradd cactiuser #passwd –g users cactiuser #su – cactiuser #crontab –u cactiuser –e 输入 */5 * * * * /www/php/bin/php /www/htdocs/cacti/poller.php > /dev/null 2>&1

#/etc/init.d/crond restart

2.2.8 Cacti安装配置

http://IP/cacti

1. 点击 Next

2. Default (New Install) -> Click Next

3. 修改 php 和 rrdtool 的安装路径

RRDTOOL = /usr/local/rrdtool-1.0.50/bin/rrdtool

PHP = /usr/localphp/bin/php

4. 点击 Finish

5. 首次登陆用户名和密码 admin/admin

6. 修改用户口令和密码

7. 点击 Save

2.3 客户端(被监控端)安装步骤及相关配置

被监控端只要安装和配置好snmp即可,具体如下:

2.3.1 Linux操作系统

2.3.1.1 安装

具体安装步骤见2.2.6

Snmp安装好以后检测是否成功

# snmpd –v

如果返回以下信息,说明安装成功

NET-SNMP version: 5.1.3.1

Web: http://www.net-snmp.org/

Email: [email protected]

本文固定链接: http://2hei.net/cacti%e7%bd%91%e7%bb%9c%e7%9b%91%e6%8e%a7%e8%bd%af%e4%bb%b6%e7%9a%84%e5%ae%89%e8%a3%85%e3%80%81%e9%85%8d%e7%bd%ae%e4%b8%8e%e4%bd%bf%e7%94%a8%e8%bf%9e%e8%bd%bd-1-by-2hei.html | 2hei's site

该日志由 2hei 于2007年05月16日发表在 others 分类下,
原创文章转载请注明: Cacti网络监控软件的安装、配置与使用连载 (1) — By 2hei | 2hei's site

报歉!评论已关闭.