1、添加监控点
[root@i-uiiyw0xz~]#vi/usr/local/smokeping/etc/config ##添加以下内容## +Other menu=三大网络监控 title=监控统计 ++dianxin menu=电信网络监控 title=电信网络监控列表 host=/Other/dianxin/dianxin-bj +++dianxin-bj menu=北京电信 title=北京电信 alerts=someloss host=202.96.199.133 ++liantong menu=联通网络监控 title=联通网络监控列表 host=/Other/liantong/liantong-bj +++liantong-bj menu=北京联通 title=北京联通 alerts=someloss host=61.135.169.121 ++yidong menu=移动网络监控 title=移动网络监控列表 #host=/Other/yidong/yidong-bj +++yidong-bj menu=北京移动 title=北京移动 alerts=someloss host=221.130.33.52
2、处理中文乱码
[root@i-uiiyw0xz~]#yum-yinstallwqy-zenhei-fonts [root@i-uiiyw0xz~]#vi/usr/local/smokeping/lib/Smokeping/Graphs.pm if($mode=~/[anc]/){ my$val=0; formy$host(@hosts){ my($graphret,$xs,$ys)=RRDs::graph ("dummy",'--start',$tasks[0][1],'--end',$tasks[0][2],'--fontTITLE:20:"WenQuanYiZenHeiMono"',##增加该行 "DEF:maxping=$cfg->{General}{datadir}${host}.rrd:median:AVERAGE",'PRINT:maxping:MAX:%le'); my$ERROR=RRDs::error(); return"<div>RRDtooldidnotunderstandyourinput:$ERROR.</div>"if$ERROR; $val=$graphret->[0]if$val<$graphret->[0]; } $val=1e-6if$val=~/nan/i; $max={$tasks[0][1]=>$val*1.5}; }
3、用户认证
[root@i-uiiyw0xz~]#vi/etc/httpd/conf/httpd.conf <Directory"/usr/local/smokeping"> AllowOverrideNone OptionsAll AddHandlercgi-script.fcgi.cgi Orderallow,deny Allowfromall AllowOverrideAuthConfig##添加用户认证 AuthName"smokeping" AuthTypeBasic AuthUserFile/usr/local/smokeping/htdocs/htpasswd Requirevaild-user DirectoryIndexsmokeping.fcgi </Directory> [root@i-uiiyw0xz~]#htpasswd-c/usr/local/smokeping/htdocs/htpasswdadmin Newpassword:##设置账号口令 Re-typenewpassword: Addingpasswordforuseradmin
4、重启httpd和smokeping
[root@i-uiiyw0xz~]#/usr/sbin/httpd-t httpd:Couldnotreliablydeterminetheserver'sfullyqualifieddomainname,using127.0.1.1forServerName SyntaxOK [root@i-uiiyw0xz~]#/usr/sbin/httpd-kgraceful httpd:Couldnotreliablydeterminetheserver'sfullyqualifieddomainname,using127.0.1.1forServerName [root@i-uiiyw0xz~]#psaux|grepsmokeping root87850.00.0103244852pts/0S+09:360:00grepsmokeping root157220.00.223186010384?SsAug090:23./smokeping[FPing] [root@i-uiiyw0xz~]#kill15722 [root@i-uiiyw0xz~]#/usr/local/smokeping/bin/smokeping WARNING:Hostname'james.address'doescurrentlynotresolvetoanIPv6orIPv4address Note:loggingtosyslogaslocal0/info. Daemonizing/usr/local/smokeping/bin/smokeping...
5、验证效果
原文链接:https://www.f2er.com/centos/376353.html