免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 960 | 回复: 0
打印 上一主题 下一主题

完善的流量系统之一 cacti [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-12-27 14:46 |只看该作者 |倒序浏览
1. Extract the distribution tarball.
shell> tar xzvf cacti-version.tar.gz
    2. Create the MySQL database:
shell> mysqladmin --user=root create cacti
    3. Import the default cacti database:
shell> mysql cacti  mysql --user=root mysql
mysql> GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'somepassword';
mysql> flush privileges;
    5. Edit include/config.php and specify the MySQL user, password and
       database for your Cacti configuration.
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "cacti";
    6. Set the appropriate permissions on cacti's directories for graph/log
       generation. You should execute these commands from inside cacti's
       directory to change the permissions.
shell> chown -R cactiuser rra/ log/
       (Enter a valid username for cactiuser, this user will also be used in
       the next step for data gathering.)
    7. Add a line to your /etc/crontab file similar to:
*/5 * * * * 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.
    8. 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.
很简单是吧,下面开始我们的傻瓜化完全无Tarbll安装之旅,安装环境是Centos 4.3 single server CD的系统,所以,除了apache/php/mysql也没啥东西,而且现有系统还跑着个PHPBB和postfix,不能为了个流量监控伤筋动骨。所有的组件都是centos自己带的,基本上是默认安装
一。安装 net-snmp
yum install net-snmp*
注意加个*,把所有的咚咚都装上,否则没有cacti需要的命令.
二。安装 php-snmp
yum install php-snmp
所有CU的cacti文章都没提到这个组件,可是我rpm cacti的时候确实需要了,管它呢,咱有yum
三.安装rrdtool
wget ftp://ftp.pbone.net/mirror/atrpms.net/el4-i386/atrpms/stable/rrdtool-1.0.50-25.el4.at.i386.rpm
rpm -ivh rrdtool-1.0.50-25.el4.at.i386.rpm
四。安装cacti
wget
http://www.cacti.net/downloads/cacti-0.8.7a.tar.gz
tar zxvf cacti-0.8.7a.tar.gz
cp -a ./cacti-0.8.7a /var/www/html/cacti
cd /var/www/html/cacti/
useradd cactiuser
chown -R cactiuser rra/ log/

基本上,该装的都装了,我们只要完成最开始的INSTALL里的2,3,4,5,7就可以了,因为rpm把1,6都给做了,包括建立系统用户
五。 mysqladmin --user=root create cacti
注意,mysql有密码的自己添加密码,我的mysql因为只给localhost的php用,所以没加密码,直接copy执行
六。mysql cacti  mysql --user=root mysql
mysql> GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'cacti';
mysql> flush privileges;
这个就照着install做吧,不过把这个'somepassword'替换成自己需要的密码,如果密码设置为'cacti',第八部可以不作
八。vi /var/www/html/cacti/include/config.php
$database_password = "cacti";
就改这一行口令就可以了,别的都是默认
九。crontab -e
插入
*/5 * * * * cactiuser php /var/www/html/cacti/poller.php > /dev/null 2>&1
保存退出。
现在 键入http://yourserver/cacti看看吧,如果没有页面的话,首先检查一下你的apache的Document root是不是 /var/www/html,要是不是的话,自己换一下目录指向或者干脆给cacti建立个虚拟主机
如果安装在fedora 系统上
yum install cacti
yum install net-snmp*

在/etc/httpd/conf.d/cacit.conf
==============================
#
# Cacti: An rrd based graphing tool
#
Alias /cacti    /usr/share/cacti
        Order Deny,Allow
        Deny from all
        Allow from 127.0.0.1
==============================
在apache的配置里面只允许localhost访问/cacti这个虚拟目录。

解决:访问权限,403
[root@elm ~]# cd /etc/cron.d
[root@elm cron.d]# more cacti
*/5 * * * *     cacti   /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1
解决:自动运行问题。

drwxr-xr-x   7 root root  4096 2008-01-02 04:11 cacti
lrwxrwxrwx   1 root root    18 2008-01-02 04:11 rra -> /var/lib/cacti/rra
lrwxrwxrwx   1 root root    15 2008-01-02 04:11 log -> /var/log/cacti/

chown -R cacti
chgrp -R apache
drwxrwxr-x  2 cacti apache 4096 2008-01-02 06:55 rra
drwxrwxr-x  2 cacti   apache    4096 2008-01-02 04:11 cacti

解决:图息生成问题,如果不能相成图,一般都是权限不够造成。






本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/45117/showart_451370.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP