在購買VPS主機之前,我通常會先查看別人使用該VPS主機的評價,尤其是VPS主機的線路是我最在意的地方。因為國外的VPS主機商非常多,但是真正從國內訪問速度快的機房也就是那麼幾個。線路不好,速度慢的VPS,不適合搭中文網站。

同時,我也發現了另一個問題,那就是某一個VPS主機在最開始測試時線路質量很好,但是隨著用戶的增多VPS主機訪問也越來越不穩定了,這是最開始使用VPS主機沒有想到的。所以,迫切需要一個國外VPS主機線路監控報告,能夠直覺地了解VPS主機線路的變化。

滿足上面要求的,恐怕只有Smokeping了。 Smokeping是一個開源且免費的網路效能監控工具,主要用於監視網路效能,包括常規的 ping,dig,echoping,curl等,可以 監視 www 伺服器效能,監視 dns 查詢效能,監視 s-s-h 效能等。最重要的是Smokeping的圖表非常直覺。

Smokeping採用rrdtool做支持,產生的網路延遲資料轉換圖表非常漂亮,支援互動式圖形瀏覽,你可以查看任意時間段的監控資料。 Smokeping也可以部署主/從分散式測量,即用一台伺服器作為“主”,其它的伺服器作為“從”並向“主”伺服器傳輸數據,最後匯總形成系統監控數據圖表。

Smokeping安裝與配置-免費開源的網路效能監控工具視覺化圖表主/從分散式測量

這篇文章就來分享一下Smokeping安裝與設定方法,更多關於VPS主機效能與速度評測可以參考:VPS主機排行榜單,你也可以自己按照下面的方法來給VPS主機作一個「體檢」:

  1. 接取CN2線路VPS主機商及機房彙總-鑑別真假CN2線路主機參考手冊
  2. 三大免費工具幫助你偵測VPS伺服器真偽-VPS主機效能與速度測試方法
  3. 一個使用了阿里雲VPS主機三年的站長總結出阿里雲的五大特點

PS:2017年10月21日更新,如果你發現自己的VPS伺服器經常出現宕機或異常,你或許可以使用這個工具找出「真兇」:伺服器日誌分析利器:ngxtop和GoAccess-即時監控視覺化管理快速找出異常來源。

PS:2018年10月27日更新,Smokeping手動安裝比較麻煩,有興趣的朋友可以試試SmokePing Nginx一鍵安裝包:網路監控工具:SmokePing Nginx一鍵安裝/管理腳本。

一、Smokeping安裝前準備

Smokeping官網:

  1. HTTPS://OSS.喔誒替客人.吃/沙摩柯坪/index.恩.HTML
  2. HTTPS://GitHub.com/喔誒替客人/smoke ping

Smokeping需要以下元件依賴(有optional為可選項):

RRDtool 1.2.x 或 later

FPing (optional)

EchoPing (Optional)

Curl (Optional)

dig (Optional)

S-S-H (Optional)

Webserver

Perl 5.8.8 or later(對應的模組如下)

FCGI

CGI, CGI::Fast

Config::Grammar

LWP

Socket6 (optional)

Net::Telnet (optional)

Net::OpenS-S-H (optional)

Net::.DNS (optional)

Net::LDAP (optional)

IO::Socket::SSL (optional)

Authen::Radius (optional)

Smokeping官網推薦用Apache來運行,當然也可以使用Nginx,但是你需要設定好Nginx FCGI才行。本篇文章測試的環境是:CentOS 6.8+Apache。執行以下命令安裝相關元件依賴:

#临时修改hostname
sudo hostname ping.wzfou.com
#查看是否成功
hostname
#永久修改Hostname
vi  /etc/sysconfig/network
#修改原hostname为
ping.wzfou.com
#查看是否成功
hostname

//如果是CentOS 7,永久性的修改主机名称,重启后能保持修改后的。
hostnamectl set-hostname ping.wzfou.com
//重启后可以看到
hostnamectl
#禁用SELinux
vi /etc/selinux/config
SELINUX = disabled

#同步时间
yum -y install ntpdate
ntpdate times.aliyun.com

#安装epel源
wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -ivh epel-release-6-8.noarch.rpm
#备用地址:https://do.wzfou.net/wzfou/epel-release-6-8.noarch.rpm

#安装rrdtool与依赖库
yum -y install perl perl-Net-Telnet perl-Net-DNS perl-LDAP perl-libwww-perl perl-RadiusPerl perl-IO-Socket-SSL perl-Socket6 perl-CGI-SpeedyCGI perl-FCGI perl-CGI-SpeedCGI perl-Time-HiRes perl-ExtUtils-MakeMaker perl-RRD-Simple rrdtool rrdtool-perl curl fping echoping  httpd httpd-devel gcc make  wget libxml2-devel libpng-devel glib pango pango-devel freetype freetype-devel fontconfig cairo cairo-devel libart_lgpl libart_lgpl-devel mod_fastcgi mod_ssl git bind-utils fping

#安装中文字体
yum -y install wqy-zenhei-fonts #DNS需要用到TCPPing命令,安装方法如下: 首先安装tcptraceroute: yum install tcptraceroute 然后下载: wget http://www.vdberg.org/~richard/tcpping 赋予权限后移动到/usr/bin目录下即可使用: chmod 755 tcpping mv tcpping /usr/bin/ 经过测试,发现tcpping的IP必须要有80服务才行

安裝過程中可能會出現某個依賴找不到情況,一般影響不大,你只要在下面的操作中能夠正常進行就可以了。

二、下載Smokeping安裝並配置

執行以下命令開始安裝Smokeping:

wget http://oss.oetiker.ch/smokeping/pub/smokeping-2.6.9.tar.gz
tar zxvf smokeping-2.6.9.tar.gz
cd smokeping-2.6.9
./configure --prefix=/usr/local/smokeping
./setup/build-perl-modules.sh /usr/local/smokeping/thirdparty
#备用地址:https://do.wzfou.net/wzfou/smokeping-2.6.9.tar.gz

安装过程中,可能会出现下面的提示:
** Aborting Configure ******************************

   If you know where perl can find the missing modules, set
   the PERL5LIB environment variable accordingly.

   FIRST though, make sure that 'perl' starts the perl
   binary you want to use for SmokePing.

   Now you can install local copies of the missing modules
   by running

     ./setup/build-perl-modules.sh /usr/local/smokeping/thirdparty

   The RRDs perl module is part of RRDtool. Either use the rrdtool
   package provided by your OS or install rrdtool from source.
   If you install from source, the RRDs module is located
   PREFIX/lib/perl

#这是因为缺少相应的perl模块,直接按照提示执行:
./setup/build-perl-modules.sh /usr/local/smokeping/thirdparty
#继续执行操作:
./configure --prefix=/usr/local/smokeping
/usr/bin/gmake install

執行以下命令開始設定Smokeping:

#创建 cache、data、var 数据目录
cd /usr/local/smokeping
mkdir cache data var

#创建日志
touch /var/log/smokeping.log

#授权
chown apache:apache cache data var
chown apache:apache /var/log/smokeping.log

#修改配置文件
cd /usr/local/smokeping/htdocs/
mv smokeping.fcgi.dist smokeping.fcgi
cd /usr/local/smokeping/etc
mv config.dist config

#vim config
#cgiurl = http://some.url/smokeping.cgi
...
#step = 300
#ping = 5

你可以用Vim開啟config文件,或是自己使用SFTP登入用編輯器開啟config文件,這裡你需要修改一下cgiurl,替換成你的IP或域名,詳細的config請看下一部分。

最後,給密碼檔案一個權限:

chmod 600 /usr/local/smokeping/etc/smokeping_secrets.dist

三、安裝Apache並配置Smokeping

剛才我們透過Yum的方法已經安裝好了Apache,這裡我們需要修改Apache的設定文件,將IP或網域調整存取到Smokeping路徑,指令如下:

vim /etc/httpd/conf/httpd.conf
#在最后添加以下内容
Alias /cache "/usr/local/smokeping/cache/"
Alias /cropper "/usr/local/smokeping/htdocs/cropper/"
Alias /smokeping "/usr/local/smokeping/htdocs/smokeping.fcgi"
<Directory "/usr/local/smokeping">
AllowOverride None
Options All
AddHandler cgi-script .fcgi .cgi
Order allow,deny
Allow from all
DirectoryIndex smokeping.fcgi
</Directory>

#######################################################
#如果你想让你的Smokeping访问不公开,你可以设置访问密码
vim /etc/httpd/conf/httpd.conf
Alias /cache "/usr/local/smokeping/cache/"
Alias /cropper "/usr/local/smokeping/htdocs/cropper/"
Alias /smokeping "/usr/local/smokeping/htdocs/smokeping.fcgi"
<Directory "/usr/local/smokeping">
AllowOverride None
Options All
AddHandler cgi-script .fcgi .cgi
AllowOverride AuthConfig
Order allow,deny
Allow from all
AuthName "Smokeping"
AuthType Basic
AuthUserFile /usr/local/smokeping/htdocs/htpasswd
Require valid-user
DirectoryIndex smokeping.fcgi
</Directory>
#再执行设置密码
htpasswd -c /usr/local/smokeping/htdocs/htpasswd admin

以上你可以用Vim指令,也可以自己用編輯器將設定檔下載到本地進行編輯。

設定 Smokeping、Apache 開機啟動:

echo "/usr/local/smokeping/bin/smokeping --logfile=/var/log/smokeping.log 2>&1 &" >> /etc/rc.local
chkconfig httpd on

四、 Smokeping啟動和遇到的問題

執行以下指令即啟動 Smokeping:

/etc/init.d/httpd start
/usr/local/smokeping/bin/smokeping --logfile=/var/log/smokeping.log2>&1&

開啟你的瀏覽器存取:ip或網域名稱/smokeping,你就可以看到Smokeping預設的介面了。

4.1  Smokeping支援中文問題

預設的Smokeping顯示中文會亂碼,我們剛剛在上面給Linux安裝了中文字體,現在執行:vim /usr/local/smokeping/lib/Smokeping/Graphs.pm,在'- -end', $tasks[0][2],增加一行字體配置部分('--font', "TITLE:20:WenQuanYi Zen Hei Mono",),如下:

...
    if ($mode =~ /[anc]/){
        my $val = 0;
        for my $host (@hosts){
            my ($graphret,$xs,$ys) = RRDs::graph
            ("dummy",
            '--start', $tasks[0][1],
            '--end', $tasks[0][2],
            '--font', "TITLE:20:WenQuanYi Zen Hei Mono",
            "DEF:maxping=$cfg->{General}{datadir}${host}.rrd:median:AVERAGE",
            'PRINT:maxping:MAX:%le' );
            my $ERROR = RRDs::error();
            return "RRDtool did not understand your input: $ERROR." if $ERROR;
            $val = $graphret->[0] if $val < $graphret->[0];
        }
        $val = 1e-6 if $val =~ /nan/i;
        $max = { $tasks[0][1] => $val * 1.5 };
    }
...

如下圖設定:

然後,執行:vim /usr/local/smokeping/etc/config,增加一行程式碼charset= utf-8,如下:

...
***Presentation ***
charset= utf-8
template = /usr/local/smokeping/etc/basepage.html.dist
...

4.2  Smokeping網域存取及SSL憑證

如果你不想讓Smokeping訪問時帶上/Smokeping這麼一個尾巴,你可在Apache配置中修改如下:

Alias / "/usr/local/smokeping/htdocs/smokeping.fcgi" 

為網域新增SSL證書也很簡單,先為你的網域申請一個SSL證書,阿里雲、騰訊雲等都提供了免費一年的SSL證書可供申請。更多的免費SSL憑證請看這裡:免費SSL憑證收集整理匯總-免費給網站添加Https安全加密訪問。

剛才我們已經透過Yum的方式安裝了mod_ssl,現在你可以進入到:/etc/httpd/conf.d,然後替換你的Key、CRT、CA路徑,找到如下程式碼(注意你的憑證路徑):

#   Server Certificate:
# Point SSLCertificateFile at a PEM encoded certificate.  If
# the certificate is encrypted, then you will be prompted for a
# pass phrase.  Note that a kill -HUP will prompt again.  A new
# certificate can be generated using the genkey(1) command.
SSLCertificateFile /etc/pki/tls/certs/domain.crt

#   Server Private Key:
#   If the key is not combined with the certificate, use this
#   directive to point at the key file.  Keep in mind that if
#   you've both a RSA and a DSA private key you can configure
#   both in parallel (to also allow the use of DSA ciphers, etc.)
SSLCertificateKeyFile /etc/pki/tls/certs/domain.key

#   Certificate Authority (CA):
#   Set the CA certificate verification path where to find CA
#   certificates for client authentication or alternatively one
#   huge file containing all of them (file must be PEM encoded)
SSLCACertificateFile /etc/pki/tls/certs/domainca.crt

請將你下載下來的CA根憑證、CRT網域憑證和金鑰Key上傳到/etc/pki/tls/certs/目錄,然後將上面的三條路徑進行替換。最後重啟Apache,就可以看到SSL憑證生效了。

4.3  Smokeping不顯示資料的問題

這個問題一般是因為目錄權限導致的,你可以查看Apache日誌錯誤提示,同時保持cache data var這三個資料夾裡面產生的檔案屬性為可讀寫且擁有者為:apache:apache。

五、Smokeping模板及Config配置詳解

Smokeping模板檔案basepage.html.dist。在basepage.html.dist裡你可以修改Smokeping的CSS樣式、增加Html內容(包含圖片、文字)、修改標題連結等等。

Smokeping Config設定檔詳解,相關的中文說明如下:


*** General ***                                               ##全局配置
owner    = charlie.cui@zerounix.com                           ##联系人(显示在网页上)
contact  = charlie.cui@zerounix.com                           ##联系人邮箱
mailhost = mail.zerounix.com                                  ##邮件服务主机
sendmail = /usr/sbin/sendmail                                 ##发送邮件件的二进制可执行程序
# NOTE: do not put the Image Cache below cgi-bin
# since all files under cgi-bin will be executed ... this is not
# good for images.
imgcache = /usr/local/smokeping/cache                         ##生成图片的缓存
imgurl   = cache                                              ##cache 定义cgi程序显示图片的url目录
datadir  = /usr/local/smokeping/data                          ##rrd文件的位置
piddir  = /usr/local/smokeping/var
cgiurl   = http://some.url/smokeping.cgi                      ##smokeping访问地址
smokemail = /usr/local/smokeping/etc/smokemail                ##发送邮件的邮件内容模板
tmail = /usr/local/smokeping/etc/tmail                        ##HTML邮件模板的路径
# specify this to get syslog logging
syslogfacility = local0                                       ##syslog日志记录的设备编号
# each probe is now run in its own process
# disable this to revert to the old behaviour
# concurrentprobes = no
 
*** Alerts ***                                                ##报警配置
to =  monitor@zerounix.com                                    
from = mon@zerounix.com
 
+网络中断
type = rtt
pattern = !=U,==U
comment = 网络中断
priority = 1
 
+中断恢复
type = rtt
pattern = ==U,!=U,!=U
comment = 中断恢复
priority = 2
 
+严重丢包
type = loss
pattern = >50%
comment = 丢包大于50%
priority = 3
 
+丢包报警
type = loss
pattern = >10%,>10%,>10%
comment = 连续3次丢包10%以上
priority = 4
 
+网络延迟
type = rtt
pattern = >180,>180,>180
comment = 连续3次延时180以上
priority = 5
 
*** Database ***
step     = 60
pings    = 10
 
# consfn mrhb steps total
 
AVERAGE  0.5   1  1008
AVERAGE  0.5  12  4320
    MIN  0.5  12  4320
    MAX  0.5  12  4320
AVERAGE  0.5 144   720
    MAX  0.5 144   720
    MIN  0.5 144   720
 
*** Presentation ***     ##模板文件路径
 
template = /tmp/smokeping-31631-build/etc/basepage.html.dist
 
+ charts
 
menu = Charts
title = The most interesting destinations
 
++ stddev
sorter = StdDev(entries=>4)
title = Top Standard Deviation
menu = Std Deviation
format = Standard Deviation %f
 
++ max
sorter = Max(entries=>5)
title = Top Max Roundtrip Time
menu = by Max
format = Max Roundtrip Time %f seconds
 
++ loss
sorter = Loss(entries=>5)
title = Top Packet Loss
menu = Loss
format = Packets Lost %f
 
++ median
sorter = Median(entries=>5)
title = Top Median Roundtrip Time
menu = by Median
format = Median RTT %f seconds
 
+ overview
 
width = 600
height = 50
range = 10h
 
+ detail
 
width = 600
height = 200
unison_tolerance = 2
 
"Last 3 Hours"    3h
"Last 30 Hours"   30h
"Last 10 Days"    10d
"Last 400 Days"   400d
 
#+ hierarchies
#++ owner
#title = Host Owner
#++ location
#title = Location
 
*** Probes ***  ##探针
+ FPing
binary = /usr/local/sbin/fping
 
+ DNS
binary = /usr/bin/dig
lookup = name.example
*** Slaves ***   ##“从”服务器设置
secrets=/usr/local/smokeping/etc/smokeping_secrets
+boomer
display_name=boomer
color=0000ff
 
+slave2
display_name=another
color=00ff00
 
*** Targets ***   ##监控目标
 
probe = FPing
 
menu = Top
title = Network Latency Grapher
remark = Welcome to the SmokePing website of xxx Company. 
         Here you will learn all about the latency of our network.
 
+ Test
menu= Targets
#parents = owner:/Test/James location:/
 
++ James
 
menu = James
title =James
alerts = someloss
slaves = boomer slave2
host = james.address
 
++ MultiHost
menu = Multihost
title = James and James as seen from Boomer
host = /Test/James /Test/James~boomer

新增監控目標。 *** Targets ***監控主機是分層結構,以+表示,例如第一層“+”,第二層“++”一次類推。這裡給出一個從本地Ping到三大網路並傳回資料的範例程式碼:

+ Other
menu = 三大网络监控
title = 监控统计
++ 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

六、Smokeping主從伺服器分散部署

上面我們在設定檔中看到了:*** Slaves *** ,這就是部署主從伺服器用的。說明如下:

*** Slaves ***
secrets=/usr/local/smokeping/etc/smokeping_secrets.dist
# 定义通信用的秘钥文件,里面包含slave的名字以及对应密码
+ wzfou # slave的名字
display_name=挖站否 # slave的别名
location=杭州电信机房 # 这个字段用来定义slave主机的位置,类似于description
color=0000ff # slave收集的数据在图像中显示的颜色

6.1  Smokeping主伺服器設置

先按照上面的方法部署好主伺服器Smokeping,然後修改smokeping_secrets.dist裡面的內容,如下圖設定好Slave名稱和密碼:

通訊用的秘鑰檔案內容為「slave的名字:密碼」,這裡需要注意秘鑰檔案的權限,由於smokeping的master/slave是透過smokeping程式進行驗證的,所以這個秘鑰檔案owner必須是smokeping進程的運行用戶身份,且權限為600。命令如下:

chown apache:apache /usr/local/smokeping/etc/smokeping_secrets.dist
chmod 600 /usr/local/smokeping/etc/smokeping_secrets.dist

接著,將定義的Slave節點分配給你需要監控的主機,如下說明:

*** Targets ***
++ changzhou ## 一级菜单,这个值将会作为data下的一个目录名被创建 
menu = 常州机房 ## 定义web上显示的菜单名
title = 常州机房  ## 标题名称

+++ dianxin ## 监控主机,数据将会被存放在 data/changzhou/dianxin目录下
menu = 电信机房 ## web上显示的名称 
title = 电信机房监控  ##网页标题
alerts = someloss ## 报警
slaves = wzfou ## slave节点 
host = wzfou.com  ## 被监控的主机IP或者域名 

從上面的配置我們可以看出關鍵地方是要在*** Targets *** 中添加一行:slaves = wzfou ## slave節點,表示slaves 會像主伺服器一樣在此目標展開監控。

6.2  Smokeping從伺服器設置

請依照上文的方法在從伺服器中配置好Smokeping,不需要任何配置,也不需要修改Apache配置,只要保證Smokeping正常安裝並運作即可。 Smokeping啟動從伺服器有幾個參數要了解:

–master-url:當smokeping運行在slave模式下,使用該項目指定master的存取url(web接口,用以通訊)

–slave-name:預設情況下,不指定此項目時,slave連接到master後,master會以slave的hostname作為slavename,如果不希望這樣做,就需要手動指定更改選項

–shared-secret:和master通訊認證的密碼文件

–cache-dir:當smokeping運作在slave模式下,暫存資料存放在master上的目錄路徑

–pid-dir:slave模式下,其pid存放的目錄路徑。可選參數,預設繼承–cache-dir參數的值

同樣的,確保你的Smokeping從伺服器的smokeping_secrets.dist檔案owner是smokeping進程的運行用戶身份,並且權限為600,且從伺服器的smokeping_secrets.dist中只要寫密碼,這一點和主伺服器不同。

這是我的Smokeping從伺服器啟動命令範例(需要注意的就是替換slave的名稱):

/usr/local/smokeping/bin/smokeping --master-url=https://ping.wzfou.com/ --cache-dir=/usr/local/smokeping/cache/ --shared-secret=/usr/local/smokeping/etc/smokeping_secrets.dist --slave-name=wzfou --logfile=/var/log/smokeping_slave.logCopy

七、總結

Smokeping真的是一個非常強大的網路效能監控工具,效果可以查看:ping.wzfou.com。 Smokeping還有不少的探針可供使用,例如Ping、DNS、Curl、Https、SMTP、FTP、TCP、LDAP等,甚至還有不少的插件可以自行安裝開發。 (點擊放大)

這是Smokeping的圖表,非常直觀,容易看懂。 (點擊放大)

檔案權限問題。 這是一個很容易出現問題的地方,修改了config文件後都會在datacachevar中產生數據,如果文件權限不是apache將直接導致rrd文件不更新,web頁面沒有圖像,或者web頁面有圖像但沒有數據。

你可以在伺服器執行以下命令解決問題:

pkill smokeping
chown -R apache:apache /usr/local/smokeping/data
chown -R apache:apache /usr/local/smokeping/cache

/etc/init.d/httpd restart  ##重启Apache
/usr/local/smokeping/bin/smokeping --reload 

重啟smokeping。 每次修改設定檔後需要重新啟動smokeping進程,否則會出現各種問題。重啟smokeping指令如下:

/usr/local/smokeping/bin/smokeping --restart

/usr/local/smokeping/bin/smokeping --reload

pkill smokeping
/usr/local/smokeping/bin/smokeping

master/slave伺服器沒有資料。 對於master/slave的架構,首先確保slave-name和master設定檔中配置的slave節點名稱以及金鑰檔案中的節點名稱相對應。再查看master的金鑰檔案(包含slave節點名稱和密碼)與slave的密碼檔案(只有密碼)是否對應。最後就是金鑰屬性權限一定要600。

PS:2017年11月11日更新,Smokeping在伺服器網路監控方面比較出色,但是如果想要對整個伺服器的記憶體、CPU、連線等指數進行詳細的監控,可以試試企業級的Zabbix:Zabbix安裝與使用-強大的伺服器效能監控工具掌控伺服器軟體硬體資源。

發表評論