首页
登录 | 注册

CentOS 5.6 X86上配置cacti流量监控及日志报警

系统环境:CentOS 5.6 X86

1、安装系统支持cacti的必备环境

#vi /etc/selinux/config
SELINUX=disabled
#setenforce 0
#yum -y install httpd php php-mysql mysql mysql-server net-snmp-utils libpng freetype libart-lgpl
#rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
#yum -y install rrdtool  rrdtool-perl

#/etc/rc.d/init.d/mysqld start
#chkconfig mysqld on
#/etc/rc.d/init.d/httpd start
#chkconfig httpd on

2、下载和安装cacti

#wget http://www.cacti.net/downloads/cacti-0.8.7g.tar.gz
#tar xvfz cacti-0.8.7g.tar.gz  -C /var/www/html 
#cd /var/www/html 
#mv cacti-0.8.7g cacti

3、配置mysql数据库

#useradd cacti
#mysql
mysql>create database cacti;
mysql>GRANT ALL ON cacti.* TO cacti@localhost IDENTIFIED BY 'cacti'; 
mysql>flush privileges;
mysql>exit;
#cd /var/www/html/cacti
#vi cacti.sql(第四行添加如下)
use cacti;

4、配置cacti

#cd /var/www/html/cacti
#vi include/config.php
(将$database_password的密码改为与上面授权的密码一致即可)
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cacti";
$database_password = "cacti";
$database_port = "3306";

5、设置cacti数据存储目录权限
#cd /var/www/html/cacti
#chown –R cacti rra/  log/

6、Cacti数据采集,设定任务计划
先创建一个脚本
#mkdir /etc/script
#vi /etc/script/poller.sh 
#!/bin/bash
php /var/www/html/cacti/poller.php > /dev/null 2>&1
#chmod 755 /etc/script/poller.sh 
#crontab -e
*/5 * * * * su - cacti -c /etc/script/poller.sh
#/etc/init.d/crond  reload

7、开始配置cacti,在浏览器打开
http://ipaddress/cacti
默认用户名及密码都是admin

8、使cacti支持syslog集中日志管理及报警等

#yum  -y  install  librelp  librelp-devel  rsyslog  rsyslog-gnutls  rsyslog-mysql
[root@syslogd etc]# mysql -uroot -p
mysql> create database syslog;
mysql> GRANT ALL ON syslog.* TO cacti@localhost IDENTIFIED BY 'cacti'; 
mysql> flush privileges;

# vi /etc/rsyslog.conf

# provides UDP syslog reception
$ModLoad imudp
# start a UDP syslog server at standard port 514
$UDPServerRun 514
# Provides kernel logging support (previously done by rklogd)
$ModLoad imklog
# Provides support for local system logging (e.g. via logger command)
$ModLoad imuxsock
# provides --MARK-- message capability
$ModLoad immark
# provides UDP syslog reception
$ModLoad imudp
# provides TCP syslog reception and GSS-API (if compiled to support it) 
$ModLoad imtcp
# provides mysql 
$ModLoad ommysql
# Use costomer timestamp format
$template cacti_syslog,"INSERT INTO syslog_incoming(facility, priority, date, time, host, message) values (%syslogfacility%, %syslogpriority%,  '%timereported:::date-mysql%', '%timereported:::date-mysql%', '%HOSTNAME%', '%msg%')", SQL
# Insert the log's text into the Syslog database by the costomer timestamp format of the cacti_syslog template
*.*             :ommysql:localhost,Syslog,cacti,cacti;cacti_syslog

# chkconfig rsyslog on
# /etc/init.d//syslog restart

#wget http://mirror.cactiusers.org/downloads/plugins/cacti-plugin-0.8.7g-PA-v2.8.tar.gz
#tar zxvf cacti-plugin-0.8.7g-PA-v2.8.tar.gz
#cp -R cacti-plugin-arch/* /var/www/html/cacti
#cd /var/www/html/cacti
#mysql -ucacti -pcacti cacti < /var/www/html/cacti/pa.sql
#yum install -y patch
#patch -p1 -N < cacti-plugin-0.8.7g-PA-v2.8.diff

# wget -O settings.tar.gz http://docs.cacti.net/_media/plugin:settings-v0.71-1.tgz
# wget -O thold.tar.gz http://docs.cacti.net/_media/plugin:thold-v0.4.9-3.tgz
# wget -O monitor.tar.gz http://docs.cacti.net/_media/plugin:monitor-v1.3-1.tgz
# wget -O syslog.tar.gz http://docs.cacti.net/_media/plugin:syslog-v1.22-2.tgz
# tar zxvf syslog.tar.gz 
# tar -zxvf settings.tar.gz
# tar -zxvf monitor.tar.gz
# tar -zxvf thold.tar.gz
# mv syslog /var/www/html/cacti/plugins/syslog
# mv settings /var/www/html/cacti/plugins/settings
# mv monitor /var/www/html/cacti/plugins/monitor
# mv thold /var/www/html/cacti/plugins/thold
# mysql -ucacti -pcacti cacti #cd /var/www/html/cacti/plugins/syslog
# vi config.php 


        $syslogdb_type     = 'mysql';
        $syslogdb_default  = 'syslog';
        $syslogdb_hostname = 'localhost';
        $syslogdb_username = 'cacti';
        $syslogdb_password = 'cacti';
        $syslogdb_port     = 3306;

# mysql -uroot -p syslog 授权admin用户使用”plugin Management”:
登录后,Utilities–User Management–admin–Realm Permissions,勾选 Plugin Managerment项
Configuration->Plugin Managerment,Install and Avtive所有插件
这样,所有插件都安装并激活了,插件被安装好后就可以在Configuration->Settings进行配置了,可以填上邮件服务器的地址等信息,设置throld报警参数等。
到plugin management下开启相关插件服务

9、配置过程中,发现有配置好的Cacti及相关插件的CactiEZ软体出现(参照http://cactiez.cactiusers.org/),更是有中文版CactiEZ V10,这个就方便多了,不用搞这么多麻烦配置出来。

10、用CactiEZ几天后,发现一个叫“Kiwi Syslog Daemon”的Syslog软件也不错(后来被SolarWinds给收购了),基本Win Server的环境,收集CISCO及Juniper的日志也不含糊。

参照:http://skyou.blog.51cto.com/2915693/541686


相关文章

  • 在Ubuntu上配置拨号连接 By Harrison Feng 有时候,我们可能需要在Ubuntu上配置拨号连接,怎么配置呢?下面给出了最简单有效的方法. 1.首先,我们要安装pppoeconf软件 sudo apt-get install ...
  • CentOS 6.6安装配置LAMP服务器(Apache+PHP5+MySQL)方法步骤
    CentOS 6.6系统安装配置图解教程 //www.iis7.com/os/239738.html vi /etc/sysconfig/iptables-A INPUT -m state --state NEW -m tcp -p tcp ...
  • Keepalived+Nginx安装配置
    Keepalived+Nginx安装配置 [日期:2015-08-14] 来源:Linux社区  作者:yizezhong [字体:大 中 小] 软件版本: pcre8.36 ftp://ftp.csx.cam.ac.uk/pub/soft ...
  • zabbix简介及安装
    第一部分  简介 1.1 Zabbix简介 Zabbix是一个企业级的开源分布式监控解决方案,由一个国外的团队持续维护更新,软件可以自由下载使用,运作团队靠提供收费的技术支持赢利. 官方网站:http://www.zabbix.com Za ...
  • 3大模型,搞定Kubernetes网络
    Kubernetes为Pods的网络通信设定了一些条件和要求: 2.节点是运行Kubernetes集群的机器. 这些可以是虚拟机或物理机,也可以是能够运行Kubernetes的任何其他机器. 这些节点还能够与所有Pod通信,而无需NAT. ...
  • 如何在一个Docker容器里安装Discourse
    如何在一个Docker容器里安装Discourse [日期:2015-06-06] 来源:Linux中国  作者:Linux [字体:大 中 小] 大家好,今天我们将会学习如何利用Docker平台安装Discourse.Discourse是 ...

2020 unjeep.com webmaster#unjeep.com
12 q. 0.013 s.
京ICP备10005923号