• smokeping Master/Slave安装配置


    smokeping Master/Slave安装配置

    官方网站:


    smokeping的作者也是rrdtool,mrtg的作者,是一款分布式的网络可视化监控工具


    环境:
    CentOS 7.1/6.5
    smokeping-2.6.11
    fping-3.10


    一.安装smokeping
    1.smokeping
    yum -y install gcc gcc-c++ make rrdtool rrdtool-perl curl wget perl-devel

    tar -xvf smokeping-2.6.11.tar.gz 
    cd smokeping-2.6.11/
    ./setup/build-perl-modules.sh /opt/smokeping/thirdparty
    ./configure --prefix=/opt/smokeping
    make install
    提示:很多光盘不自带的库都可以通过CPAN来自动安装 ,如:perl -MCPAN -e 'install Time::HiRes'前提是要有公网

    2.fping

    3.echoping(可选)
    echoping is no longer maintained.
    注意:echoping已经不再维护了


    二.配置smokeping
    cd /opt/smokeping
    mkdir cache data var logs
    mv htdocs/smokeping.fcgi.dist htdocs/smokeping.fcgi
    chmod 600 /opt/smokeping/etc/smokeping_secrets.dist

    cp etc/config.dist etc/config
    sed -i '/^step/c step = 60' etc/config #多少秒采集一次数据
    sed -i '/fping/ s#/usr#/usr/local#p' /opt/smokeping/etc/config #fping所在的绝对路径
    sed -i '/Presentation/a charset = UTF-8' /opt/smokeping/etc/config #中文支持,一定要加在*** Presentation ***段落,否则会报语法错误

    setfacl -R -m apache:rwx /opt/smokeping/
    setfacl -R -m d:apache:rwx /opt/smokeping/

    注意:web用户要能读写smokeping的数据

    启动
    /opt/smokeping/bin/smokeping --logfile=/opt/smokeping/logs/smokeping.log
    重启
    /opt/smokeping/bin/smokeping --logfile=/opt/smokeping/logs/smokeping.log --restart
    重载
    /opt/smokeping/bin/smokeping --logfile=/opt/smokeping/logs/smokeping.log --reload
    调式--debug
    smokeping <wbr>Master/Slave安装配置


    四.配置web
    以apache为例:
    yum -y install httpd 
    cat >/etc/httpd/conf.d/smokeping.conf <<HERE
    1. Alias /cache "/opt/smokeping/cache/"  
    2. Alias /cropper "/opt/smokeping/htdocs/cropper/"  
    3. Alias /smokeping "/opt/smokeping/htdocs/smokeping.fcgi"  
    4.   
    5. AllowOverride None  
    6. Options All  
    7. AddHandler cgi-script .fcgi .cgi  
    8. Order allow,deny  
    9. Allow from all  
    10. DirectoryIndex smokeping.fcgi  
    11.  
    HERE
    smokeping <wbr>Master/Slave安装配置
    service httpd restart
    说明:sina博客 php对代码块支持度不好,很多<>显示不出来,所以贴上配置截图

    192.168.192.10/smokeping
    smokeping <wbr>Master/Slave安装配置


    五.测试
    提示:可以删除默认的test Targets---James

    cat >>/opt/smokeping/etc/config <<HERE
    + Other
    menu = ChinaNet & ChinaUnicom & ChinaMobile
    title = Test smokeping
    ++ dianxin
    menu = 电信网络监控
    title = 电信网络监控列表
    host = /Other/dianxin/dianxin-bj /Other/dianxin/dianxin-hlj /Other/dianxin/dianxin-tj  /Other/dianxin/dianxin-sc  /Other/dianxin/dianxin-sh /Other/dianxin/dianxin-gz
    +++ dianxin-bj 
    menu = 北京电信
    title = 北京电信
    alerts = someloss
    host = 202.96.199.133

    +++ dianxin-hlj 
    menu = 黑龙江电信
    title = 黑龙江电信
    alerts = someloss
    host = 219.147.198.242

    +++ dianxin-tj
    menu = 天津电信
    title = 天津电信
    alerts = someloss
    host = 219.150.32.132

    +++ dianxin-sc 
    menu = 四川电信
    title = 四川电信
    alerts = someloss
    host = 61.139.2.69

    +++ dianxin-sh 
    menu = 上海电信
    title = 上海电信
    alerts = someloss
    host = 116.228.111.118

    +++ dianxin-gz 
    menu = 广东电信
    title = 广东电信
    alerts = someloss
    host = 113.111.211.22

    ++ liantong
    menu = 联通网络监控
    title = 联通网络监控列表
    host = /Other/liantong/liantong-bj /Other/liantong/liantong-hlj /Other/liantong/liantong-tj  /Other/liantong/liantong-sc  /Other/liantong/liantong-sh /Other/liantong/liantong-gz

    +++ liantong-bj 
    menu = 北京联通
    title = 北京联通
    alerts = someloss
    host = 61.135.169.121

    +++ liantong-hlj 
    menu = 黑龙江联通
    title = 黑龙江联通
    alerts = someloss
    host = 202.97.224.69

    +++ liantong-tj
    menu = 天津联通
    title = 天津联通
    alerts = someloss
    host = 202.99.96.68

    +++ liantong-sc 
    menu = 四川联通
    title = 四川联通
    alerts = someloss
    host = 119.6.6.6

    +++ liantong-sh 
    menu = 上海联通
    title = 上海联通
    alerts = someloss
    host = 210.22.84.3

    +++ liantong-gz 
    menu = 广东联通
    title = 广东联通
    alerts = someloss
    host = 221.5.88.88

    ++ yidong 
    menu = 移动网络监控
    title = 移动网络监控列表
    host = /Other/yidong/yidong-bj /Other/yidong/yidong-hlj /Other/yidong/yidong-tj  /Other/yidong/yidong-sc  /Other/yidong/yidong-sh /Other/yidong/yidong-gz

    +++ yidong-bj 
    menu = 北京移动
    title = 北京移动
    alerts = someloss
    host = 221.130.33.52

    +++ yidong-hlj 
    menu = 黑龙江移动
    title = 黑龙江移动
    alerts = someloss
    host = 211.137.241.35

    +++ yidong-tj
    menu = 天津移动
    title = 天津移动
    alerts = someloss
    host = 211.137.160.5

    +++ yidong-sc 
    menu = 四川移动
    title = 四川移动
    alerts = someloss
    host = 218.201.4.3

    +++ yidong-sh 
    menu = 上海移动
    title = 上海移动
    alerts = someloss
    host = 117.131.19.23

    +++ yidong-gz 
    menu = 广东移动
    title = 广东移动
    alerts = someloss
    host = 211.136.192.6
    HERE

    /opt/smokeping/bin/smokeping --restart
    smokeping <wbr>Master/Slave安装配置



    六.Master/Slave
    1.安装smokeping Slave
    说明: Slave不需要web服务器,只需要安装smokeping组件
    安装同上,略
    2.配置Master
    a.在配置文件*** Slaves ***段落指定主辅通信密码文件路径及slave名称
    *** Slaves ***
    secrets=/opt/smokeping/etc/smokeping_secrets.dist
    +myslave1
    display_name=smoke-s.example.com
    color=ff0000
    b.在使用的一级目录下添加slaves=smoke-s.example.com
    + Other
    menu = ChinaNet & ChinaUnicom & ChinaMobile
    title = Test smokeping
    slaves=smoke-s.example.com
    ++ dianxin
    menu = 电信网络监控
    title = 电信网络监控列表
    slaves=smoke-s.example.com
    host = /Other/dianxin/dianxin-bj /Other/dianxin/dianxin-hlj /Other/dianxin/dianxin-tj  /Other/dianxin/dianxin-sc  /Other/dianxin/dianxin-sh /Other/dianxin/dianxin-gz
    +++ dianxin-bj
    menu = 北京电信
    title = 北京电信
    slaves=smoke-s.example.com
    alerts = someloss
    host = 202.96.199.133
    ... ...
    注意: slaves必须是主机名或ip
    c.在主辅通信密码文件添加slave主机及密码
    echo smoke-s.example.com:slaveSmokepingP@ssw0rd >>/opt/smokeping/etc/smokeping_secrets.dist
    d.重启Master smokeping
    /opt/smokeping/bin/smokeping --restart
    3.配置Slave
    a.创建主辅通信密码文件
    echo slaveSmokepingP@ssw0rd >/opt/smokeping/etc/slave_secret
    chmod 600 /opt/smokeping/etc/slave_secret
    b.记动slave
    /opt/smokeping/bin/smokeping --master-url=http://192.168.192.10/smokeping --cache-dir=/opt/smokeping/cache/ --shared-secret=/opt/smokeping/etc/slave_secret --logfile=/opt/smokeping/logs/smokeping.log
    smokeping <wbr>Master/Slave安装配置

    smokeping <wbr>Master/Slave安装配置
    提示:如果发现Slave smokeping有图显示,但确没有数据,请开启debug日志查看
    1.主辅通信问题
    2.权限问题
    (本地测试时,等了好久仍有图没数据,开debug也显示通信正常,但就是没数据,后来看了下Slave到Master的传输方式,应该是通过REST接口来写数据,如果用root用户启动则apache用户没有权限来写数据,加上ACL写入权限后数据不一会就过来了)
  • 相关阅读:
    ASP.NET MVC中多种ActionResult用法总结
    jQuery中异步操作对象Deferred
    jQuery中bind方法和live方法区别解析
    深入理解Javascript中this, prototype, constructor
    SQL及常见的三种类型注释
    SQLServer的两个日期相减(间隔)datediff函数
    SQLServer查询进程与死锁语句
    SqlServer获取当前日期的详细写法
    SQL中 Decode 和 Sign 语法的简单用法
    数据仓库模型之CDM、LDM与PDM的区别
  • 原文地址:https://www.cnblogs.com/lixuebin/p/10814070.html
Copyright © 2020-2023  润新知