CentOS 6.5搭建Smokeping平臺(下)
1、添加監控點
[[email protected] ~]# 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、處理中文亂碼
[[email protected] ~]# yum -y install wqy-zenhei-fonts [[email protected] ~]# 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 "<div>RRDtool did not understand your input: $ERROR.</div>" if $ERROR; $val = $graphret->[0] if $val < $graphret->[0]; } $val = 1e-6 if $val =~ /nan/i; $max = { $tasks[0][1] => $val * 1.5 }; }
3、用戶認證
[[email protected] ~]# vi /etc/httpd/conf/httpd.conf <Directory "/usr/local/smokeping"> 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 vaild-user DirectoryIndex smokeping.fcgi </Directory> [[email protected]
4、重啟httpd和smokeping
[[email protected] ~]# /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 [[email protected] ~]# /usr/sbin/httpd -k graceful httpd: Could not reliably determine the server‘s fully qualified domain name, using 127.0.1.1 for ServerName [[email protected] ~]# 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] [[email protected] ~]# kill 15722 [[email protected] ~]# /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、驗證效果
本文出自 “Gorilla City” 博客,請務必保留此出處http://juispan.blog.51cto.com/943137/1956095
CentOS 6.5搭建Smokeping平臺(下)