bgey 发表于 2019-1-10 09:36:20

nagios+cacti

  原文地址:http://www.51ou.com/browse/linuxjk/32799.html
  
  Centos6.2 一、安装环境LAMP #yum -y install gcc* glibc* gd*
  #yum -y install httpd mysql-server perl-DBI perl-DBD-MySQL php php-devel php-mysql php-snmp php-pdophp-gd lm_sensors net-snmp net-snmp-libs net-snmp-utils net-snmp-devel
  # chkconfig
  Centos6.2
  一、安装环境LAMP
  #yum -y install gcc* glibc* gd*
  #yum -y install httpd mysql-server perl-DBI perl-DBD-MySQL php php-devel php-mysql php-snmp php-pdophp-gd lm_sensors net-snmp net-snmp-libs net-snmp-utils net-snmp-devel
  # chkconfig mysqld on
  # chkconfig httpd on
  # chkconfig snmpd on
  # service mysqld start
  # service httpd start
  # service snmpd start
  #vim /var/www/html/index.php
  
  访问http://localhost/index.php
http://www.51ou.com/uploads/allimg/131107/221001JL-0.png
  # mysqladmin -u rootpassword '123'
  报错处理: # export PATH=$PATH:/usr/local/mysql/bin
  # mysql -u root –p
  :输入密码
  mysql>create database cacti default character set utf8;
  mysql>drop database cacti;
  Query OK, 1 row affected (0.00 sec)

  mysql>grant all on cacti.* to cacti@localhost>  mysql>revoke all on cacti.* fromcacti@localhost;
  Query OK, 0 rows affected (0.01 sec)
  mysql>flush privileges;
  Query OK, 0 rows affected (0.00 sec)
  mysql> \q
  二、安装cacti
  1、安装rrdtool需要的软件包
  # yum -y install cairo-devel libxml2-devel pango pango-devel
  2、安装rrdtool
  可以在chinaunix下去下载
  
  # tar xf 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/#此步非常重要
  如果源码包安装不了可以使用yum
  #yum install rrtdtool
  3、安装cacti-0.8.7.e中文版
  cacti下载地址:http://download.chinaunix.net/download/0001000/85.shtml
  对于centos6.5安装的mysql5.5此安装包不兼容,对于centos6.5要下cacati-0.8.7i.tar.gz
  # tar xvf090815172648.gz -C /var/www/html
  # cd /var/www/html
  # mv cacti-0.8.7e-cn-utf8/cacti
  # mysql -ucacit –p cacti /dev/null2>&1
  # service crond restart
  三、被监控端配置
  1、安装snmp服务
  #yum install lm_sensors net-snmp
  2、修改配置文件如下这里我省略掉了#行和空行
  只改了下面三行下面的地址是cacti服务器地址由于是本机测试所以是127.0.0.1
  #vim /etc/snmp/snmpd.conf
  41 com2sec notConfigUser 127.0.0.1 public
  62 access notConfigGroup"" any noauth exact all none none
  85 view all included .1 80
  3、重启服务
  # service httpd restart
  # service mysqld restart
  # service snmpd restart
  #到此就差不多了我们可以做些检测在服务器上有信息返回说名正常
  #snmpwalk -cpublic -v 2c localhost
  # snmpwalk -v 1 -c public localhost IP-MIB::ipAdEntIfIndex
  4、浏览器输入http://192.168.163.143/cacti/install初始化cacti最后如下
  如果打开网页页面出现空白那么说明数据库没有导入进去重新导入数据库后重启httpd服务即可
  RRDTOOLS版本默认为1.0.x改为1.3.x就行了
http://www.51ou.com/uploads/allimg/131107/22100151a-1.png
  如果打开未看到生成图像请手动执行下面命令
  #/usr/bin/php/var/www/cacti/poller.php &>/dev/null手动生成图像
http://www.51ou.com/uploads/allimg/131107/221001GG-2.png
  5、字体在图形中显示不正常的解决方法
  下载并安装中文字体我用的是微米黑字体
  wgethttp://sourceforge.net/projects/wqy/files/wqy-microhei/0.2.0-beta/wqy-microhei-0.2.0-beta.tar.gz
  #tar zxvf wqy-microhei-0.2.0-beta.tar.gz
  # cd wqy-microhei
  # cp wqy-microhei.ttc /usr/share/fonts/wqy-microhei.ttc
  安装完成后注意在"设置"中更改下面两个必改项.
  常规->RRDTool应用程序版本改为1.3.x,默认为1.0.x.不改可能图像不能正常显示出来.
  路径->RRDTool默认字体路径改为上面安装的文件路径如/usr/share/fonts/wqy-microhei.ttc
  6、安装插件cacti-plugin
  #wget http://blogimg.chinaunix.net/blog/upfile2/090818213852.gz
  # mv 090818213852.gz cacti-plugin-0.8.7d-PA-v2.4-cn-utf8.diff.gz
  # gunzip cacti-plugin-0.8.7d-PA-v2.4-cn-utf8.diff.gz
  # mv cacti-plugin-0.8.7d-PA-v2.4-cn-utf8.diff /var/www/html/cacti/
  # cd /var/www/html/cacti/
  # patch -p1 -N
页: [1]
查看完整版本: nagios+cacti