这是基于LAMP架构基础上的,LAMP安装之前已经介绍,这里不再讨论
net-snmp
#
yum install net-snmp* -y
#
vim /etc/snmp/snmpd.conf
#
grep -Ev '^#|^$' /etc/snmp/snmpd.conf
com2sec notConfigUser 192.168.0.0/255.255.255.0 public
group notConfigGroup v1 notConfigUser
group notConfigGroup v2c notConfigUser
view systemview included .1.3.6.1.2.1.1
view systemview included .1.3.6.1.2.1.25.1.1
access notConfigGroup "" any noauth exact all none none
view all included .1 80
syslocation Unknown (edit /etc/snmp/snmpd.conf)
syscontact Root <root@localhost> (configure /etc/snmp/snmp.local.conf)
dontLogTCPWrappersConnects yes
disk /
#
============================================================================
修改snmpd.conf
1.查找以下字段:
# sec.name source community
com2sec notConfigUser default public
将"comunity"字段改为你要设置的密码.比如"bizcnpublic".
将“default”改为你想哪台机器可以看到你的snmp信息,如10.10.10.10。授权服务器IP
2.查找以下字段:
####
# Finally, grant the group read-only access to the systemview view.
# group context sec.model sec.level prefix read write notif
access notConfigGroup "" any noauth exact systemview none none
将"read"字段改为 all.
代码:
#access notConfigGroup "" any noauth exact all none none
3.查找以下字段:
## incl/excl subtree mask
#view all included .1 80
将该行前面的"#"去掉.
disk /
保存、关闭
============================================================================
#
/etc/init.d/snmpd restart
停止 snmpd: [确定]
正在启动 snmpd: [确定]
#
cacti
rrdtool
#
yum localinstall rrdtool-devel-1.3.8-6.el6.i686.rpm
#
tar xf php_rrdtool.tar.gz
#
cd rrdtool
#
phpize
Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626
#
./configure --with-php-config=/usr/local/bin/php-config --with-rrdtool=/usr
#
make && make install
#
vim /usr/local/lib/php.ini
#
grep rrdtool -B 1 /usr/local/lib/php.ini
extension_dir="/usr/local/lib/php/extensions/no-debug-non-zts-20090626/"
extension="rrdtool.so"
#
/etc/init.d/apache restart
cacti
#
tar xf cacti-0.8.8a.tar.gz -C /www/
#
mv /www/cacti-0.8.8a /www/cacti
#
mysql -u root -p
Enter password:
mysql> create database cacti;
mysql> use cacti;
mysql> source /www/cacti/cacti.sql;
mysql> grant all on cacti.* to 'cacti'@'localhost' identified by '123';
mysql> flush privileges;
#
vim /www/cacti/include/config.php
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cacti";
$database_password = "123";
$database_port = "3306";
浏览器登录http://x.x.x.x/cacti/
默认用户名和密码如下(登录后提示修改)
user:admin
password:admin
#
crontab -e
*/5 * * * * /usr/local/bin/php /www/cacti/poller.php > /dev/null 2>&1