www.cactifans.org上的几篇文章
http://www.cactifans.org/index.php/2011/05/backtrack-5-release/#more-311
http://www.cactifans.org/index.php/2011/04/cacti%E6%8F%92%E4%BB%B6%E8%AF%A6%E8%A7%A3-weathermap/
http://www.cactifans.org/index.php/2012/03/cacti%E6%8F%92%E4%BB%B6%E8%AF%A6%E8%A7%A3-syslog/
终于发发布了!在第一时刻下载,安装看了一下!最新的BT5有kde和gnome二种!并且都有32位和64位版本!下面上几张图!
启动过程中!
启动后:
msf!
内核!
工具
经过几个月来来的努力,CactiFans V1.0中文版终于发布了!仔细算起,自上次发布已经有一年多了,这个时间是有点长,主要的原因是我太忙了,事情太多了。做完这版本,我也要毕业了,离开学校了,大学也就这么上完了,也算毕业的纪念吧!进入正题。
CactiFans是我制作的一个cacti的集成全自动安装系统!
CactiFans v1.0中文版特性
-
基于CentOS6.2构建,集成了cacti 0.8.8a 中文版(目前最新版),rrdtool 1.4.7(目前最新)
-
集成nagios 3.3.1,nconf 1.3(管理nagios的一个工具)
-
集成phpMyAdmin-3.5.0 webmin-1.580
-
集成 syslog,npc.routerconfigs,weathermap,monitor,discovery等cacti常用的20个插件
-
集成飞信机器人,可以配置短信报警
-
包含FreeBSD,IIS,Nginx,apache,mysql,advance ping等实用模版
-
解决weahermap插件的安全性问题
-
Patch官方所有补丁,解决目前已知bug
-
集成最新spine高效轮询工具
-
自动定期备份cacti和syslog数据
-
优化系统服务
下载地址:
1 2 3 4 |
MD5 (CactiFans-v1.0-i386.iso) = f3953004b265eba310ad99c925e82e11 MD5 (CactiFans-v1.0-x86_64.iso) = 5c86ad369f10f3f653c98c529784a0ec SHA256 (CactiFans-v1.0-i386.iso) = 616925fe49ffc0311c1f31bab66c49b0e225f89ce7f410cf544f0ebc6fd60e08 SHA256 (CactiFans-v1.0-x86_64.iso) = 168df927757ea638d2b1f4ef77f65dd79e7b99b7a546b40053dccc1c9a7d109a |
QQ群:①185016501 ②61797150
登录系统密码:(建议尽快修改)
1 2 |
username: root passpord: cactifans.org |
第一次登录cacti的默认密码
1 2 |
username:admin password: admin |
Webmin地址及默认密码(一定要修改)
1 2 3 |
http://192.168.1.10/nagios/ username: nagiosadmin password: cactifans |
nconf地址及默认密码
1 2 3 |
http://192.168.1.10/nconf/ username: admin password: cactifans.org |
weathermap编辑密码(编辑weathermap图形时会需要)
1 2 |
username:cactifans password:cactifans.org |
安装方法:
用iso引导后将会出现如下画面:
直接按回车开始自动安装:
安装过程需要5分钟左右,安装好之后(启动到进度条那里会卡以下,是由于网络ip问题,等待,会过去的)
安装后,默认使用静态ip,ip地址为192.168.1.10,登录系统,用户名:root 密码:cactifans.org
登录后输入
system-config-network
回车,出现如图修改ip
修改完,选ok,保存并退出
输入
/etc/init.d/network restart
重启网卡
打开浏览器http://xxx.xxx.xxx.xxx/
用户名:admin 密码:admin 登录后要强制修改密码,输入要设置的密码点ok,就进入系统了;
phpmyadmin
关于CactiFans我还会写一篇文章,详细讲述使用过程!
Weathermap是cacti中大家最用的一个插件之一,用它可以画出漂亮的网络拓扑图!同时Weathermap也是一个独立工具,可以独立部署,不需要cacti的支持,也可以部署.下面首先来看一看用Weathermap画出来的拓扑图.
一.weathermap作为cacti插件的用法
1.安装weathermap插件
1 2 3 4 5 |
wget http://www.network-weathermap.com/files/php-weathermap-0.97a.zip unzip php-weathermap-0.97a.zip mv weathermap/ /var/www/html/plugins/ chown -R apache:apache /var/www/html/plugins/weathermap/configs/ chown -R apache:apache /var/www/html/plugins/weathermap/output/ |
点击安装weathermap后
至此,weathermap已经安装成功。
2.配置使用weathermap
安装好weathermap后,看到点Console在左边的列表里会看到weathermap的菜单,我们点击,会看到设置,因为我们还没有定义一个weathermap配置文件,所以我们点右上角的Add按钮,添加一个weathermap配置文件
点击Add之后,我们看到有二个文件,其实这个时候调用的就是weathermap的configs目录下的文件,simple.conf就是自带的一个配置文件,我们可以点击它前面的Add按钮,把他添加到默认配置文件里
至此我们添加了一个weathermap的配置文件,下面就是对weathermap进行配置了,点击weathermap,然后点击Editor对默认图形配置文件进行配置。
点击editor后我们会看到如下提示
The editor has not been enabled yet. You need to set ENABLED=true at the top of editor.php
Before you do that, you should consider using FilesMatch (in Apache) or similar to limit who can access the editor. There is more information in the install guide section of the manual.
我们按照他提示的编辑editor.php
1 |
vi /var/www/html/plugins/weathermap/editor.php |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
<php require_once 'editor.inc.php'; require_once 'Weathermap.class.php'; // so that you can't have the editor active, and not know about it. $ENABLED=true; if(! $ENABLED) { print " The editor has not been enabled yet. You need to set ENABLED=true at the top of editor.php "; print " Before you do that, you should consider using FilesMatch (in Apache) or similar to limit who can access the editor. There is more information in the install guide section of the manual. "; exit(); } |
注意问题:
1 2 |
vi /var/www/html/plugins/weathermap/configs/simple.conf FONTDEFINE 100 /var/www/html/plugins/weathermap/msyh.ttf 10 |
二.weathermap独立的使用。
1.安装基本环境
1 2 3 4 5 6 7 8 9 |
yum install httpd php php-gd php-pear rrdtool -y servie http start chkconfig http on service crond start chkconfig crond on wget http://www.network-weathermap.com/files/php-weathermap-0.97a.zip unzip php-weathermap-0.97a.zip mv weathermap/ /var/www/html/ chown -R apache:apache /var/www/html/weathermap/configs/ |
2.配置weathermap
1 |
vi /var/www/html/weathermap/editor.php |
特别注意:
3.生成图形
1 |
/usr/bin/php /var/www/html/weathermap/weathermap --config /var/www/html/weathermap/configs/simple.conf --image-uri ../weathermap/test.png |
1 |
vi /etc/crontab |
1 |
*/5 * * * * root /usr/bin/php /var/www/html/weathermap/weathermap --config /var/www/html/weathermap/configs/simple.conf --image-uri ../weathermap/test.png |
1 |
ln /test.png /var/www/html/weathermap/test.png |
总结:
3.最重要的一点,就是关于weathermap的安全性问题,其实在它的官网也说明了。
When you are happy that the world can’t edit your maps, then enable the editor. This is done by editing the top of editor.php and changing $ENABLED=false;
to $ENABLED=true;
You should now be able to go to http://your.server/cacti/plugins/weathermap/editor.php in a browser, and get a welcome page that offers to load or create a config file. That’s it. All done. Please see the editor manual page for more about using the editor!
You can also edit an existing map from the Cacti web interface, by choosing Manage..Weathermaps and then clicking on the name of a config file in the list of active maps. The editor will open with that map loaded.
Important Security Note: The editor allows anyone who can access editor.php to change the configuration files for your network weathermaps. There is no authentication built-in for editing, even with the Cacti Plugin. This is why the configuration file doesn’t exist by default – the editor won’t work until you choose to make it work. It’s recommended that you either:
- change the ownership of configuration files so that the editor can’t write to them once they are complete, or
- use your webserver’s authentication and access control facilities to limit who can access the editor.php URL. On apache, this can be done using the FilesMatch directive and mod_access.
1 |
vi /etc/httpd/conf/httpd.conf |
1 2 3 4 5 6 7 |
<Directory /var/www/html/weathermap> <Files editor.php> Order Deny,Allow Deny from all Allow from 127.0.0.1 </Files> </Directory> |
Nagios是监控服务器的状态很强大,并且报警功能也不错,不过就是缺少直观的表示,在cacti的插件里有一个插件NPC,通过NDO可以把Nagios里的数据展示在NPC标签里,很直观的就可以看到各种信息如图:
图2
下面说一下我本次的安装环境;
1.软件环境
OS:CentOS6.2 i386(最小化安装,只安装开ssh-server)
cacti-0.8.7i-PIA-3.1
nagios-3.2.3-3.el6.rf.i686
ndoutils-1.4-0.beta8.1.el6.rf.i686 (nagios的数据库支持)
settings-v0.71-1 (cacti 插件)
npc-2.4 ( nagios plugin for cacti ,cacti插件)
2.环境支持
http mysql mysql-devel( ndoutils需要它的支持)php php-devel rrdtoolnet-snmp libtool
注:有人说要安装php-json,经过测试在CentOS5.5里是要安装的,在CentOS6里,这个包已经在php-common里了,所以在安装php的时候就一起安装了
3.安装cacti
A.关闭SElinux
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
vi /etc/sysconfig/selinux # This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - SELinux is fully disabled. SELINUX=enforcing # SELINUXTYPE= type of policy in use. Possible values are: # targeted - Only targeted network daemons are protected. # strict - Full SELinux protection. SELINUXTYPE=targeted |
把SELINUX=enforcing改为SELINUX=disabled并保存!在这个时候SElinux还在运行关闭
1 |
setenforce 0
|
B.防火墙
一般我都是把防火墙直接关掉省的好多事情(生产环境不建议这么搞啊!嘿嘿!)
1 2 3 4 |
/etc/init.d/iptables stop /etc/init.d/ip6tables stop chkconfig iptables off chkconfig ip6tables off |
C.由于一些包在官方的库中没有,因此我们要建立dag.repo,定义非官方库
1 2 3 4 5 6 7 |
vi /etc/yum.repos.d/dag.repo [dag] name=Dag RPM Repository for Red Hat Enterprise Linux baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag gpgcheck=1 enabled=1 |
然后再导入非官方库的GPG:
1 |
rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt |
安装cacti需要的环境包
1 2 3 |
yum install -y httpd mysql mysql-server php php-mysql php-devel net-snmp net-snmp-utils yum install -y zlib libpng freetype libjpeg fontconfig gd libxml2 patch wget yum install -y rrdtool |
下载cacti-0.8.7i-PIA-3.1.tar.gz(这个是整合了cacti 0.8.7和 cacti-plugin-arch3.1的)并解压
1 2 3 4 5 6 7 8 9 10 11 |
cd /var/www/html/ yum install wget -y wget http://www.cacti.net/downloads/cacti-0.8.7i-PIA-3.1.tar.gz tar zxvf cacti-0.8.7i-PIA-3.1.tar.gz wget http://www.cacti.net/downloads/patches/0.8.7i/settings_checkbox.patch cd cacti-0.8.7i-PIA-3.1 patch -p1 -N < ../settings_checkbox.patch cd .. mv -f cacti-0.8.7i-PIA-3.1/* /var/www/html/ rm -rf cacti-0.8.7i-PIA-3.1 chown -R apache:apache /var/www/html/ |
D.为cacti创建数据库和用户
1 2 3 |
service mysqld start /usr/bin/mysqladmin --user=root create cacti mysql -e "GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'cactifans.org'" |
我们再导入cacti的数据库
1 |
mysql -ucactiuser -pcactifans.org cacti < /var/www/html/cacti.sql |
修改cacti的配置文件并保存
1 2 3 4 5 6 7 8 9 |
vi /var/www/html/include/config.php /* make sure these values refect your actual database/host/user/password */ $database_type = "mysql"; $database_default = "cacti"; $database_hostname = "localhost"; $database_username = "cactiuser"; $database_password = "cactifans.org"; $database_port = "3306"; |
设置crontab定时任务
由于我们是最小系统安装没有安装定时任务,因此我们首先安装
1 |
yum install vixie-cron
|
然后我们添加定时任务
1 |
echo '*/5 * * * * root /usr/bin/php /var/www/html/poller.php' >> /etc/crontab |
设置服务开机自启动,重启服务
1 2 3 4 5 6 7 8 |
chkconfig snmpd on chkconfig httpd on chkconfig mysqld on chkconfig crond on service httpd restart service snmpd restart service mysqld restart service crond restart |
E.WEB页完成安装
浏览http://xxx.xxx.xxx.xxx/index.php
就可以出再Cacti Installation Guide的页面了。NEXT–NEXT–FINISH。
用户名和密码为:admin/admin,之后输入新的密码,就完成了最基本的安装。
F.由于我们安装的这个版本已经在整合了cacti-plugin-3.1,所以我们只要在cacti里启用就成了,点console–User Management–admin
可以看到Plugin Management ,选中它点save就可以启用cacti-plugin
3.安装ngios
nagios我通过yum进行安装
1 |
yum install nagios nagios-plugin nagios-nrpe
|
这样就把ngios安装好了,安装好之后有几个地方需要配置一下,
A.设置nagios的访问用户及密码,默认用户为nagiosadmin
1 |
htpasswd -c /etc/nagios/htpasswd.users nagiosadmin |
如果你设置的用户不是nagios还需要修改cgi.cfg(yum 安装会将nagios的配置文件放在/etc/nagios下)
1 2 3 4 5 6 7 |
authorized_for_system_information=nagiosadmin authorized_for_configuration_information=nagiosadmin authorized_for_system_commands=nagiosadmin authorized_for_all_services=nagiosadmin authorized_for_all_hosts=nagiosadmin authorized_for_all_service_commands=nagiosadmin authorized_for_all_host_commands=nagiosadmin |
修改以上几个的nagiosadmin为自定义的用户名,否则你将没有权限看见服务器的信息。
nagios的安装到到此结束了,至于详细的配置网上也有很多例子。Nagios的配置无非就是主机,服务,报警的配置,可以写成简单的脚本来实现快速添加。
4.安装ndoutils
ndoutils我也是通过yum安装的,比较方便这个需要用到mysql的mysql-lib及mysql-inc,
因此需要安装mysql-devel(yum install mysql-devel)
1 |
yum install ndoutils -y |
然后我们配置ndo2db.cfg (yum默认安装的路径为 /etc/nagios/ndo2db.cfg)
1 2 3 4 5 6 7 8 9 |
vi /etc/nagios/ndo2db.cfg socket_type=tcp socket_name=/var/nagios/rw/ndo.sock db_name=cacti db_prefix=npc_ db_user=cactiuser db_pass=cactifans.org debug_level=1 debug_file=/var/nagios/ndo2db.debug |
用的数据库为cacti的数据库,别的根据你自己的具体设置就成了
配置ndomod.cfg (yum默认安装的路径为 /etc/nagios/ndomod.cfg)
1 2 3 4 |
vi /etc/nagios/ndomod.cfg output_type=tcpsocket output=127.0.0.1 buffer_file=/var/nagios/ndomod.tmp |
配置nagios.cfg (yum安装的默认路径为 /etc/nagios/nagios.cfg)
1 2 3 4 5 |
check_external_commands=1 command_check_interval = -1 event_broker_options = -1 broker_module=/usr/libexec/ndomod-3x.o config_file=/etc/nagios/ndomod.cfg process_performance_data=1 |
5.安装NPC
我在npc的官网没有下载到,下载的地址貌似已经不能用了,最后发现有svn的,于是我用svn check了一份(我已打包传到我的空间,点此下载)
1 2 3 |
wget http://www.cactifans.org/plugins/npc.tar.gz tar zxvf npc*.tar.gz -C /var/www/html/plugins chown -R apache:apache /var/www/html/plugins/npc |
然后进入cacti,点Console–Plugin Management–并启用npc插件就是了
接着在右侧栏目中选择settings,点选npc的标签
钩选Remote Commands
1 |
Nagios Command File Path: /var/nagios/rw/nagios.cmd |
这个文件启动nagios后会产生,根据实际的位置写,yum安装的在默认在 /var/nagios/rw/nagios.cmd
1 |
Nagios URL:]http://yourserver/nagios/ |
保存就可以了。
接着启动nagios ndoutils
1 2 3 4 5 |
service mysqld restart service httpd restart /usr/sbin/ndo2db-3x -c /etc/nagios/ndo2db.cfg service nagios start chkconfig nagios on |
安装好之后在npc里只看到nagios status是on 别的主机信息却是没有查看日志发现有如下信息
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
tail -100 /var/log/messages Feb 24 12:02:37 localhost ndo2db-3x: Error: mysql_query() failed for 'INSERT INTO npc_servicestatus SET instance_id='1' , service_object_id='5', status_update_time=FROM_UNIXTIME(1330055656), output='HTTP OK: HTTP/1\.1 200 OK - 1916 bytes i n 0\.083 second response time', long_output='', perfdata='time=0\.083463s;;;0\.000000 size=1916B;;;0', current_state='0 ', has_been_checked='1', should_be_scheduled='1', current_check_attempt='1', max_check_attempts='4', last_check=FROM_UN IXTIME(1330055520), next_check=FROM_UNIXTIME(1330055820), check_type='0', last_state_change=FROM_UNIXTIME(1330011420), last_hard_state_change=FROM_UNIXTIME(1330011420), last_hard_state='0', last_time_ok=FROM_UNIXTIME(1330055520), last_tim e_warning=FROM_UNIXTIME(0), last_time_unknown=FROM_UNIXTIME(0), last_time_critical=FROM_UNIXTIME(1330011120), state_typ e='1', last_notification=FROM_UNIXTIME(0), next_notification=FROM_UNIXTIME(0), no_more_notifications='0', notifications _enabled='1', problem_has_been_acknowledged='0', acknowledgement_type='0', current_notification_number='0', passive_che cks_enabled='1', active_checks_enabled='1', event_handler_enabled='1', flap_detection_enabled='1', is_flapping='0', per cent_state_change='0.000000', latency='0.027000', execution_time='0.094000', scheduled_downtime_depth='0', failure_pred iction_enabled='1', process_performance_data='1', obsess_over_service='1', modified_service_attributes='1', event_handl er='', check_command='check_http', normal_check_interval='5.000000', retry_check_interval='1.000000', check_timeperiod_ object_id='2' ON DUPLICATE KEY UPDATE instance_id='1', service_object_id='5', status_update_time=FROM_UNIXTIME(13300556 56), output='HTTP OK: HTTP/1\.1 200 OK - 1916 bytes in 0\.083 second response time', long_output='', perfdata='time=0\. 083463s;;;0\.000000 size=1916B;;;0', current_state='0', has_been_checked='1', should_be_scheduled='1', current_check_at tempt='1', max_check_attempts='4', last_check=FROM_UNIXTIME(1330055520), next_check=FROM_UNIXTIME(1330055820), check_ty pe='0', last_state_change=FROM_ |
很多类似的错误,最后在cacti的论坛里找到了,是缺少一个表因此进入mysql执行如下语句
1 2 3 4 5 6 7 8 9 10 11 |
mysql -ucactiuser -pcactifans.org use cacti; ALTER TABLE `npc_hostchecks` ADD COLUMN `long_output` varchar(8192) NOT NULL default '' AFTER `output`; ALTER TABLE `npc_hoststatus` ADD COLUMN `long_output` varchar(8192) NOT NULL default '' AFTER `output`; ALTER TABLE `npc_servicechecks` ADD COLUMN `long_output` varchar(8192) NOT NULL default '' AFTER `output`; ALTER TABLE `npc_servicestatus` ADD COLUMN `long_output` varchar(8192) NOT NULL default '' AFTER `output`; ALTER TABLE `npc_statehistory` ADD COLUMN `long_output` varchar(8192) NOT NULL default '' AFTER `output`; ALTER TABLE `npc_eventhandlers` ADD COLUMN `long_output` varchar(8192) NOT NULL default '' AFTER `output`; ALTER TABLE `npc_systemcommands` ADD COLUMN `long_output` varchar(8192) NOT NULL default '' AFTER `output`; ALTER TABLE `npc_notifications` ADD COLUMN `long_output` varchar(8192) NOT NULL default '' AFTER `output`; exit; |
这样操作之后刷新一次就可以了,现在已经正常了
cacti中syslog插件,是通过rsyslog或syslog-ng与mysql的交互,将日志存放到mysql数据库中,cacti中的syslog插件从mysql中检索查看日志数据。因此,首先要配置一台rsyslog与mysql的日志中心服务器来接收客户机的日志;其次,配置cacti的syslog插件,通过该插件检索与查询mysql中的日志。可以收集来自linux、windows等服务器和交换机路由器的日志。做到集中和分类查看。
Cacti 0.8.7g在CentOS5.5上的安装(1)
Cacti 0.8.7g在CentOS5.5上的安装(2)
由于我们此次安装的是集成PIA的cacti,因此不用单独安装PIA,安装好cacti以后要启用Plugin Management,然后我们下载syslog插件
1.设置接收日志
要想接收日志信息,并在cacti的syslog插件中显示接收到的日志,首先是接收日志,有二种办法:
1.使用syslog-ng,在centos5.5及以下系统上,系统默认有syslog,可以发送日志,但不能接受日志,因此要借助于syslog-ng,来接收发送过来的日志,并规范成一个模版,再通过自己写的脚本,插入到mysql数据库里
2.使用rsyslog,rsyslog是在centos6以上系统自带的,rsyslog不仅能接收日志,还可以发送日志,因此要是在centos6以上系统就不需要额外安装syslog-ng接收日志了,用自带的rsylog就可以接收日志,再用rsyslog-mysql就可以把接收到的日志写入mysql数据库
下面我分别说明:
A.使用rsyslog
1 |
yum install -y rsyslog rsyslog-mysql |
1 |
vi /etc/rsyslog.conf |
1 2 3 4 5 |
$ModLoad imudp.so $UDPServerRun 514 $ModLoad ommysql $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 *.* >localhost,syslog,cactiuser,cactifans.org;cacti_syslog |
然后保存,重新启动rsyslog,并设置rsyslog开机启动
1 2 |
chkconfig rsyslog on service rsyslog restart |
B.使用syslog-ng
syslog-ng在默认的源里没有,可以编译安装,在这里我用yum安装syslog-ng
首先添加一个第三方源
1 2 |
rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm yum install -y syslog-ng |
安装好后我们配置syslog-ng
1 |
vi /etc/syslog-ng/syslog-ng.conf |
在文件最后加入如下
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
source net { udp(); }; destination d_mysql { pipe("/tmp/mysql.pipe" template("INSERT INTO syslog_incoming (host, facility, priority, date, time, message) VALUES ( '$HOST', '$FACILITY', '$PRIORITY', '$YEAR-$MONTH-$DAY', '$HOUR:$MIN:$SEC', '$MSG' );\n") template-escape(yes) ); }; log { source(net); destination(d_mysql); }; log { source(s_sys); destination(d_mysql); }; |
加入后保存,退出。
1 |
vi /sbin/syslogtomysql |
1 2 3 4 5 6 7 8 9 |
#!/bin/bash if [ ! -e /tmp/mysql.pipe ]; then mkfifo /tmp/mysql.pipe fi while [ -e /tmp/mysql.pipe ] do mysql -u cactiuser --password=cactifans.org syslog < /tmp/mysql.pipe done |
1 |
chmod +x /sbin/syslogtomysql |
1 |
/sbin/syslogtomysql & |
1 |
/etc/init.d/syslog-ng start |
1 |
vi /etc/rc.local |
1 |
/sbin/syslogtomysql & |
1 |
chkconfig syslog-ng on |
至此syslog的设置完成
syslog-ng和rsyslog的设置就说到这里,基本都是差不多,不过rsyslog好设置一点不用独立写脚本就成。在centos6以上版本中也可以用syslog-ng来接收日志。以下的安装步骤就一样了。
2.配置syslog的数据库
1 2 3 |
mysql -uroot -p create database syslog; GRANT ALL ON syslog.* TO cactiuser@localhost IDENTIFIED BY 'cactifans.org; quit; |
3.安装syslog插件
1 2 3 |
wget http://docs.cacti.net/_media/plugin:syslog-v1.22-2.tgz -O syslog.tgz tar zxvf syslog*.tgz -C /var/www/html/plugins chown -R apache:apache /var/www/html/plugins/syslog |
1 |
vi /var/www/html/plugins/syslog/config.php |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
...... global $config, $database_type, $database_default, $database_hostname; global $database_username, $database_password, $database_port; /* revert if you dont use the Cacti database */ $use_cacti_db = false; if (!$use_cacti_db) { $syslogdb_type = 'mysql'; $syslogdb_default = 'syslog'; $syslogdb_hostname = 'localhost'; $syslogdb_username = 'cactiuser'; $syslogdb_password = 'cactifans.org'; $syslogdb_port = 3306; }else{ $syslogdb_type = $database_type; $syslogdb_default = $database_default; $syslogdb_hostname = $database_hostname; $syslogdb_username = $database_username; $syslogdb_password = $database_password; $syslogdb_port = $database_port; } ....... |
就可以看到syslog已经安装,但是还没有启用,我们点那个绿色箭头就可以启用syslog
启用后我们可以看到syslog了
4.被监控端设置
1 |
*.* @192.168.0.111 |
1 |
*.* @@192.168.0.111:514 |
1 |
logging 192.168.0.111 |