• lnmp 的监控----cacti


    cacti

    cacti配置
    可以查看官方文档     http://docs.cacti.net/manual:087
    tar zxf cacti-0.8.7h.tar.gz -C /usr/local/lanmp/nginx/html/                 //解压到nginx目录下
    cd /usr/local/lanmp/nginx/html/
    ln -s cacti-0.8.7h/ cacti                                                                          //做软链方便访问
    nginx
    /etc/init.d/mysqld start
    /etc/init.d/php-fpm start                                                                          //启动所需要的服务
     
    yum list rrdtool
    yum install rrdtool.x86_64 -y                                                            //需要rrdtool这个包
    cd cacti
    mysql -pwestos cacti < cacti.sql                                                //导入cacti的数据库文件
     
    mysql> grant all on cacti.* to cacti@localhost identified by 'cacti';            //创建cacti这个数据库用户
    cd include/
    vim config.php                                                                              //修改cacti配置文件
    修改参数
    $database_username = "cacti";                                                //数据库的用户和密码
    $database_password = "cacti";
     
    yum install net-snmp.x86_64 net-snmp-utils.x86_64 net-snmp-perl.x86_64 net-snmp-python.x86_64
    vim /usr/local/lanmp/nginx/html/cacti-0.8.7h/lib/functions.php
    修改这个,否则无法访问,页面
            unset($session_unregister[$var_name]);                            //将410行改成这个
    [root@server4 cacti]# useradd cacti
    [root@server4 cacti]# chown -R cacti *                              //修改此目录权限
    [root@server4 cacti]# su - cacti [cacti@server4 ~]$ crontab -e 添加这句
    */5 * * * *   /usr/local/lanmp/php/bin/php     /usr/local/lanmp/nginx/html/cacti/poller.php
     
    [root@server4 cacti]# /etc/init.d/snmpd start
    Starting snmpd:                                            [  OK  ]                                                //启动snmp服务
    http://www.cyberciti.biz/nixcraft/linux/docs/uniqlinuxfeatures/mrtg    //访问这个查看snmp文档
    2.3 Step # 3: Make sure snmp server configured properly                    //选择这个查看设置
    snmpwalk -v 1 -c public localhost IP-MIB::ipAdEntIfIndex
    //查看snmp能否访问到本机的信息                    //如果没有反映,进行一下设置
    vi /etc/snmp/snmpd.conf           //编辑配置文件
    
    将一下内容替换
    com2sec notConfigUser  default       public
    替换成
    com2sec local     localhost           public
    com2sec mynetwork 192.168.0.0/24      public
    group   notConfigGroup v1           notConfigUser
    group   notConfigGroup v2c           notConfigUser
    替换成
    group MyRWGroup v1         local
    group MyRWGroup v2c        local
    group MyRWGroup usm        local
    group MyROGroup v1         mynetwork
    group MyROGroup v2c        mynetwork
    group MyROGroup usm        mynetwork
    view    systemview     included      system
    替换成
    view all    included  .1                               80
    access  notConfigGroup ""      any       noauth    exact  systemview none none
    替换成
    access MyROGroup ""      any       noauth    exact  all    none   none
    access MyRWGroup ""      any       noauth    exact  all    all    none
    /etc/init.d/snmpd restart
    之后用 snmpwalk -v 1 -c public localhost IP-MIB::ipAdEntIfIndex      这条命令进行测试
    可以显示如下信息 [root@server4 ~]# snmpwalk -v 1 -c public localhost IP-MIB::ipAdEntIfIndex IP-MIB::ipAdEntIfIndex.127.0.0.1 = INTEGER: 1 IP-MIB::ipAdEntIfIndex.192.168.0.104 = INTEGER: 2                                                 //snmp配置正常
    之后访问192.168.0.104/cacti
    期间需要指定php目录(如果php是源码安装)
     
    对cacti添加插件模块(0.8.8貌似自带插件模块,不用手动添加啦)
    tar zxf cacti-plugin-0.8.7h-PA-v3.0.tar.gz
    cd cacti-plugin-arch/
    //这里可以看看README,里面有详细的安装过程
     
    mysql -pwestos cacti < pa.sql                                    //导入数据库文件
    cp cacti-plugin-0.8.7h-PA-v3.0.diff /usr/local/lanmp/nginx/html/cacti/
    cd /usr/local/lanmp/nginx/html/cacti/
    patch -p1 -N < cacti-plugin-0.8.7h-PA-v3.0.diff                      //不同版本文件不一样
    安装一些功能插件
    tar zxf monitor-v1.3-1.tgz -C /usr/local/lanmp/nginx/html/cacti/plugins tar zxf settings-v0.71-1.tgz -C /usr/local/lanmp/nginx/html/cacti/plugins
    这里就可以直接访问了,不过要在网页管理里面开启插件功能 但是,这里有一个问题,当点击加载的插件功能时,显示会出现问题,下面是解决方案
    cd /usr/local/lanmp/nginx/html/cacti/
    cd  include/
    vim config.php
    添加
    $url_path = "/cacti/";
    一个加速的插件
    tar zxf cacti-spine-0.8.7h.tar.gz
    官方文档
    http://docs.cacti.net/manual:087:1_installation.1_install_unix.6_install_and_configure_spine#optional_install_and_configure_spine
    cd cacti-spine-0.8.7h
    ./bootstrap
    ./configure  --with-snmp=/usr/   --with-mysql=/usr/local/lanmp/mysql                        //因为之前mysql是源码安装,所以这里要指定mysql的目录
    make
    make install
     cd /usr/local/spine/
    cp spine.conf.dist /etc/spine.conf
    vim /etc/spine.conf
    编辑其中内容
    DB_Host         localhost DB_Database     cacti                                               //之前建立的cacti数据库 DB_User         cacti                                                      //之前cacti数据库用户名 DB_Pass         cacti DB_Port         3306 DB_PreG         1                                                                  //这里要改成1
    /usr/local/spine/bin/spine                                             //启动服务
    之后访问192.168.0.104/cacti/
    在setting中找到Paths
    添加spine的path                                    这里应该为/usr/local/spine/bin/spine
    之后点击Poller选项 在中间有Poller Type这个选项                  在里面选择spine
    然后能看到连续图像,就说明配置好了
    监控远程主机,在远程主机中要安装SNMP服务,并且开启,然后在192.168.0.104/catci/里面的Devices选项中添加一个设备,里面主要要填写的是第一项(描述),第二项(主机名,建立填写ip地址),以及第三项(这里要选择snmp host),因为监控远程主机是基于snmp(简单网管协议)协议的。
  • 相关阅读:
    Python_Day3
    Python_Day2
    动漫推荐3.0 杂谈
    动漫推荐2.0 杂谈
    动漫推荐1.0 剧情向
    西湖十大特产
    一到春天 杭州西湖就美成了一幅画
    机械键盘十大品牌排行榜
    键盘的日常维护及清理
    无线键盘
  • 原文地址:https://www.cnblogs.com/Seven-Wang/p/4451581.html
Copyright © 2020-2023  润新知