q989 发表于 2017-4-19 13:20:44

cacti 安装配置

  mysql,php,apache看lamp的安装文章
  二、rrdtool安装
  1.到http://oss.oetiker.ch/rrdtool/download.en.html下载rrdtool
  2.  先跟新rrdtool要依赖的软件包
  yum -y install cairo-devel libxml2-devel pango-devel pango libpng-devel freetype freetype-devel libart_lgpl-devel intltool
    3.解压,安装
      ./configure --prefix=/usr/local/rrdtool && make && make install
      用/usr/local/rrdtool/rrdtool -v 查看是否安装成功!
  net-snmp服务的安装
  1.到http://www.net-snmp.org/download/下载net-snmp源码包,进入解压后源码包目录
  (./configure   make && make install)--在监控服务器上安装方法
  2.#./configure --prefix=/usr/local/net-snmp --enable-developer  (加入--enable-developer 是为了支持cactid的,但是目前没有采用cactid,你默认版本、用户名、perl模块和路径之类的问题,一路回车)
  make && make install
  3.cp EXAMPLE.conf /usr/local/net-snmp/share/snmp/snmpd.conf
  4.vi /usr/local/net-snmp/share/snmp/snmpd.conf(修改配置)
  说明:对snmpd.conf的编辑只能用空格,不能用Tab键,否则会出错。
  com2sec local     localhost       public
  com2sec mynetwork 10.0.0.0/24      COMMUNITY (其他可以接受的ip地址)
  5.启动  (这里的启动,是启动snmp的服务器监控端,只有启动了,才能用snmpwalk测试)
  cd /usr/local/net-snmp/sbin/
  ./snmpd -c ../share/snmp/snmpd.conf
  6.测试:/usr/local/net-snmp/bin/snmpwalk -v 2c -c public localhost system
  有返回信息,则安装成功!
  spine的安装
  1. 在http://www.cacti.net/下载最新版本,解压
  2. ./configure --prefix=/usr/local/spine && make && make install 
  用yum安装的net-snmp时,安装spine之前还要yum -y install net-snmp-devel
  cacti安装配置
  1. 在http://www.cacti.net/下载最新版本,解压
  2.copy解压目录到/usr/local/httpd/htdocs/cacti
  3.配置帐号及mysql:
useradd cactiuser
  mysql -uroot -p
mysql> create database cacti;
  mysql> grant all privileges on cacti.* to cactiuser@localhost identified by "cactiuser";
  mysql> flush privileges;
  mysql> exit
  Catci配置:
# mysql cacti -uroot -p < cacti.sql
     mysql cacti 用show tables;查看
     chown -R root.root cacti/
# chown -R cactiuser rra/ log/
# vi include/config.php

[*]$database_type = "mysql";
[*]$database_default = "cacti";
[*]$database_hostname = "localhost";
[*]$database_username = "cactiuser";
[*]$database_password = "cactiuser";
[*]$database_port = "3306";


  配置让系统每五分钟去取一次snmp数据:
#crontab -u cactiuser -e   //注意要用cactiuser就是你刚刚建立的那个帐号去运行crontab
  */5 * * * *   /usr/local/php/bin/php /usr/local/www/htdocs/cacti/poller.php > /dev/null 2>&1
  或:vi /etc/crontab,增加:
  */5 * * * * cactiuser /usr/local/php/bin/php /usr/local/www/htdocs/cacti/poller.php >/dev/null 2>&1
  (用spine时可以改成1分钟刷一次)
  * * * * *   /usr/local/php/bin/php /usr/local/www/htdocs/cacti/poller.php > /dev/null 2>&1
  plugin Architecture的安装
  wget http://mirror.cactiusers.org/downloads/plugins/cacti-plugin-0.8.7e-PA-v2.6.zip
unzip cacti-plugin-0.8.7e-PA-v2.6.zip  
进入解压目录,导入数据库:
mysql cacti < pa.sql
  cp cacti-plugin-0.8.7e-PA-v2.6.diff /usr/local/www/htdocs/cacti/
  cd /usr/local/www/htdocs/cacti/
  patch -p1 -N < cacti-plugin-0.8.7e-PA-v2.6.diff
  ===================
  注:若php是系统自带安装的这用这个方法打补丁会报错,则用如下的方法安装:
  仔细读了一下同级目录的readme.txt:里面提示说如果通过rpm包的方式安装的建议,直接把files里的文件直接覆盖。我就郁闷了,我之所以上一篇文章说要把安装的cacti更新到最新的版本就是怕出现这样的版本不一致的情况,结果还是发生了。最后还是覆盖了一下解决了问题。
rsync -avz ./files-0.8.7e/* /var/www/html/cacti/
===================
修改include/global.php
  vi include/global.php
将$config['url_path'] = ‘/’;改为:$config['url_path'] = ‘/cacti/’;
  settings安装
  下载:wget wget http://docs.cacti.net/_media/plugin:settings-latest.tgz
  cp -r  settings-0.6/ /usr/local/www/htdocs/cacti/plugins/settings
  继续修改include/global.php
  #vi include/global.php
  在$plugins = array();的后面加上如下内容
$plugins[] = 'settings';
  安装thold,monitor插件
monitor插件,提供更简略、直观的设备状态图示;
thold插件,提供设备异常预警。
  cd cacti/plugins
#wget wget http://docs.cacti.net/_media/plugin:settings-latest.tgz
  #tar zxvf setting.tgz
  #wget http://mirror.cactiusers.org/downloads/plugins/thold-0.4.1.tar.gz
#tar zxvf thold-0.4.1.tar.gz
#wget wget http://mirror.cactiusers.org/downloads/plugins/monitor-0.8.2.tar.gz
  #tar zxvf monitor.tar.gz
  导入数据库
  mysql cacti <monitor.sql 
 mysql cacti <thold.sql
  #vi include/global.php
在$plugins = array();的后面加上如下内容
$plugins[] = ‘thold’;
$plugins[] = ’settings’;
$plugins[] = monitor;
  使用插件
使用monitor插件
刷新cacti系统的web管理界面,可以看到多出两个标签页(thold、monitor)。
1>打开“Console->Settings->Misc”,可以调整Monitor的各项配置。例如:勾选“Show Icon Legend”可以在监控页面显示图例;
“View”可以选用Tiles类型,以显示设备状态表格。
2>为cacti添加新设备时,勾选上“Monitor Host”项。对已添加的设备可以通过“Management->Devices”进去修改。
3>单击Web页面上方的“monitor”标签链接,可以进入查看各设备/主机的状态图示。
使用thold插件
1>打开“Console->Settings->Mail/DNS”,可以调整“SMTP Options”和“DNS Options”等配置,用于确保预警邮件能够发出。
2>打开“Console->Settings->Alerting/Thold”,可以调整Thold的各项配置。例如:“Dead Host Notifications Email”处可填写设备当机时发送警告信息到哪个邮箱;勾选“Send alerts as text”项,可以设置只发送文本格式的邮件。
3>打开“Templates->Threshold Templates”,可以添加、取出需要关联到预警系统的模板,例如:可以添加和“Interface-Traffic”模板的关联,选择 “traffic_in”、
“traffic_out”数据项,分别设置警告阈值“High Threshold”(如200000000比特/秒);可以添加和“Unix-Disk Space”模板的关联……。
4>打开“Create->New Graphs”,选择需要提供预警的设备,单击右侧上方的“Auto-create thresholds”创建预警项目。
5>打开“Management->Thresholds”,可以管理已经创建的预警项目。
  =========================================================
  snmp--一般端口流量分析


针对普通网络设备的端口,MIB的相关定义是Interface组,主要管理如下信息:
ifIndex                 端口索引号
ifDescr                 端口描述
ifType                端口类型
ifMtu                最大传输包字节数
ifSpeed                 端口速度
ifPhysAddress           物理地址
ifOperStatus          操作状态
ifLastChange          上次状态更新时间
*ifInOctets          输入字节数
*ifInUcastPkts       输入非广播包数
*ifInNUcastPkts       输入广播包数
*ifInDiscards           输入包丢弃数
*ifInErrors          输入包错误数
*ifInUnknownProtos    输入未知协议包数
*ifOutOctets          输出字节数
*ifOutUcastPkts       输出非广播包数
*ifOutNUcastPkts        输出广播包数
*ifOutDiscards       输出包丢弃数
*ifOutErrors          输出包错误数
ifOutQLen             输出队长
其中,*号标识的是与网络流量有关的信息。
 
页: [1]
查看完整版本: cacti 安装配置