发新话题
打印

怎样使用cacti与交换机配合监控linux主机?

怎样使用cacti与交换机配合监控linux主机?

以下为本人实施总结的步骤:
◎ 基本需求
您的Server基本上需要有下面這些套件
RedHat Linux+Apache + PHP + MySQL
shell>rpm -qa|grep php-snmp
shell>rpm -qa|grep php
shell>rpm -qa|grep net-snmp
shell>rpm -qa|grep php-gd
shell>rpm -qa|grep httpd
shell>rpm -qa|grep mysql
基本上您的php必須有開啟snmp、sockets、gd這三個函式庫

◎ 安裝Snmp

◎ 安裝RRDTool.
注意:由於rrdtool1.2版本已經不再自帶外部的lib庫,所以需要從
http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/pub/libs/


◎配置snmp
#vi /etc/snmp/snmpd.conf
更改 1、com2sec notConfigUser default public
改为:com2sec notConfigUser 192.168.0.10 public(192.168.0.10为被监控端IP)
2、access notConfigGroup "" any noauth exact systemview none none
改为:access notConfigGroup "" any noauth exact all none none
3、#view all included .1 80
将前面的 # 注释 去掉。
保存退出 :wq

下載安裝,建議還是使用1.0.x的版本比較方便
目前1.0.x最新版本為1.0.50
http://people.ee.ethz.ch/~oetike ... dtool-1.0.50.tar.gz
shell> tar zxvf rrdtool-1.0.50.tar.gz
shell> cd rrdtool-1.0.50
shell> ./configure --prefix=/usr/local/rrdtool
shell> make
shell> make install
shell>cp /usr/local/rrdtool/bin/* /usr/bin

◎ 開使安裝 Cacti 解壓縮檔案.
shell> tar xzvf cacti-version.tar.gz -C /var/www/html
shell> mv /var/www/html/cacti-version /var/www/html/cacti

◎ 建立 Cacti 用的 MySQL 資料庫:
shell>useradd cactiuser
shell>passwd cactiuser
shell> mysql
mysql>create database cacti;
mysql>grant all privileges on cacti.* to cactiuser@localhost identified by 'cactiuser';
mysql>flush privileges;

◎ 匯入預設的cacti資料庫:
shell>mysql cacti < cacti.sql

◎ 修改檔案 include/config.php 連接 MySQL 的使用者、密碼及資料庫名稱.
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "cactiuser";

◎ 設定log及rra資料夾權限.
shell> chown -R cactiuser rra/ log/


◎ 新增自動執行到您的 /etc/crontab 檔案裡:
shell>crontab -u cactiuser -e
*/5 * * * * cactiuser php /var/www/html/cacti/poller.php > /dev/null 2>&1

注意:請勿使用root執行上面命令,不然還要在執行一次第7步驟。
修改 /var/www/html/cacti/ 到您的 Cacti 安裝目錄.

◎ 打開您的瀏覽器輸入下面網址:
http://your-server/cacti/

◎ 登入的帳號密碼
登入的帳號密碼預設都是 admin.
登入後需立即更改您的密碼。之後這裡需輸入一寫資訊,如rrdtool、php、snmpwalk、snmpget的位置,使用ucd-snmp還是net-snmp等等。

◎ 怎样监控windows机器
1.安装snmp
2.打开服务,启动snmp,并指定snmp的接收IP和snmp接收的字符串

◎ 怎样监控PIX防火墙
1.在pix上设置
pix(conf)#snmp-server host inside 192.168.7.98 community top963
pix(conf)#snmp-server community top963
pix(conf)#snmp-server enable traps snmp
2.在监控主机上的cacti中添加pix内网IP,并指定相应的community
pix(conf)#snmp-server enable traps syslog

TOP

发新话题
版块跳转