CentOS   发布时间:2022-05-09  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了全网首发!! centos7.2 安装smokeping大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

1 基本概念

2安装

2.0 时间同步

yum-yinstallntPDAte
ntpdatetiR_922_11845@es.aliyun.com

2.1 安装依赖包

yumgroupinstall"Compatibilitylibraries""Base""Developmenttools"-y

yum-yinstallcpanperlperl-FCGIperl-CGIperl-Digest-HMACperl-Net-Telnetperl-Net-OpenSSHperl-Net-SNMPperl-LDAPperl-Net-DNSperl-IO-Pty-Easyperl-Test-Simpleperl-Sys-Syslogperl-libwww-perlperl-IO-Socket-SSLperl-Socket6perl-CGI-SpeedyCGIperl-FCGIperl-Time-HiResperl-ExtUtils-MakeMakerrrdtoolrrdtool-perlcurlfpinghttpdhttpd-develgccmakewgetlibxml2-devellibpng-develglibpangopango-develfreetypefreetype-develfontconfigcairocairo-devellibart_lgpllibart_lgpl-develmod_fcgidscreen

2.2 安装echoping

tarxvfechoping-6.0.2.tar.gz
cdechoping-6.0.2
./configure--prefix=/usr/local/echoping
make&&makeinstall

2.3 安装smokeping

cd/usr/local/src
xfsmokeping-2.6.11.tar.gz
cdsmokeping-2.6.11

#exportPERL5LIB=/usr/local/smokeping/thirdparty/lib/perl5/
./setup/build-perl-modules.sh/usr/local/smokeping/thirdparty
./configure--prefix=/usr/local/smokeping
gmakeinstall


如果./configure过程中提示找不到某些perl扩展,如下所示

checkingcheckingforperlmodule'Config::GrAMMar'...Can'tlocateConfig/GrAMMar.pmin@INC(@INCcontains:/usr/local/smokeping/thirdparty/lib/perl5/usr/local/lib64/perl5/usr/local/share/perl5/usr/lib64/perl5/vendor_perl/usr/share/perl5/vendor_perl/usr/lib64/perl5/usr/share/perl5.)at-eline1.
BEGINFailed--compilationabortedat-eline1.

请使用以下命令安装对应模块

perl-MCPAN-e'installConfig::GrAMMar'

注意:有时候需要重复安装几次才能装上模块。

注意要选择国内的的模块源,不然速度很慢

2.4 创建相关目录和日志文件

cd/usr/local/smokeping
mkdircachedatavar
touch/var/log/smokeping.log
chownapache.apachecache/data/var//var/log

因为这里的web服务使用的是httpd,所以相关文件的属主属组均为apache

2.5 创建相关配置文件

#fcgi文件
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

2.6 修改配置文件

#指定cgi的URL地址为本机
sed-i‘s#cgiurl=http://some.url/smokeping.cgi#cgiurl=http://10.0.56.12/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次。


2.7 修改字符集和字体支持中文

vim/usr/local/smokeping/etc/config
***Presentation***
charset=utf-8

yum -y install wqy-zenhei-fonts

vim/usr/local/smokeping/lib/Smokeping/Graphs.pm

my$val = 0;

formy $host (@hosts){

my ($graphret,$xs,$ys) = rrds::graph

("dummy",

'--start',$tasks[0][1],

'--end',$tasks[0][2],

'--font titlE:20"WenQuanYiZen Hei Mono"',

"DEF:maxping=$cfg->{General}{datadir}${host}.rrd:median:AVERAGE",

'PRINT:maxping:MAX:%le' );

@H_501_44@my $ERROR = rrds::error();

2.8 修改apache配置文件增加登录验证

htpasswd-c/usr/local/smokeping/htdocs/htpasswdsmokeping
chmod600/usr/local/smokeping/etc/smokeping_secrets.dist

2.9 修改httpd.conf增加smokepingweb界面

httpd.conf末尾添加如下内容

vim/etc/httpd/conf/httpd.conf

#########changedbyggvylf2016/06/13##############
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">
AllowOverrideNone
OptionsAll
AddHandlercgi-script.fcgi.cgi
AllowOverrideAuthConfig
Orderallow,deny
Allowfromall
AuthName"Smokeping"
AuthTypeBasic
AuthUserFile/usr/local/smokeping/htdocs/htpasswd
requirevalid-user
DirectoryIndexsmokeping.fcgi
</Directory>

2.10 添加监控对象

vim/usr/local/smokeping/etc/config
***Targets***
++Localhost
menu=Localhost
title=Localhost
alerts=someloss
#slaves=boomerslave2
host=10.0.56.12

2.11 添加监控节点

注意:每次修改配置文件后需要重启smokeping进程

/usr/local/smokeping/bin/smokeping--restart
或
/usr/local/smokeping/bin/smokeping--reload
或
pkillsmokeping
/usr/local/smokeping/bin/smokeping

监控节点样例如下,注意+是第一层,++是第二层,+++ 是第三层:

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

smokeping会根据配置文件中配置监控节点的内容,在/usr/local/smokeping/data目录下生成对应的@H_261_2@moniter文件夹,其下包含website子文件夹。

[root@linux-node2smokeping]#tree/usr/local/smokeping/data/
/usr/local/smokeping/data/
├──Other
│├──dianxin
││├──dianxin-bj.rrd
││├──dianxin-gd.rrd
││├──dianxin-gs.rrd
││├──dianxin-gz.rrd
││├──dianxin-hlj.rrd
││├──dianxin-sc.rrd
││├──dianxin-sh.rrd
││└──dianxin-tj.rrd
│├──liantong
││├──liantong-bj.rrd
││├──liantong-gz.rrd
││├──liantong-hlj.rrd
││├──liantong-sc.rrd
││├──liantong-sh.rrd
││└──liantong-tj.rrd
│└──yidong
│├──yidong-bj.rrd
│├──yidong-gz.rrd
│├──yidong-hlj.rrd
│├──yidong-sc.rrd
│├──yidong-sh.rrd
│└──yidong-tj.rrd
├──__sortercache
│└──data.FPing.storable
└──Test
├──James~boomer.rrd
├──James.rrd
├──James~slave2.rrd
└──Localhost.rrd

2.12 启动服务并测试

systemctlstarthttpd
/usr/local/smokeping/bin/smokeping

在浏览器中访问

http://10.0.56.12/smokeping

全网首发!! centos7.2 安装smokepings.width=650;" src="http://img.code.cc/vcimg/static/loading.png" style="float:none;" src="http://s3.51cto.com/wyfs02/M01/82/DF/wKiom1djYzPgERDPAABu8iZtrd8499.jpg">


用户名和密码htpasswd命令中设定用户名和密码

出现以下界面表示成功。

全网首发!! centos7.2 安装smokepings.width=650;" src="http://img.code.cc/vcimg/static/loading.png" src="http://s3.51cto.com/wyfs02/M02/82/DF/wKiom1djY2ODpjFrAABXTZ9sbD4433.jpg">


可以看到添加的节点的相关信息。

全网首发!! centos7.2 安装smokepings.width=650;" src="http://img.code.cc/vcimg/static/loading.png" src="http://s2.51cto.com/wyfs02/M00/82/DE/wKioL1djZIeBSrEhAACjsncEZGs082.jpg">


可以看到添加的监控点的ping状态

全网首发!! centos7.2 安装smokepings.width=650;" src="http://img.code.cc/vcimg/static/loading.png" src="http://s2.51cto.com/wyfs02/M01/82/DF/wKiom1djY4GCRcemAAFa5EvMLnA973.jpg">


附录:

更改CPAN源的方法

[root@linux-node2smokeping-2.6.11]#cpan
Sorry,wehavetoreruntheconfigurationdialogforCPAN.pmdueto
somemissingparameters.Configurationwillbewrittento
<</root/.cpan/CPAN/MyConfig.pm>>


CPAN.pmrequiresconfiguration,butmostofitcanbedoneautomatically.
Ifyouanswer'no'below,youwillenteraninteractivedialogforeach
configurationoptioninstead.

Wouldyouliketoconfigureasmuchaspossibleautomatically?[yes]yes

<install_Help>

Warning:YoudonothavewritepermissionforPerllibrarydirectories.

Toinstallmodules,youneedtoconfigurealocalPerllibrarydirectoryor
escalateyourprivileges.CPANcanHelpyoubybootstrappingtHelocal::lib
moduLeorbyconfiguringitselftouse'sudo'(ifavailablE).Youmayalso
resolvethisproblemmanuallyifyouneedtocustomizeyoursetup.

whatapproachdoyouwant?(Choose'local::lib','sudo'or'manual')
[local::lib]

Autoconfiguredeverythingbut'urllist'.

NowyouneedtochooseyourCPANmirrorsites.Youcanletme
pickmirrorsforyou,youcan@R_674_10288@ctthemfromalistoryou
canenterthembyhand.

WouldyoulikemetoautomaticallychoosesomeCPANmirror
sitesforyou?(ThismeansconnecTingtotheInternet)[yes]no

WouldyouliketopickfromtheCPANmirrorlist?[yes]yes
FoundacachedmirrorlistasofMonJun1307:01:482016

Ifyou'dliketojustusethecachedcopy,answer'yes',below.
Ifyou'dlikeanupdatedcopyofthemirrorlist,answer'no'and
I'llgetafreshonefromtheInternet.

ShallIusethecachedmirrorlist?[yes]yes
First,pickanearbyconTinentandcountrybytypinginthenumber(s)
infrontoftheitem(s)youwantto@R_674_10288@ct.Youcanpickseveralof
each,separatedbyspaces.Then,youwillbepresentedwithalistof
URLsofCPANmirrorsinthecountriesyou@R_674_10288@cted,alongwith
prevIoUsly@R_674_10288@ctedURLs.@R_674_10288@ctsomeofthoseURLs,orjustkeepthe
oldlist.Finally,youwillbepromptedforanyextraURLs--file:,ftp:,orhttp:--thathostaCPANmirror.

Youshould@R_674_10288@ctmorethanone(jusTincasethefirstisn'tavailablE).

(1)Africa
(2)Asia
(3)Europe
(4)NorthAmerica
(5)Oceania
(6)SouthAmerica
@R_674_10288@ctyourconTinent(orseveralnearbyconTinents)[]2
(1)Bangladesh
(2)China
(3)India
(4)Indonesia
(5)Iran
(6)Israel
(7)Japan
(8)Kazakhstan
(9)Philippines
(10)Qatar
(11)RepublicofKorea
(12)Singapore
(13)Taiwan
(14)Turkey
(15)VietNam
@R_674_10288@ctyourcountry(orseveralnearbycountries)[]2
(1)ftp://ftp.cuhk.edu.hk/pub/packages/perl/CPAN/
(2)ftp://mirrorS.Ustc.edu.cn/CPAN/
(3)ftp://mirrors.xmu.edu.cn/CPAN/
(4)http://cpan.communilink.net/
(5)http://ftp.cuhk.edu.hk/pub/packages/perl/CPAN/
(6)http://mirror.lzu.edu.cn/CPAN/
(7)http://mirrors.163.com/cpan/
(8)http://mirrors.hust.edu.cn/CPAN/
(9)http://mirrors.neusoft.edu.cn/cpan/
(10)http://mirrors.sohu.com/CPAN/
(11)http://mirrorS.Ustc.edu.cn/CPAN/
(12)http://mirrors.xmu.edu.cn/CPAN/
(13)http://mirrors.zju.edu.cn/CPAN/
@R_674_10288@ctasmanyURLsasyoulike(bynumber),putthemononeline,separatedbyblanks,hyphenatedrangesallowed
e.g.'145'or'71-48'[]7
NowyoucanenteryourownCPANURLsbyhand.AlocalCPANmirrorcanbe
listedusinga'file:'URLlike'file:///path/to/cpan/'

EnteranotherURLorENTERtoquit:[]
Newurllist
http://mirrors.163.com/cpan/

Autoconfigurationcomplete.

AttempTingtobootstraplocal::lib...

WriTing/root/.cpan/CPAN/MyConfig.pmforbootstrap...
commit:wrote'/root/.cpan/CPAN/MyConfig.pm'
FetchingwithLWP:
http://mirrors.163.com/cpan/authors/01mailrc.txt.gz
Reading'/root/.cpan/sources/authors/01mailrc.txt.gz'
............................................................................DONE
FetchingwithLWP:
http://mirrors.163.com/cpan/modules/02packages.details.txt.gz
Reading'/root/.cpan/sources/modules/02packages.details.txt.gz'
DatabasewasgeneratedonThu,09Jun201622:53:42GMT
.............
NewCPAN.pmversion(v2.10)available.
[Currentlyrunningversionisv1.9800]
Youmightwanttotry
installCPAN
reloadcpan
tobothupgradeCPAN.pmandrunthenewversionwithoutleaving
thecurrentsession.


...............................................................DONE
FetchingwithLWP:
http://mirrors.163.com/cpan/modules/03modlist.data.gz
Reading'/root/.cpan/sources/modules/03modlist.data.gz'
DONE
WriTing/root/.cpan/Metadata
RunningmakeforH/HA/HAARG/local-lib-2.000019.tar.gz
FetchingwithLWP:
http://mirrors.163.com/cpan/authors/id/H/HA/HAARG/local-lib-2.000019.tar.gz
FetchingwithLWP:
http://mirrors.163.com/cpan/authors/id/H/HA/HAARG/checKSUMS
checksumfor/root/.cpan/sources/authors/id/H/HA/HAARG/local-lib-2.000019.tar.gzok

CPAN.pm:BuildingH/HA/HAARG/local-lib-2.000019.tar.gz


checkingifyourkitiscomplete...
Looksgood
Warning:prerequisiteTest::More0notfound.
GeneraTingaUnix-styleMakefile
WriTingMakefileforlocal::lib
WriTingMymeta.ymlandMymeta.json
----Unsatisfieddependenciesdetectedduring----
----HAARG/local-lib-2.000019.tar.gz----
Test::More[build_requires]
Runningmaketest
Delayeduntilafterprerequisites
Runningmakeinstall
Delayeduntilafterprerequisites
Triedtodeactivateinactivelocal::lib'/root/perl5'

local::libisinstalled.YoumustNowaddthefollowingenvironmentvariables
toyoursHellconfigurationfiles(orregistry,ifyouareonWindows)and
thenrestartyourcommandlinesHellandCPANbeforeinstallingmodules:

USEOfuninitializedvalue$deactivaTinginnumericeq(==)at/usr/share/perl5/vendor_perl/local/lib.pmline381.
USEOfuninitializedvalue$deactivaTinginnumericeq(==)at/usr/share/perl5/vendor_perl/local/lib.pmline383.
USEOfuninitializedvalue$options{"interpolate"}innumericeq(==)at/usr/share/perl5/vendor_perl/local/lib.pmline424.
USEOfuninitializedvalue$options{"interpolate"}innumericeq(==)at/usr/share/perl5/vendor_perl/local/lib.pmline424.
USEOfuninitializedvalue$options{"interpolate"}innumericeq(==)at/usr/share/perl5/vendor_perl/local/lib.pmline424.
exportPERL_LOCAL_LIB_ROOT="$PERL_LOCAL_LIB_ROOT:/root/perl5";
exportPERL_MB_OPT="--install_base/root/perl5";
exportPERL_MM_OPT="INSTall_BASE=/root/perl5";
exportPERL5LIB="/root/perl5/lib/perl5:$PERL5LIB";
exportPATH="/root/perl5/bin:$PATH";

Wouldyoulikemetoappendthatto/root/.bashrcNow?[yes]


commit:wrote'/root/.cpan/CPAN/MyConfig.pm'

Youcanre-runconfigurationanytimewith'oconfinit'intheCPANsHell
TerminaldoesnotsupportAddHistory.

cpansHell--CPANexplorationandmodulesinstallation(v1.9800)
Enter'h'forHelp.

cpan[1]>exit
TerminaldoesnotsupportGetHistory.
Lockfileremoved.

***RemembertorestartyoursHellbeforerunningcpanagain***

#perl-MCPAN-esHell
cpan>oconfurllistunshifthttp://mirrors.aliyun.com/CPAN/
cpan>oconfcommit

大佬总结

以上是大佬教程为你收集整理的全网首发!! centos7.2 安装smokeping全部内容,希望文章能够帮你解决全网首发!! centos7.2 安装smokeping所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: