Centos6.3系統下Smokeping2.6.8安裝教程

                        Centos6.3系統下Smokeping2.6.8安裝教程html

    smokeping是對IDC網絡質量,穩定性等最好的檢測工具,包括常規的 ping,dig,echoping,curl等,能夠監視www服務器性能,監視dns查詢性能,監視ssh性能等.
linux


一、關閉防火牆和selinux服務web

[root@YZW ~]# service iptables stop數據庫

[root@YZW ~]# setenforce 0apache


二、用yum安裝httpd服務以及一些庫文件bash

[root@YZW ~]# yum -y install httpd httpd-devel gcc make curl wget 服務器

[root@YZW ~]# yum -y install libxml2-devel libpng-devel glib pango pango-devel \ freetype freetype-devel fontconfig cairo cairo-devel \ libart_lgpl libart_lgpl-dev網絡


三、安裝rrdtoolssh

wget http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.4.7.tar.gzcurl

[root@YZW ~]# 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 \

[root@YZW wang]# tar zxvf rrdtool-1.4.7.tar.gz

[root@YZW rrdtool-1.4.7]# cd rrdtool-1.4.7

[root@YZW rrdtool-1.4.7]# ./configure --prefix=/usr/local/rrdtool

[root@YZW rrdtool-1.4.7]#make

[root@YZW rrdtool-1.4.7]#make install

[root@YZW rrdtool-1.4.7]#/usr/local/rrdtool/bin/rrdtool -v 若是出現如下信息表示安裝成功了!

RRDtool 1.4.7  Copyright 1997-2010 by Tobias Oetiker 

               Compiled Jun 17 2012 09:50:49

Usage: rrdtool [options] command command_options

Valid commands: create, update, updatev, graph, graphv,  dump, restore,

              last, lastupdate, first, info, fetch, tune,

              resize, xport, flushcached

RRDtool is distributed under the Terms of the GNU General

Public License Version 2. (www.gnu.org/copyleft/gpl.html)

For more information read the RRD manpages


四、安裝CGILIB

wget http://down1.chinaunix.net/distfiles/cgilib-0.5.tar.gz

[root@YZW wang]# tar zxvf cgilib-0.5.tar.gz

[root@YZW cgilib-0.5]# cd cgilib-0.5

[root@YZW cgilib-0.5]# make

[root@YZW cgilib-0.5]# cp libcgi.a /usr/local/lib

[root@YZW cgilib-0.5]# cp libcgi.a /usr/local/lib64

[root@YZW cgilib-0.5]# cp cgi.h /usr/include


五、安裝FPING-2.4B_TO

wget http://oss.oetiker.ch/smokeping/pub/fping-2.4b2_to4-ipv6.tar.gz

[root@YZW wang]# tar zxvf fping.tar.gz

[root@YZW wang]# cd fping-2.4b2_to4-ipv6/

[root@YZW fping-2.4b2_to4-ipv6]# ./configure

[root@YZW fping-2.4b2_to4-ipv6]# make 

[root@YZW fping-2.4b2_to4-ipv6]# make check

[root@YZW fping-2.4b2_to4-ipv6]# make install


六、安裝echoping

wget http://jaist.dl.sourceforge.net/project/echoping/echoping/6.0.0/echoping-6.0.0.tar.gz

[root@YZW ~]# yum install popt popt-devel gettext libidn libidn-devel

[root@YZW wang]# tar zxvf echoping-6.0.0.tar.gz

[root@YZW wang]# cd echoping-6.0.0

[root@YZW echoping-6.0.0]# ./configure

[root@YZW echoping-6.0.0]# make

[root@YZW echoping-6.0.0]# make install


七、安裝FCGI

wget http://cpan.communilink.net/authors/id/F/FL/FLORA/FCGI-0.74.tar.gz

[root@YZW wang]# tar zxvf FCGI-0.74.tar.gz

[root@YZW wang]# cd FCGI-0.74

[root@YZW FCGI-0.74]# perl Makefile.PL

[root@YZW FCGI-0.74]# make

[root@YZW FCGI-0.74]# make install


八、安裝MOD_FASTCGI,DSO

[root@YZW wang]# tar zxvf mod_fastcgi-2.4.6.tar.gz

[root@YZW wang]# cd mod_fastcgi-2.4.6

[root@YZW mod_fastcgi-2.4.6]# apxs -o mod_fastcgi.so -c *.c

[root@YZW mod_fastcgi-2.4.6]# apxs -i -a -n fastcgi .libs/mod_fastcgi.so


九、安裝smokeping

wget http://oss.oetiker.ch/smokeping/pub/smokeping-2.6.8.tar.gz

[root@YZW ]#yum install cpan

[root@YZW wang]# tar zxvf smokeping-2.6.8.tar.gz

[root@YZW wang]# cd smokeping-2.6.8

[root@YZW smokeping-2.6.8]# cp /usr/local/rrdtool/lib/perl/5.10.1/x86_64-linux-thread-multi/RRDs.pm /usr/lib64/perl5

[root@YZW smokeping-2.6.8]# cp /usr/local/rrdtool/lib/perl/5.10.1/x86_64-linux-thread-multi/auto/RRDs/RRDs.so /usr/lib64/perl5

[root@YZW smokeping-2.6.8]# ./configure --prefix=/usr/local/smokeping

執行完下面4條命令後在執行一次./configure --prefix=/usr/local/smokeping不然當你在執行/usr/bin/gmake install會報錯

[root@YZW smokeping-2.6.8]# ./setup/build-perl-modules.sh /usr/local/smokeping/thirdparty

[root@YZW smokeping-2.6.8]# perl -MCPAN -e 'install CGI'D

[root@YZW smokeping-2.6.8]# perl -MCPAN -e 'install CGI::Fast '

[root@YZW smokeping-2.6.8]# perl -MCPAN -e ' Config::Grammar '

[root@YZW smokeping-2.6.8]# /usr/bin/gmake install


十、驗證smokeping安裝是否成功!

[root@YZW smokeping-2.6.8]# cd /usr/local/smokeping/

[root@YZW smokeping]# ls 

若是發現有如下幾個目錄表明你安裝smokeping成功了!

bin  etc  htdocs  lib  share  thirdparty


十一、建立data、var、cache、smokeing日誌文件並修改權限

[root@YZW ~]# mkdir /usr/local/smokeping/data

[root@YZW ~]# mkdir /usr/local/smokeping/var

[root@YZW ~]# mkdir /usr/local/smokeping/cache

[root@YZW ~]# touch /var/log/smokeping.log

[root@YZW ~]# chown apache.apache /var/log/smokeping.log

[root@YZW ~]# chown -R apache.apache /usr/local/smokeping/


十二、給smokeping配置文件修更名字

[root@YZW ~]# cp -a /usr/local/smokeping/htdocs/smokeping.fcgi.dist smokeping.fcgi

[root@YZW ~]# cp -a /usr/local/smokeping/etc/config.dist config


1三、修改密碼文件權限

[root@YZW ~]# chmod 600 /usr/local/smokeping/etc/smokeping_secrets.dist

[root@YZW ~]# ls -lh /usr/local/smokeping/etc/smokeping_secrets.dist


1四、修改smokeping主配置文件

[root@YZW ~]# vi /usr/local/smokeping/etc/config

cgiurl   = http://192.168.1.10/smokeping.cgi    //這個是訪問smokeping的路徑


*** Database ***

step     = 60  60秒ping20個包

pings    = 20


*** Presentation ***

template = /usr/local/smokeping/etc/basepage.html.dist

charset=UTF-8  新添加的一行內容


+ FPing        修改fping的路徑

binary = /usr/local/sbin/fping

packetsize = 2000 


[root@YZW ~]# vi /usr/local/smokeping/bin/smokeping

use lib qw(/usr/local/rrdtool/lib/perl);

use lib qw(/usr/local/smokeping/lib);


1五、配置Apache服務的主配置文件

[root@YZW local]# vi /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>


1六、建立登陸smokeping的帳戶並設置密碼

[root@YZW ~]# htpasswd -c /usr/local/smokeping/htdocs/htpasswd admin


1七、編寫一個smokeping啓動腳本

[root@YZW ~]# vi /etc/init.d/smokeping

#!/bin/bash

PIDFILE=/usr/local/smokeping/var/smokeping.pid

SMOKEPING=/usr/local/smokeping/bin/smokeping

ERROR=0

RUNNING=0

ARGV="$@"

if [ "x$ARGV" = "x" ] ; then

ARGS=help

fi

for ARG in $@ $ARGS

do

if [ -f $PIDFILE ] ; then

PID=`cat $PIDFILE`

if kill -0 $PID 2>/dev/null ; then

# smokeping is running

RUNNING=1

else

# smokeping not running but PID file exists => delete PID file

rm -f $PIDFILE

RUNNING=0

fi

else

# smokeping (no pid file) not running

RUNNING=0

fi

case $ARG in

start)

if [ $RUNNING -eq 0 ] ; then

if $SMOKEPING > /dev/null; then

echo "$0 $ARG: smokeping started"

else

echo "$0 $ARG: smokeping could not be started"

ERROR=1

fi

else

echo "$0 $ARG: smokeping is running with PID $PID"

ERROR=2

fi

;;

stop)

if [ $RUNNING -eq 1 ] ; then

if kill $PID ; then

echo "$0 $ARG: smokeping ($PID) stopped"

rm $PIDFILE

else

echo "$0 $ARG: smokeping could not be stopped"

ERROR=3

fi

else

echo "$0 $ARG: smokeping not running"

ERROR=4

fi

;;

restart)

if [ $RUNNING -eq 1 ] ; then

if $SMOKEPING --restart > /dev/null; then

echo "$0 $ARG: smokeping restarted"

else

echo "$0 $ARG: smokeping could not be started"

ERROR=5

fi

else

$0 start

fi

;;

strace_debug)

rm -f /tmp/strace_smokeping

if [ $RUNNING -eq 1 ] ; then

if strace -o/tmp/strace_smokeping $SMOKEPING --restart >/dev/null; then

echo "$0 $ARG: smokeping restarted with strace debug in /tmp/strace_smokeping"

else

echo "$0 $ARG: smokeping strace debug could not be started"

ERROR=6

fi

else

if strace -o/tmp/strace_smokeping $SMOKEPING >/dev/null; then

echo "$0 $ARG: smokeping started with strace debug in /tmp/strace_smokeping"

else

echo "$0 $ARG: smokeping strace debug could not be started"

ERROR=7

fi

fi

;;

status)

if [ $RUNNING -eq 1 ] ; then

echo "$0 $ARG: smokeping is running with PID ($PID)"

else

echo "$0 $ARG: smokeping is not running"

fi

;;

*)

echo "usage: $0 (start|stop|restart|status|strace_debug|help)"

cat 

start - start smokeping

stop - stop smokeping

restart - restart smokeping if running or start if not running

status - show status if smokeping is running or not

help - this screen

EOF

;;

esac

done

exit $ERROR



1七、給腳本執行權限

[root@YZW ~]# chmod +x /etc/init.d/smokeping


1八、檢查smokeping配置文件是否有錯誤,啓動smokeping、httpd服務

[root@YZW ~]# service httpd retsart

[root@YZW ~]# /usr/local/smokeping/bin/smokeping --check


[root@YZW ~]# echo "/usr/local/smokeping/bin/smokeping --logfile=/var/log/smokeping.log 2>&1 &" >> /etc/rc.local


1九、訪問smokeping頁面

http://192.168.1.10/smokeping

wKioL1P3PN7Qu6p1AAFNNZz0qPs430.jpg20、簡單的介紹下smokeping主配置文件內容的用途

General 屬於基本配置。須要注意的是imgcache和imgurl這兩個參數和apache配置相關聯,若是配置不正確的話,打開web的時候圖片會顯示不出來我這裏邊的路徑是默認的,若是你改過路徑這裏邊的路徑也須要改動。

wKioL1TM6MWRnFiOAAI1RBQf7zs061.jpg

Alerts是屬於報警設置

wKioL1P3P0Lwg2dyAAEZXoTny-8952.jpg

Database是 RRD數據庫配置,step和pings這兩個參數要在啓動smokeping以前配置好,若是在smokeping啓動後再配置這兩個參數,須要把原來的rrd文件都刪除,而後再啓動smokeping才能夠。step=30pings=20 是每300s內執行20次ping的動做.

wKiom1P3QEmB7_9PAAC-VwgEcNA831.jpg

Presentation 是關於網絡狀態的一些配置和解釋,基本不須要更改

wKioL1P3Qp2iYnM8AAGY9YvjNMM806.jpg

Probes指針配置,確保fping路徑正確,packetsize參數是設置Fping值的。

wKioL1P3QxHBy12gAABRRmjSqH0096.jpg

Targets配置你所監控的對象

wKiom1P3RE6wYmcMAAH6R-gQU6U755.jpg

2一、安裝Smokeping遇到的問題總結

如下這幾個問題都是由於本人操做失誤形成的算不上什麼問題,若是你們細心的話這些問題都是能夠避免的。

(1)smokeping安裝完後http://192.168.1.10/smokeping訪問smokeping時一直提示404錯誤?

緣由是在我執行cp -a /usr/local/smokeping/htdocs/smokeping.fcgi.cgi smokeping.fcgi時名字沒有改變因此一直報錯,解決辦法是進入該目錄修更名字便可。

(2)啓動smokeping時提示ERROR: slave 'boomer' is not defined in the '*** Slaves ***' section?

解決辦法是vi /usr/local/smokeping/etc/config在slaves中添加一個節點問題解決。

(3)Smokeping安裝成功後有圖可是沒有數據?

檢查smokeping如下兩個主配置文件有沒有生成rrd和png文件

/usr/local/smokeping/data/Test  rrd生成文件路徑

/usr/local/smokeping/cache/Test/ cache和Test 目錄下查看是否有png文件

(4)訪問Smokeping時報500錯誤

wKioL1U4qoqzuIIDAAFvMTsY0H0290.jpg問題緣由是由於Selinux沒有關閉形成的,配置文件修改必須重啓服務器生效!

[root@YZW ~]# vi /etc/sysconfig/selinux  

SELINUX=disabled

[root@YZW ~]# setforce 0 臨時修改生效

[root@YZW ~]# getenforce 查看結果

Permissive


查看smokeping主目錄權限

ls -lh /usr/local/smokeping/


查看你所監控的設備是否正常,監控自己的selinux和iptables是否關閉


在smokeping主配置文件裏邊添加監控設備的時候要以如下格式不然會形成出圖不出數據的狀況並且標題目錄必須是英文。

+ qitawangluo

++ dianxin-hlj

+++ dianxin-zongliebiao

我這裏沒有顯示數據的緣由是由於我把我添加的監控節點添加到了Targets的一級目錄裏邊去了,應該單獨另起一個一級目錄而後二級、三級還有一個我寫成中文了!

正常的圖以下:

wKiom1P3Sa-hvYEzAALRNU0DtJQ781.jpg

Smokeping安裝以及配置到此爲止,對於初次安裝Smokeping的但願能夠幫到你們!

相關文章
相關標籤/搜索