在 FreeBSD 10.0 上安装 SmokePing

SmokePing 是一款开源网络延迟监控工具,其作者 Tobi Oetiker 还开发了一些我们熟悉的 MRTG 和 RRDtool. SmokePing 能采用多种方式对网络延迟(性能)进行监测和警告,支持插件的方式对网络的其他指标进行监控,并且支持 Matser/Slave 分布式架构,多节点监控数据可以汇集到一起并通过颜色和阴影来展现网络延迟和丢包。以下操作在 FreeBSD 10.0 上测试通过。

在开始之前,最好升级一下系统:

# freebsd-update fetch
# freebsd-update install

现在 FreeBSD 有了一套新的软件包管理工具 pkg,目的是用来替代老的 pkg_info/pkg_create/pkg_add. 这里用新工具 pkg 来安装 smokeping,并把 smokeping 加到系统启动文件里:

# pkg install smokeping
# echo 'smokeping_enable="YES"' >> /etc/rc.conf

修改 smokeping_secrets 文件权限后启动 smokeping:

# chmod 600 /usr/local/etc/smokeping/smokeping_secrets
# /usr/local/etc/rc.d/smokeping start

smokeping 是 Perl 写的,还需要安装几个 perl 模块:

# perl -MCPAN -e shell
Terminal does not support AddHistory.

cpan shell -- CPAN exploration and modules installation (v1.9800)
Enter 'h' for help.

cpan[1]> install FCGI
cpan[1]> install CGI

要看 web 界面的话 smokeping 还需要 apache 的支持,安装 apache 并加到系统启动文件:

# pkg install apache24
# echo 'smokeping_enable="YES"' >> /etc/rc.conf

因为 pkg 里面没有 mod_fcgid,不能 pkg install mod_fcgid,所以需要使用 FreeBSD 传统的 port 编译安装:

# portsnap fetch extract
# portsnap fetch update

# cd /usr/ports/www/mod_fcgid
# make install clean

配置 apache:

# vi /usr/local/etc/apache24/Includes/smokeping.conf
LoadModule fcgid_module libexec/apache24/mod_fcgid.so


    AddHandler fcgid-script .fcgi


Alias /smokeping "/usr/local/smokeping/htdocs"

    Options Indexes FollowSymLinks ExecCGI
    AllowOverride All
    Require all granted

# vi /usr/local/etc/apache24/httpd.conf
...
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#

    DirectoryIndex index.html smokeping.fcgi

...

配置 smokeping,在 *** Targets *** 一栏加入要监控的机器:

# vi /usr/local/etc/smokeping/config
...
*** Targets ***

probe = FPing

menu = Top
title = Network Latency Grapher
remark = Welcome to vpsee.com

+ Local

menu = Local
title = Local Network

++ node11

menu = node11
title = node11
host = node11.vpsee.com
...

做了配置后,别忘了重启服务:

# service smokeping restart
# service apache24 restart

打开浏览器访问 http://192.168.2.123/smokeping/

SmokePing

评论 (1 Comment)

  1. # pkg install apache24
    # echo ‘smokeping_enable=”YES”‘ >> /etc/rc.conf
    这里的smokeping_enable,应该是apache24_enable。
    – – –
    cpan[1]> install FCGI
    cpan[1]> install CGI
    第二个我这是[2]
    – – –
    没有 /usr/local/etc/apache24/Includes/smokeping.conf 这个文件,是把下面几行代码输进去保存吗?
    /usr/local/etc/apache24/httpd.conf 就是在 DirectoryIndex index.html 后加 smokeping.fcgi 吧?
    – – –
    完全按照本文来做,最后重启服务的时候有问题,页面也打不开。
    http://ww1.sinaimg.cn/large/6acc8f77gw1en0ewuwtptj20k2080q4q.jpg

发表评论