Nginx平台搭建请参考:Nginx mysql php-fpm搭建高性能Nginx平台
实验环境如下:
监控主机:192.168.1.210(www rrdtool net-snmpd cacti spine)
被监控机:192.168.1.199(net-snmpd)
1、看看软件列表:
cacti-0.8.7g.tar.gz
cacti-plugin-0.8.7g-PA-v2.8.tar.gz
cacti-spine-0.8.7g.tar.gz
monitor.tar.gz
net-snmp-5.2.6.tar.gz
rrdtool-1.4.5.tar.gz
settings-0.5.zip
thold-0.4.3.tar.gz |
2、安装rrdtool
安装rrdtool所需的包有很多,可以用yum来搞定
yum install -y freetype-devel zlib libpng freetype libart_lgpl libart_lgpl-devel pango-devel* cairo-devel*
|
然后安装rrdtool
tar zxf rrdtool-1.4.5.tar.gz
cd rrdtool-1.4.5
./configure --prefix=/usr/local/rrtool --disable-python --disable-tcl
make && make install
|
3、安装net-snmp
tar zxvf net-snmp-5.2.6.tar.gz
cd net-snmp-5.2.6
./configure --prefix=/usr/local/net-snmp --enable-developer
make
make install
|
copy一份配置模板过去:
cp EXAMPLE.conf /usr/local/net-snmp/share/snmp/snmpd.conf |
启动snmpd:
/usr/local/net-snmp/sbin/snmpd -c /usr/local/net-snmp/share/snmp/snmpd.conf |
被监控机要安装这东西,还需要进行一个简单的配置:
vi /usr/local/net-snmp/share/snmp/snmpd.conf |
加上一行:
# sec.name source community
com2sec local localhost COMMUNITY
com2sec mynetwork NETWORK/24 COMMUNITY
com2sec local 192.168.1.210 public #允许监控主机来抓取数据 |
4、安装cacti
tar zxvf cacti-0.8.7g.tar.gz
mv cacti-0.8.7g /home/www/lihp.com/cacti
|
创建系统用户并授权:
useradd cacti
chown cacti:cacti /home/www/lihp.com/cacti
|
创建数据用户并授权:
mysql -uroot -p123456 -e "create database cacti"
mysql-uroot -p123456 -e "GRANT ALL PRIVILEGES ON cacti.* TO ''cacti''@localhost IDENTIFIED BY ''cacti''"
|
导入数据库并修改配置:
mysql -ucacti -pcacti cacti < /home/www/lihp.com/cacti/cacti.sql |
vi /home/www/lihp.com/cacti/include/config.php |
根据实际情况修改以下内容:
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cacti";
$database_password = "cacti";
$database_port = "3306"; |
|