CentOS 6 or CentsOS 5安裝配置Somkeping

抱怨:剛開始以為這東西配起來應該很簡單,所有隨便在度娘上搜了一個教程就開始配了,誰知道天朝的技術都是一大抄,嚴重鄙視這個篇文章的作者:http://zhumeng8337797.blog.163.com/blog/static/100768914201201195639432/

簡直就是傷不起啊。。。Fuck!抄的牛頭不對馬嘴。google一番,節約多少光陰。

 

Smokeping是一個非常有用的網絡工具,但安裝配置起來也秉承了linux中的一貫傳統:不復雜不成活。

 

一、以下是在CentOS 6 or CentOS 5上安裝Smokeping的步驟:
為了方便配置,我們用如下指令臨時將防火墻和SELinux關掉

setenforce 0

service iptables stop

 

1 – 安裝 rpmforge yum源

# yum install wget
 * 
For CentOS 6 please use this repository:
 # wget 
http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
 # rpm -Uvh rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm


 *
 For CentOS 5 please use this repository:
 # wget 
http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm

# rpm -Uvh rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm

 

2 – Install required packages 安裝所需的工具包

# yum install mod_fcgid httpd httpd-devel rrdtool fping wget curl bind-utils gcc make

 

3 – Install more packages 繼續安裝perl包

# yum 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-RRD-Simple perl-CGI-SpeedCGI perl-ExtUtils-MakeMaker

 

4 – Install smokeping安裝Smokeping

# wget http://oss.oetiker.ch/smokeping/pub/smokeping-2.6.8.tar.gz
 * You should check on 
smokeping website for the latest version.

# tar -zxvf smokeping-2.6.8.tar.gz -C /opt/
 # mkdir /opt/smokeping
 # cd /opt/smokeping-2.6.8/setup
 # ./build-perl-modules.sh
 # cp -r ../thirdparty /opt/smokeping/
 # cd ..
 # ./configure --prefix=/opt/smokeping
 * There are twice – before the prefix so it is –prefix.
 # make install

 

5 – Create missing folders新增缺失的目錄
 # cd /opt/smokeping
 # mkdir data var cache

 

6 – Add smokeping start/stop script 添加somkeping服務啟動/停止腳本
 # wget http://www.wedebugyou.com/static/smokeping_start_stop.txt
 # mv smokeping_start_stop.txt /etc/init.d/smokeping
 # chmod 755 /etc/init.d/smokeping

 

二、Here are the steps for configuring smokeping.安裝開始配置,主要是配置比較繁瑣

1 – Rename config files and change security重命名配置文件並更改權限
 # cd /opt/smokeping/etc/
 # for foo in *.dist; do cp $foo `basename $foo .dist`; done
 # chmod 600 /opt/smokeping/etc/smokeping_secrets.dist

 

2 – Change the default config files 自訂配置文件
 # vi config

 

根據各自實際情況修改下面黑體字部分:

owner    = Peter Random
 contact  = [email protected]
 mailhost = my.mail.host
 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 = /opt/smokeping/cache
 imgurl   = cache
 datadir  = /opt/smokeping/data
 piddir  = /opt/smokeping/var
 cgiurl   = http://some.url/smokeping.cgi
 smokemail = /opt/smokeping/etc/smokemail.dist
 tmail = /opt/smokeping/etc/tmail.dist

 

Here is an example:

owner    = Jean Debogue
 contact  = [email protected]
 mailhost = my.mail.host
 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 = /opt/smokeping/cache
 imgurl   = cache
 datadir  = /opt/smokeping/data
 piddir  = /opt/smokeping/var
 cgiurl   = http://graph.mydomain.com/smokeping/smokeping.cgi
 smokemail = /opt/smokeping/etc/smokemail.dist
 tmail = /opt/smokeping/etc/tmail.dist

 

3 – Configure smokeping into the webserver 配置web界面
 # cd /opt/smokeping
 # ln -s /opt/smokeping/cache /opt/smokeping/htdocs/cache
 # chown -R apache cache
 # chown -R apache data

將下面的行加入到文件:/etc/httpd/conf.d/smokeping.conf
 ScriptAlias /smokeping/smokeping.cgi /opt/smokeping/htdocs/smokeping.fcgi.dist
 Alias /smokeping /opt/smokeping/htdocs

<Directory “/opt/smokeping/htdocs”>
Options FollowSymLinks
 </Directory>

 

4 – Start smokeping 開啟
 # /etc/init.d/smokeping start
 # /etc/init.d/httpd start

 

5 – Expect the worst hope for the best 這句不知道怎麼翻了,菩薩保佑吧
若之前的安裝配置均未出現任何錯誤,那麼就可以訪問下面的地址來驗收我們的成果(該url是在上面的config文件中設置的,可各自自定)  cgiurl = http://graph.mydomain.com/smokeping/smokeping.cgi.

 

三、Here are the steps to add your own configuration驗證沒問題,那就開始讓它發揮作用吧,添加自己的配置。

It’s quite complicated to explain all the details of smokeping configuration file. The best is to read their documentation or check the many examples available online. You can also use our example config file. Just paste this file under the line *** Probes *** in your config file. Our example contains an icmp probe, a dns check, a check on port 80 and a full fetch of the default webpage of www.google.com

上面這段話比較有意義,建議讀明白了,我就不翻了,免得誤導觀眾。

 

2 – Restart smokeping 改完配置文件需重啟smokeping服務生效
 用下面的命令:
 # /etc/init.d/smokeping restart

3 – Clean installation files一切沒問題後,清除安裝文件
 # rm -rf /opt/smokeping-2.6.8

4 – Enable smokeping to start automatically on reboot

最後添加到開機自啟動,如下:
 # chkconfig –add smokeping
 * There are twice – before the add so it is –add.
 # chkconfig httpd on
 # chkconfig smokeping on

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章