xuanxi 发表于 2019-1-17 10:40:24

CentOS 6.5搭建Smokeping平台(下)

  1、添加监控点
# 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、处理中文乱码
# yum -y install wqy-zenhei-fonts
# vi /usr/local/smokeping/lib/Smokeping/Graphs.pm
    if ($mode =~ //){
      my $val = 0;
      for my $host (@hosts){
            my ($graphret,$xs,$ys) = RRDs::graph
            ("dummy",
            '--start', $tasks,
            '--end', $tasks,
            '--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-> if $val < $graphret->;
      }
      $val = 1e-6 if $val =~ /nan/i;
      $max = { $tasks => $val * 1.5 };
    }  3、用户认证
# vi /etc/httpd/conf/httpd.conf

AllowOverride None
Options All
AddHandler cgi-script .fcgi .cgi
Order allow,deny
Allow from all
AllowOverride AuthConfig   ##添加用户认证
AuthName &quot;smokeping&quot;
AuthType Basic
AuthUserFile /usr/local/smokeping/htdocs/htpasswd
Require valid-user
DirectoryIndex smokeping.fcgi

# htpasswd -c /usr/local/smokeping/htdocs/htpasswd admin
New password:                                                      ##设置账号口令
Re-type new password:
Adding password for user admin  4、重启httpd和smokeping
# /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
# /usr/sbin/httpd -k graceful
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
# ps aux |grep smokeping
root      87850.00.0 103244   852 pts/0    S+   09:36   0:00 grep smokeping
root   157220.00.2 231860 10384 ?      Ss   Aug09   0:23 ./smokeping
# kill 15722
# /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、验证效果
https://s5.运维网.com/wyfs02/M00/9E/60/wKioL1mRP5WQIAEuAABDfUjPvIk400.png-wh_500x0-wm_3-wmp_4-s_1350607833.png
https://s3.运维网.com/wyfs02/M01/9E/71/wKiom1mRQZrwVYhmAADZ6xc6z3I460.png-wh_500x0-wm_3-wmp_4-s_2494315565.png



页: [1]
查看完整版本: CentOS 6.5搭建Smokeping平台(下)