Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1839710
  • 博文数量: 117
  • 博客积分: 2559
  • 博客等级: 少校
  • 技术积分: 4385
  • 用 户 组: 普通用户
  • 注册时间: 2010-08-13 20:08
个人简介

作为初学者,要想取得进步,成为高手,首先应该了解自己的不足之处.

文章分类

全部博文(117)

文章存档

2014年(1)

2013年(25)

2012年(13)

2011年(77)

2010年(1)

分类: 系统运维

2011-03-28 15:19:48

监控网络流量cacti
    1. 所需软件

RRDTool 1.0.49 or 1.2.x or greater

MySQL 4.1.x or 5.x or greater

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

A Web Server e.g. Apache or IIS

 

  1. 安装MySQLphp

yum install mysql mysql-server mysql-devel

yum install httpd php php-mysql php-snmp

yum install net-snmp net-snmp-utils net-snmp-devel需要在被监控的服务器安装并启动

 

  1. 测试SNMP协议

编辑SNMP配置文件

vim /etc/snmp/snmpd.conf

添加

com2sec notConfigUser   localhost     public

测试命令

snmpwalk -v 2c -c public localhost if

 

  1. 安装cacti

cacti-0.8.7g

cacti-plugin-0.8.7g-PA-v2.8.tar.gz(插件扩展暂时未装)

cacti-spine-0.8.7g.tar.gz

 

useradd cacti

tar xzvf cacti-0.8.7g.tar.gz

mv cacti-0.8.7g /var/www/html/cacti

chown -R cacti.cacti /var/www/html/cacti

mysqladmin --user=root create cacti

mysql cacti < cacti.sql

 

MySQL中创建用户cacti

mysql> GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'cacti';

mysql> flush privileges;

  1. 修改配置文件include/config.phpinclude/global.php

$database_type = "mysql";

$database_default = "cacti";

$database_hostname = "localhost";

$database_username = "cacti";

$database_password = "cacti";

$database_port = "3306";

 

  1. 定时任务(crontab -u cacti -e

*/5 * * * * /usr/bin/php /var/www/html/cacti/poller.php > /dev/null 2>&1

  1. 安装spine

版本 cacti-spine-0.8.7g.tar.gz

yum install net-snmp net-snmp-utils net-snmp-devel

./configure

make

make install

测试可用性

# /usr/local/spine/bin/spine

SPINE: Using spine config file [../etc/spine.conf]

SPINE: Version 0.8.7g starting

SPINE: Time: 0.1286 s, Threads: 1, Hosts: 3

不指定路径安装后在/usr/local/spine目录下

 

  1. 重构rra文件的目录结构(优化部分)
    1. crontab里暂停poller.php
    2. 然后执行cli目录下的structure_rra_paths.php

/usr/bin/php structure_rra_paths.php --proceed

它会将所有的RRD文件按照device重新分配目录

  1. 修改数据库中的RRD路径

Settings>Paths

  1. 恢复poller.phpcrontab

 

  1. 参考

阅读(5187) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~