Cacti 部署
所需软件:
beecrypt-4.1.2.tar.gz
net-snmp-5.4.2.1.tar.gz
rrdtool-1.4.4.tar.gz
cacti-0.8.7g.tar.gz
cacti-spine-0.8.7g.tar.gz
- yum install cairo-devel libxml2-devel pango pango-devel libart_lgpl-devel mysql-server -y
- rpm -qa cairo-devel libxml2-devel pango pango-devel libart_lgpl-devel mysql-server
安装 Snmp
- tar zxvf beecrypt-4.1.2.tar.gz
- cd beecrypt-4.1.2
- ./configure
- make
- make install
- cp /usr/local/lib64/libbeecrypt.la /usr/lib64/libbeecrypt.la
- ln -s /usr/lib64/libelf.so.1 /usr/lib64/libelf.so
- cd ..
- tar zxvf net-snmp-5.4.2.1.tar.gz
- cd net-snmp-5.4.2.1
- ./configure
看到上图,刚配置成功,提示时,选择2即可,下面的直接回车!
- make
- make install
- cp EXAMPLE.conf /etc/snmp/snmpd.conf
- ln -s /usr/local/share/bin/* /usr/local/bin/
- cd ..
#启动 snmp
- /usr/local/sbin/snmpd -d
- echo "/usr/local/sbin/snmpd -d" >/etc/rc.local
- dos2unix /usr/share/snmp/snmpd.conf
- netstat –lntup
- tar zxvf rrdtool-1.4.4.tar.gz
- cd rrdtool-1.4.4
- ./configure --prefix=/usr/local/rrdtool
- make && make install
- ln -s /usr/local/rrdtool/bin/* /usr/local/bin/
- cd ..
cacti安装
-------------------------------------
- tar xzvf cacti-0.8.7g.tar.gz
- cd cacti-0.8.7g
- service mysqld start
- chkconfig mysqld on
- mysqladmin -uroot password "elain"
- mysql -uroot -p'elain' -e "create database cacti"
- mysql -uroot -p'elain' cacti < cacti.sql
- mysql -uroot -p'elain'
- GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'elain';
- flush privileges;
- quit
修改cacti的配置文件
- vi include/config.php
- useradd cactiuser
chown -R cactiuser rra/ log/
- useradd cactiuser
- chown -R cactiuser rra/ log/
crontab –e //设置定时任务
- */5 * * * * /usr/bin/php /var/www/html/cacti/poller.php > /dev/null 2>&1
- mv ../cacti-0.8.7g /var/www/html/cacti
访问http://10.0.0.86/cacti/ 开始安装
注:安装时看检查各文件路径,如果出现没找到的,请手动更改路径!!
登录进入 admin elain 第一次登录需修改密码
在setting里配置SNMP rrdtool的正确路径
若无法出图,使用以下命令:
- /usr/bin/php /var/www/html/cacti/poller.php
出图效果:
看到上面的图,说明Cacti服务端已经安装完成!!
被监控端配置(LAMP,LNMP,LB1,LB2,DB1,DB2,BAK配置基本一样,以LAMP为例)
LAMP
被监控端所需软件:
- rpm -qa |grep net-snmp
- yum install net-snmp -y
- vi /etc/snmp/snmpd.conf
- # First, map the community name "public" into a "security name"
- # sec.name source community
- com2sec notConfigUser default public
- -----
- 改为:(约112行)
- -------
- # First, map the community name "public" into a "security name"
- # sec.name source community
- com2sec notConfigUser 10.0.0.110 public
----------------------------------------
//修改IP为监控服务器的IP 团体名也可以自己设置, 默认为 public
- service snmpd start
- chkconfig snmpd on
Cacti服务端添加主机
Console 选择 Create devices 进入后,在右上角点 Add 添加
填写完毕后,点击右下角 Create 创建
看到此图,说明被监控端添加成功!!
为这个主机创建图像,
点击右下角 Creat 创建,下一步,一步步完成!
点击 Graphs 选择第三项 View your new graphs看到上图说明监控成功!!!
注:添加每台主机都如此操作即可,这里就不一一添加了。
到此,Nagios监控服务器部署完毕!!!
转载请注明: 转载自http://www.elain.org
本文链接地址:[跟我学中小企业架构部署]之七:监控系统cacti部署