CentOs 6.0 下安装cacti的syslog插件

 CentOs 6.0 下安装cacti的syslog插件

一、软件环境:
OS:CentOS 6.0 x86_64
rsyslog
rsyslog-mysql
syslog-v1.22-2.tgz
监控端(安装cacti的服务器)ip:192.168.168.10
客户端ip: 192.168.168.11
 
二、监控端安装:
mkdir /usr/local/src/rsyslog
cd /usr/local/src/rsyslog
yum -y install rsyslog rsyslog-mysql
wget http://docs.cacti.net/_media/plugin:syslog-v1.22-2.tgz
mv plugin:syslog-v1.22-2.tgz syslog-v1.22-2.tgz
tar zxvf syslog-v1.22-2.tgz -C /var/www/html/plugins #/var/www/html是cacti的主目录
chown apache.apache /var/www/html/plugins/syslog -R
创建syslog数据库:
mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 145351
Server version: 5.1.52 Source distribution
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create database syslog;
Query OK, 1 row affected (0.00 sec)
mysql> grant all privileges on syslog.* to cacti@localhost identified by 'cacti123';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye
 
导入syslog的数据库表:
mysql -ucacti -pcacti123 syslog < /var/www/html/plugins/syslog/syslog.sql
 
编辑/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 customer 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 customer timestamp format of the cacti_syslog template
*.*             :ommysql:localhost,syslog,cacti,cacti123;cacti_syslog
# Write the log to the /var/log/file.log repeat
*.*             /var/log/file.log
保存退出。
chkconfig rsyslog on
service rsyslog restart
 
三、客户端安装配置:
yum -y install rsyslog
echo "*.*      @192.168.168.10" >> /etc/rsyslog.conf
chkconfig rsyslog on
service rsyslog restart
 
然后检查监控端的/var/log/file.log里看有没有客户端的信息,有了就成功了。
 
四、配置syslog插件:
修改配置文件config.php
vi /var/www/html/plugins/syslog/config.php
修改如下内容:
$use_cacti_db = false;                               #这个是设置syslog是否要使用cacti的数据库,由于syslog比较多,所以选用一个独立的数据库。
                                                     #因此要在下面设置连接数据库的用户名,密码。
 
$syslogdb_username = 'cacti';
$syslogdb_password = 'cacti123';
                                     
登录cacti管理页面:
console-->Plugin Management-->Syslog,点向下的绿箭头安装,再点他旁边的启用,右上角出现syslog图标,证明安装正确了。
 

 

你可能感兴趣的:(centos,cacti,6.0,安装syslog插件)