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 -y install wqy-zenhei-fonts
[root@i-uiiyw0xz ~]# vi /usr/local/smokeping/lib/Smokeping/Graphs.pm
if ($mode =~ /[anc]/){
my $val = 0;
for my $host (@hosts){
my ($graphret,$xs,$ys) = RRDs::graph
("dummy",
'--start', $tasks[0][1],
'--end', $tasks[0][2],
'--font TITLE:20:"WenQuanYi Zen Hei Mono"', ##增加该行
"DEF:maxping=$cfg->{General}{datadir}${host}.rrd:median:AVERAGE",
'PRINT:maxping:MAX:%le' );
my $ERROR = RRDs::error();
return "RRDtool did not understand your input: $ERROR." if $ERROR;
$val = $graphret->[0] if $val < $graphret->[0];
}
$val = 1e-6 if $val =~ /nan/i;
$max = { $tasks[0][1] => $val * 1.5 };
} 3、用户认证
[root@i-uiiyw0xz ~]# vi /etc/httpd/conf/httpd.conf
AllowOverride None
Options All
AddHandler cgi-script .fcgi .cgi
Order allow,deny
Allow from all
AllowOverride AuthConfig ##添加用户认证
AuthName "smokeping"
AuthType Basic
AuthUserFile /usr/local/smokeping/htdocs/htpasswd
Require valid-user
DirectoryIndex smokeping.fcgi
[root@i-uiiyw0xz ~]# htpasswd -c /usr/local/smokeping/htdocs/htpasswd admin
New password: ##设置账号口令
Re-type new password:
Adding password for user admin 4、重启httpd和smokeping
[root@i-uiiyw0xz ~]# /usr/sbin/httpd -t
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
Syntax OK
[root@i-uiiyw0xz ~]# /usr/sbin/httpd -k graceful
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
[root@i-uiiyw0xz ~]# ps aux |grep smokeping
root 8785 0.0 0.0 103244 852 pts/0 S+ 09:36 0:00 grep smokeping
root 15722 0.0 0.2 231860 10384 ? Ss Aug09 0:23 ./smokeping [FPing]
[root@i-uiiyw0xz ~]# kill 15722
[root@i-uiiyw0xz ~]# /usr/local/smokeping/bin/smokeping
WARNING: Hostname 'james.address' does currently not resolve to an IPv6 or IPv4 address
Note: logging to syslog as local0/info.
Daemonizing /usr/local/smokeping/bin/smokeping ... 5、验证效果