• Cacti优化之spine轮询器


    由于效率的原因,在需要大量采集数据时,如果使用自带的cmd.php轮询器会比较慢,1分钟1次的采集频率可能无法完成轮询所有的被监控的机器,从而可能导致部分监控项目不出图或图形断断续续。为了解决效率问题,Cacti官方也推出spine,采用多线程的方式高效的轮询。


    1、解决依赖关系
    ## 依赖于mysql mysql-devel net-snmp-devel openssl-devel
    ## 我们在安装cacti的时候已经安装 mysql mysql-devel 所以,这里只需安装另外2个
    # yum -y install net-snmp-devel openssl-devel

    2、安装spine,下载的版本最好与cacti一致,spine-0.8.8b

    wget https://www.cacti.net/downloads/spine/cacti-spine-0.8.8h.tar.gz
    # tar xf cacti-spine-0.8.8b.tar.gz
    # cd cacti-spine-0.8.8b
    # ./configure
    # make && make install

    3、提供配置文件
    # cp /usr/local/spine/etc/spine.conf.dist /etc/spine.conf
    ## 编辑配置文件,请根据实际情况修改
    # vi /etc/spine.conf
    DB_Host localhost
    DB_Database cactidb
    DB_User cactiuser
    DB_Pass cactiuser
    DB_Port 3306
    DB_PreG 0

    # 这里的配置是怎么来的呢? 还记得吧, 就是 cacti/include/config.php
    /* make sure these values refect your actual database/host/user/password */
    $database_type = "mysql";
    $database_default = "cactidb";
    $database_hostname = "localhost";
    $database_username = "cactiuser";
    $database_password = "cactiuser";
    $database_port = "3306";
    $database_ssl = false;

    4、测试
    # /usr/local/spine/bin/spine
    SPINE: Using spine config file [/etc/spine.conf]
    SPINE: Version 0.8.8b starting
    SPINE: Time: 0.1707 s, Threads: 5, Hosts: 2

    5、设置spine的路径
    Console -> Configureation -> Settings -> Alternate Poller Path -> Spine Poller File Path
    输入spine的路径:默认安装在/usr/local/spine/bin/spine

    6、修改cacti默认的Poller Types
    Console -> Cacti Settings -> Poller -> Poller Type
    在下拉框中,选择spine, 然后记得“Save”

    然后修改计划任务,由原来的5分钟执行一次,修改为每分钟执行一次

    */5 * * * * php /opt/cacti/cacti/poller.php > /dev/null 2>&1    ------>  */1 * * * * php /opt/cacti/cacti/poller.php > /dev/null 2>&1 

    原来五分钟图应该是最上层,现在最上层已经换成一分钟图了。不过要注意的是,一分钟图的刻度是五分钟一跳,但还是要五分钟才绘出详细的图象(即一次绘出五个点)。注意,一分钟图的数据点,并不是在刻度点才开始变化的,这表明两个刻度点之间的四分钟都是有记录的。

     

  • 相关阅读:
    [转]ThinkPHP中如何使用原生SQL
    php定时回调接口
    [转]mysql dual虚拟表
    [转]mysql变量使用总结
    [转]使用mysql profiles 来查看sql 语句执行计划
    [转]Mysql中的SQL优化与执行计划
    [转]MySQL单列索引和组合索引的区别介绍
    前端开发框架
    sugar crm
    [转]MCC(移动国家码)和 MNC(移动网络码)
  • 原文地址:https://www.cnblogs.com/fjping0606/p/6007952.html
Copyright © 2020-2023  润新知