centos7安裝smokeping並排錯

安裝基礎軟件包

yum groupinstall "Compatibility libraries" "Base" "Development tools" –y

這一步有Cleanup操作,如果是線上已存在生產環境慎重操作

image

安裝yum install epel-release -y

image

yum -y install cpan perl perl-FCGI perl-CGI perl-Digest-HMAC perl-Net-Telnet perl-Net-OpenSSH perl-Net-SNMP perl-LDAP perl-Net-DNS perl-IO-Pty-Easy perl-Test-Simple perl-Sys-Syslog perl-libwww-perl perl-IO-Socket-SSL perl-Socket6 perl-CGI-SpeedyCGI perl-FCGI perl-Time-HiRes perl-ExtUtils-MakeMaker rrdtool rrdtool-perl curl fping 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_fcgid screen

安裝echoping
tar xvf echoping-6.0.2.tar.gz
cd echoping-6.0.2
./configure --prefix=/usr/local/echoping

configure: error: Missing popt library, get it from ftp://ftp.rpm.org/pub/rpm/dist/rpm-x.y.z
[root@localhost echoping-6.0.2]#

yum install -y popt-devel

checking for dlopen in -ldl... (cached) yes
checking for idna_to_ascii_8z in -lidn... no
configure: error: Get the GNU libidn library (
http://www.josefsson.org/libidn/) in order to use Unicode - multi-script - domain names or use --without-libidn to disable it
[root@localhost echoping-6.0.2]#

./configure --prefix=/usr/local/echoping --with-ssl --without-libidn

configure: error: Get the OpenSSL library (http://www.openssl.org/)
[root@localhost echoping-6.0.2]#

yum install -y openssl openssl-devel

make && make install

下載smokeping

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


[root@localhost ~]# tar zxf smokeping-2.6.11.tar.gz
[root@localhost ~]# cd smokeping-2.6.11
[root@localhost smokeping-2.6.11]# export PERL5LIB=/usr/local/smokeping/thirdparty/lib/perl5/
[root@localhost smokeping-2.6.11]# ./setup/build-perl-modules.sh /usr/local/smokeping/thirdparty

./configure --prefix=/usr/local/smokeping
gmake install


cd /usr/local/smokeping
mkdir cache data var
touch /var/log/smokeping.log
chown apache.apache cache/ data/ var/ /var/log


cp /usr/local/smokeping/htdocs/smokeping.fcgi.dist /usr/local/smokeping/htdocs/smokeping.fcgi
cp /usr/local/smokeping/etc/config.dist /usr/local/smokeping/etc/config


vim /usr/local/smokeping/etc/config
在 ***Presentation *** 下面增加
charset = utf-8

#指定cgi的url地址爲本機
sed -i 's#cgiurl   = http://some.url/smokeping.cgi#cgiurl   = http://192.168.42.142/smokeping.cgi#g' /usr/local/smokeping/etc/config
#指定檢測的時間爲60秒
sed -i 's#step     = 300#step     = 60#g' /usr/local/smokeping/etc/config
#指定ping的次數爲60
sed -i 's#pings    = 20#pings    = 60#g' /usr/local/smokeping/etc/config
將step和pings都設置爲60表示每60秒ping60次。


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 smokeping
chmod 400 /usr/local/smokeping/etc/smokeping_secrets.dist

添加監控對象

vim /usr/local/smokeping/etc/config
*** Targets ***
++ Localhost
menu = Localhost
title = Localhost
alerts = someloss
#slaves = boomer slave2
host = 192.168.42.142

/usr/local/smokeping/bin/smokeping

image

vim /usr/local/smokeping/etc/config
加在最後
+ 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



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