例如在shell中执行
export PERLLIB=/usr/local/smokeping/lib (只是举个例子,具体Smokeping.pm在哪里需要find一下)
export PERL5LIB=$PERLLIB
1 smokeping监控安装yum install -y httpd
yum install -y rrdtool
yum install -y fping
yum install -y echoping
yum install -y curl
yum install -y perl perl-Net-Telnet perl-Net-DNS perl-LDAP perl-libwww-perl perl-RadiusPerl perl-IO-Socket-SSL perl-Socket6 perl-CGI-SpeedyCGI perl-FCGI
解压smokeping源码包
tar xvf smokeping-2.6.9.tar.gz
编译安装
cd smokeping-2.6.9
./configure --prefix=/usr/local/smokeping
编译过程提示缺少东西,运行一个脚本
./setup/build-perl-modules.sh /usr/local/smokeping/thirdparty
完成后再次configure
./configure --prefix=/usr/local/smokeping
之后提示使用gmake安装
/usr/bin/gmake install
安装完成后进入smokeping目录
cd /usr/local/smokeping
创建需要用到的目录
mkdir var
mkdir cache
mkdir data
修改权限
chmod 777 -R var
chmod 777 -R cache
chmod 777 -R data
chmod 600 etc/smokeping_secrets.dist
属主改为httpd的用户
chown -R apache.apache /usr/local/smokeping
创建日志文件并修改属主
touch /var/log/smokeping.log
chown apache.apache /var/log/smokeping.log
进入htdocs目录重命名smokeping.fcgi.dist
mv smokeping.fcgi.dist smokeping.fcgi
进入bin目录下修改smokeping文件
use lib qw()# PERL5LIB
修改为(根据实际路径来,yum安装perl的为这个目录)
use lib qw(/usr/lib/perl5/5.8.8)# PERL5LIB
进入etc目录修改config文件
mv config.dist config
修改config
---------------------------------------------------------------------------------------------------------------------------
*** General ***
owner= Peter Random 《--------------------所有人
contact = some@address.nowhere 《--------------------管理员地址
mailhost = my.mail.host
sendmail = /usr/sbin/sendmail
# NOTE: do not put the Image Cache below cgi-bin
# since all files under cgi-bin will be executed ... this is not
# good for images.
imgcache = /usr/local/smokeping/cache
imgurl = cache
datadir = /usr/local/smokeping/data
piddir = /usr/local/smokeping/var
cgiurl = http://192.168.1.158/smokeping.cgi 《-------本机的iP或者域名
smokemail = /usr/local/smokeping/etc/smokemail.dist
tmail = /usr/local/smokeping/etc/tmail.dist
# specify this to get syslog logging
syslogfacility = local0
# each probe is now run in its own process
# disable this to revert to the old behaviour
# concurrentprobes = no
*** Alerts ***
to = alertee@address.somewhere 《-------------警报邮件地址(可以无视)
from = smokealert@company.xy
+someloss
type = loss
# in percent
pattern = >0%,*12*,>0%,*12*,>0%
comment = loss 3 times in a row
*** Database ***
step = 30《----------------------数据刷新时间默认300
pings= 20
# consfn mrhb steps total
AVERAGE 0.5 1 1008
AVERAGE 0.5 12 4320
MIN 0.5 12 4320
MAX 0.5 12 4320
AVERAGE 0.5 144 720
MAX 0.5 144 720
MIN 0.5 144 720
*** Presentation ***
charset = utf-8 《-----------------------添加语言支持,不然乱码
template = /usr/local/smokeping/etc/basepage.html.dist
+ charts
menu = Charts
title = The most interesting destinations
++ stddev
sorter = StdDev(entries=>4)
title = Top Standard Deviation
menu = Std Deviation
format = Standard Deviation %f
++ max
sorter = Max(entries=>5)
title = Top Max Roundtrip Time
menu = by Max
format = Max Roundtrip Time %f seconds
++ loss
sorter = Loss(entries=>5)
title = Top Packet Loss
menu = Loss
format = Packets Lost %f
++ median
sorter = Median(entries=>5)
title = Top Median Roundtrip Time
menu = by Median
format = Median RTT %f seconds
+ overview
width = 600
height = 50
range = 10h
+ detail
width = 600
height = 200
unison_tolerance = 2
"Last 3 Hours"3h
"Last 30 Hours" 30h
"Last 10 Days"10d
"Last 400 Days" 400d
#+ hierarchies
#++ owner
#title = Host Owner
#++ location
#title = Location
*** Probes ***
+ FPing
binary = /usr/sbin/fping
*** Slaves ***
secrets=/usr/local/smokeping/etc/smokeping_secrets.dist
+boomer
display_name=boomer
color=0000ff
+slave2
display_name=another
color=00ff00
*** Targets ***
probe = FPing
menu = Top
title = Network Latency Grapher
remark = Welcome to the SmokePing website of xxx Company. \
Here you will learn all about the latency of our network.
+ Test 《--------------一个样本的开始
menu= Targets 《--------菜单名字
#parents = owner:/Test/James location:/
++ James 《----------2级目录
menu = James 《------------2级目录名字
title = 见鬼 《------------标题
host = 192.168.1.158 《-------哪台主机
-------------------------------------------------------------------------------------
修改httpd配置文件
vi /etc/httpd/conf/httpd.conf
添加
Alias /smokeping "/usr/local/smokeping/htdocs/smokeping.fcgi"
Alias /cache "/usr/local/smokeping/cache"
Alias /cropper "/usr/local/smokeping/htdocs/cropper"
<Directory /usr/local/smokeping>
AllowOverride None
AddHandler cgi-script cgi fcgi
Options ExecCGI
Order allow,deny
Allow from all
DirectoryIndex smokeping.cgi
</Directory>
重启httpd
service httpd restart
启动smokeping
perl /usr/local/smokeping/bin/smokeping --logfile=/var/log/smokeping.log
访问smokeping (本次样本为192.168.1.158地址)
http://192.168.1.158/smokeping
关闭smokeping
ps -ef | grep smokeping
找到进程号
kill -9 进程号
我自己写的 你看下吧 哪里出现问题
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)