zoukankan      html  css  js  c++  java
  • 搭建配置cacti,采集信息监控

    安装cacti
    lamp环境
    [iyunv@Cacti ~]#service iptables stop //关闭防火墙服务
    [iyunv@Cacti ~]#chkconfig iptables off //永久性关闭
    [iyunv@Cacti ~]#vi /etc/sysconfig/selinux //把SELINUX=enforcing改为SELINUX=disabled

    1:操作系统的安装,这个就不用写教程了吧(略)我个人用的是CentOS6.5最小化安装
    装好系统以后关闭防火墙和selinux
    [iyunv@Cacti ~]#service iptables stop //关闭防火墙服务
    [iyunv@Cacti ~]#chkconfig iptables off //永久性关闭
    [iyunv@Cacti ~]#vi /etc/sysconfig/selinux //把SELINUX=enforcing改为SELINUX=disabled

    2:yum设置

    这里也不再多说,请参见上一篇博文yum设置

    3:安装cacti依赖的软件

    yum -y install mysql mysql-server mysql-devel httpd php php-pdo php-snmp php-mysql lm_sensors net-snmp net-snmp-utils net-snmp-libs rrdtool rrdtool-devel perl-PlRPC perl-DBI perl-rrdtool perl-DBD-MySQL


    4:装好依赖软件之后,snmp有3个地方需要配置一下

    [iyunv@Cacti ~]#vim /etc/snmp/snmpd.confg
    第41行:将 com2sec notConfigUser default public 中的 "default" 改为 "127.0.0.1"
    第62行:将 access notConfigGroup "" any noauth exact systemview none none 中的 "systemview" 改为 "all"
    第85行:将 #view all include .1 80 这一行前面的 # 号去掉

    5:配置好snmp以后我们来启动3个重要的服务

    [iyunv@Cacti ~]#service snmpd start //启动snmp服务
    [iyunv@Cacti ~]#chkconfig snmpd on //设置开机启动
    [iyunv@Cacti ~]#service httpd start
    [iyunv@Cacti ~]#chkconfig httpd on
    [iyunv@Cacti ~]#service mysqld start
    [iyunv@Cacti ~]#chkconfig mysqld on

    6:安装并配置cacti

    [iyunv@Cacti ~]#wget http://www.cacti.net/downloads/cacti-0.8.8b.tar.gz //cacti官网最新版
    [iyunv@Cacti ~]#tar -zxvf cacti-0.8.8b.tar.gz
    [iyunv@Cacti ~]#mv cacti-0.8.8b /var/www/html/cacti //将cacti-0.8.8b文件夹移到/var/www/html目录下,并将cacti-0.8.8b重命名为cacti

    7:设置mysql数据库

    [iyunv@Cacti ~]#mysql -uroot -p //新装的mysql没有密码,直接回车进入mysql数据库
    mysql>create database cacti; //首先创建cacti数据库,注意别丢了分号
    mysql>grant all privileges on cacti.* to cacti@localhost identified by 'cacti' with grant option; //创建cacti用户并授权
    mysql>use cacti;
    mysql>source /var/www/html/cacti/cacti.sql; //导入cacti数据库文件
    mysql>exit

    8:配置cacti

    [iyunv@Cacti ~]#vim /var/www/html/cacti/include/config.php
    $database_type = "mysql";
    $database_default = "cacti";
    $database_hostname = "localhost";
    $database_username = "cactiuser"; //因为我们先前在数据库建的是 "cacti" 用户,所以这里默认的 "cactiuser" 要改为 "cacti"
    $database_password = "cactiuser"; //这里默认的密码我们也要改为 "cacti"
    $database_port = "3306";

    9:增加 cacti 用户以用来写入rrd和log目录的数据,否则就会生成不了图片

    [iyunv@Cacti ~]#useradd cacti
    [iyunv@Cacti ~]#cd /var/www/html/cacti
    [iyunv@Cacti ~]#chown -R cacti rra/ log/

    10:添加任务计划

    具体多长时间让cacti生成一次监控图表自己决定,这里以cacti的默认时间5分钟生成一次为例
    [iyunv@Cacti ~]#crontab -e
    加入这一行保存即可
    */5 * * * * /usr/bin/php /var/www/html/cacti/poller.php > /dev/null 2>&1

  • 相关阅读:
    打印螺旋矩阵
    关于矩阵的操作
    最大公约数和最小公倍数
    将一个十进制数转化为16进制数
    打印菱形
    DEDECMS织梦全站动态化访问(包括自由列表freelist)及发布内容时自动动态化设置
    单例模式2014/3/27
    模式2014/3/26
    写一些体会2014/3/25
    推荐大家一本学习php模式的书
  • 原文地址:https://www.cnblogs.com/yunweis/p/7873009.html
Copyright © 2011-2022 走看看