一、准备工作:
1、以防止安装依赖出错,首先给系统安装第三方源:
rpm -Uvh http://apt.sw.be/redhat/el7/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm
2、安装lamp环境和rrdtool图形处理及其他所需依赖库:
yum -y install 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 perl-CGI-SpeedCGI perl-Time-HiRes perl-ExtUtils-MakeMaker perl-RRD-Simple rrdtool rrdtool-perl curl fping echoping httpd httpd-devel gcc make wget libxml2-devel libpng-devel glib pango pango-devel freetype freetype-devel fontconfig cairo cairo-devel libart_lgpl libart_lgpl-devel mod_fastcgi screen
二、开始安装
1、下载安装smokeping程序
mkdir -p /data/softcd /data/softwget http://oss.oetiker.ch/smokeping/pub/smokeping-2.6.9.tar.gz
tar -zxvf smokeping-2.6.9.tar.gzcd smokeping-2.6.9./configure -prefix=/usr/local/smokeping##如果是第一次安装smokeping程序,一般会出现报错,说没有perl模块支持,需要安装模块后在执行安装程序##
解决方法:
./setup/build-perl-modules.sh /usr/local/smokeping/thirdparty #执行smokeping自带脚本自动根据报错安装perl模块
##如执行后还继续出现刚刚的报错,检测下有没安装rrdtool,把rrdtool下的文件复制到系统目录下##
cp /usr/local/rrdtool/lib/perl/5.10.1/x86_64-linux-thread-multi/RRDs.pm /usr/lib64/perl5/
cp /usr/local/rrdtool/lib/perl/5.10.1/x86_64-linux-thread-multi/auto/RRDs/RRDs.so /usr/lib64/perl5/
./setup/build-perl-modules.sh /usr/local/smokeping/thirdparty ##继续执行脚本
./configure --prefix=/usr/local/smokeping ##继续安装gmake install
##############至此,程序已经初步安装完成###################三、配置smokeping1、创建cache var data 三个目录和smokeping.log日志文件cd /usr/local/smokepingmkdir cache data vartouch /var/log/smokeping.log2、给刚刚创建的文件和目录授予apache权限cd /usr/local/smokepingchown -R apache:apache cache data varchown -R apache:apache /var/log/smokeping.log3、修改配置文件和自动生成文件(目的就是文件位置和config配置中一致)cd /usr/local/smokeping/htdocs/mv smokeping.fcgi.dist smokeping.fcgi cd /usr/local/smokeping/etcmv config.dist configvim config##找到cgiurl = http://some.url/smokeping.cgi 把some.url 改成本地IP或者域名####找到 ***Database*** 栏 把step(监测时间)和pings(ping次数)的值改成自己设定的都改为30就是30秒ping30次##找到binary = /usr/sbin/fping修改为binary = /usr/local/sbin/fping4、完成之后修改验证密码文件权限chmod 600 /usr/local/smokeping/etc/smokeping_secrets.dist四、修改apache配置vim /etc/httpd/conf/httpd.conf####在DocumentRoot “/var/www/html” 这一行下添加如下代码:Alias /cache "/usr/local/smokeping/cache/" Alias /cropper "/usr/local/smokeping/htdocs/cropper/" Alias /smokeping "/usr/local/smokeping/htdocs/smokeping.fcgi"AllowOverride NoneOptions All AddHandler cgi-script .fcgi .cgiOrder allow,denyAllow from allAuthName "Smokeping"AuthType Basic AuthUserFile /usr/local/smokeping/htdocs/htpasswdRequire valid-user DirectoryIndex smokeping.fcgi五、设置开机启动apache和smokeping进程 ,并关闭防火墙echo "/usr/local/smokeping/bin/smokeping --logfile=/var/log/smokeping.log 2>&1 &" >>/etc/rc.localchkconfig httpd onchkconfig iptables off六、启动httpd和smokepingservice httpd restart/usr/local/smokeping/bin/smokeping --logfile=/var/log/smokeping.log七、打开web界面测试### 如果返回 “500”错误 说明selinux 选项没有关闭 ###vim /etc/sysconfig/selinux改成 Selinux=disable或者selinux=permissive##如界面出现Software error:错误,请使用cpan安装以下### cpan> install FCGI> install FCGI::ProcManager> install CGI::Fast> install Config::Grammar> install Digest::HMAC_MD5> install Net::Telnet> install Net::OpenSSH> install Net::SNMP> install Net::DNS> install Getopt::Long> install IO::All> install Socket> install LWP八、设置web用户名和密码cd /usr/local/smokeping/htdocshtpasswd -c /usr/local/smokeping/htdocs/htpasswd admin #设置账号为admin 密码在回车后提示输入###至此,smokeping安装已经全部完毕,剩下的是添加smokeping插件并设置其监控参数 ####九、设置监控参数(直接在+ Test下添加需要监控的ip)+ Test #一级标题menu= Targets#parents = owner:/Test/James location:/++ china #二级标题menu = chinatitle = china+++ shanghaiyidong #三级标题menu = shanghaiyidong_221.130.178.163title = shanghaiyidong_221.130.178.163alerts = somelosshost = 221.130.178.163添加完成后需要删除smokeping目录下data目录里的Test目录,然后重启smokeping