|
监控开源系统Nagios的最强之出在与报警功能,还有Cacti的绘图功能,各有所长,要是将这几个工具整合成一个工具,使用起来是不是更方便.
首先,Nagios我们前面已经搭建好了,所以我们搭建个Cacti即可.
参考文档:http://hi.baidu.com/9812658/blog/item/3aaa0b750e524317b051b913.html
http://slien.blog.运维网.com/626289/12192
安装cacti
http://blog.运维网.com/attachment/201201/205410899.jpg
好了,开工,下载rrdtool和cactihttp://blog.运维网.com/attachment/201201/212923338.jpg
- #!/bin/bash
- #filename: cacti_install.sh
- #Environment: Centos 5.6 32-bit
- #Author: maoxian
- #Blog: maoxian.blog.运维网.com
-
- #定义变量
- tooldir=/usr/local/src/
- #yum -y install httpd gcc glibc glibc-common gd gd-devel php53 php53-mysql php-pear mysql mysql-server mysql-devel perl perl-DBI perl-DBD-MySQL
-
- #安装RRDtool.
- cd $tooldir
- wget http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.4.3.tar.gz
- tar zxvf rrdtool-1.4.5.tar.gz
- cd rrdtool-1.4.5
- ./configure --prefix=/usr/local/rrdtool
- make && make install
-
- #安装net-snmp
- cd $tooldir
- tar zxvf net-snmp-5.6.tar.gz
- cd net-snmp-5.6
- ./configure --prefix=/usr/local/net-snmp --with-mysql=/usr/bin/mysql_config
- make && make install
- ###########提示信息##############
- #default version of-snmp-version(3):3(在这里版本通常有三种形式:1,2c,3)
- #Systemcontact information(配置该设备的联系信息): wangyx@metersbonwe.com(也可以是邮箱地址)
- #System location (该系统设备的地理位置):Shanghai
- #Location to write logfile (日志文件位置):/var/log/snmpd.log
- #Location to Write persistent(数据存储目录):/var/net-snmp
- #说明:也可以使用yum install net-snmp net-snmp-devel net-snmp-libs net-snmp-utils net-snmp-perl 或者yum net-snmp*来进行安装
-
- #安装cacti与cacti-spine
- cd $tooldir
- tar zxvf cacti-0.8.7i.tar.gz
- mv cacti-0.8.7i /usr/local/cacti
- useradd -s /sbin/nologin cacti
- #passwd cacti
- chown -R cacti.cacti /usr/local/cacti/
- #vim /var/www/html/cacti/include/config.php 修改数据和实际参数一致.
-
- cd $tooldir
- tar zxvf cacti-spine-0.8.7i.tar.gz
- cd cacti-spine-0.8.7i
- ./configure --prefix=/usr/local/cacti-spine --with-mysql=/usr/share/mysql --with-snmp=/usr/share/snmp/snmpconf-data/
- make && make install
- cd /usr/local/cacti-spine/etc/
- cp spine.conf.dist spine.conf
- #vim spine.conf 修改数据和实际参数一致.
-
- #Mysql 之前设置过的密码是123456
- mysql -u root -p
- #mysql> create database cactidb default character set utf8;
- #mysql> grant all on cactidb.* to cactiuser@localhost identified by 'cactipw';
- #mysql> flush privileges;
- #mysql> quit
- cd /var/www/html/
- mysql -u cactiuser -p cactidb < cacti/cacti.sql
- Enter password: "刚刚设置的密码(cactipw)"
-
- #配置cacti的虚拟目录
- #vim /var/www/html/cacti/cacti.conf
- Alias /cacti /lamp/cacti
-
- DirectoryIndex index.php
- AllowOverride none
- order deny,allow
- deny from all
- Allow from 127.0.0.1 192.168.81.0/24
- AddType application/x-httpd-php .php
- php_flag magic_quotes_gpc on
- php_flag track_vars on
-
- #vim /etc/httpd/conf/httpd.conf 增加如下一行
- Include /var/www/html/cacti/cacti.conf
-
- service httpd restart
-
- #vi /etc/cron.d/cacti
- */5 * * * * cacti /lamp/web/php/bin/php /lamp/cacti/poller.php &>/dev/null
- #chkconfig --level 3 crond on
- #service crond restart
安装cacti插件
未完待续...等有时间一定会完成下去
|
|
|