1、准备工做:html
一、以防止安装依赖出错,首先给系统安装第三方源:linux
rpm -Uvh http://apt.sw.be/redhat/el7/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.3-1.el7.rf.x86_64.rpmweb
二、安装lamp环境和rrdtool图形处理及其余所需依赖库:apache
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 screenvim
2、开始安装curl
一、下载安装smokeping程序ide
mkdir -p /data/soft cd /data/soft wget http://oss.oetiker.ch/smokeping/pub/smokeping-2.6.9.tar.gz
tar -zxvf smokeping-2.6.9.tar.gz cd smokeping-2.6.9 ./configure -prefix=/usr/local/smokeping ##若是是第一次安装smokeping程序,通常会出现报错,说没有perl模块支持,须要安装模块后在执行安装程序##
解决方法:测试
./setup/build-perl-modules.sh /usr/local/smokeping/thirdparty #执行smokeping自带脚本自动根据报错安装perl模块ui
##如执行后还继续出现刚刚的报错,检测下有没安装rrdtool,把rrdtool下的文件复制到系统目录下##url
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
##############至此,程序已经初步安装完成################### 3、配置smokeping 一、建立cache var data 三个目录和smokeping.log日志文件 cd /usr/local/smokeping mkdir cache data var touch /var/log/smokeping.log 二、给刚刚建立的文件和目录授予apache权限 cd /usr/local/smokeping chown -R apache:apache cache data var chown -R apache:apache /var/log/smokeping.log 三、修改配置文件和自动生成文件(目的就是文件位置和config配置中一致) cd /usr/local/smokeping/htdocs/ mv smokeping.fcgi.dist smokeping.fcgi cd /usr/local/smokeping/etc mv config.dist config vim 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/fping 四、完成以后修改验证密码文件权限 chmod 600 /usr/local/smokeping/etc/smokeping_secrets.dist 4、修改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" <Directory "/usr/local/smokeping"> AllowOverride None Options All AddHandler cgi-script .fcgi .cgi Order allow,deny Allow from all AuthName "Smokeping" AuthType Basic AuthUserFile /usr/local/smokeping/htdocs/htpasswd Require valid-user DirectoryIndex smokeping.fcgi </Directory> 5、设置开机启动apache和smokeping进程 ,并关闭防火墙 echo "/usr/local/smokeping/bin/smokeping --logfile=/var/log/smokeping.log 2>&1 &" >>/etc/rc.local chkconfig httpd on chkconfig iptables off 6、启动httpd和smokeping service httpd restart /usr/local/smokeping/bin/smokeping --logfile=/var/log/smokeping.log 7、打开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 8、设置web用户名和密码 cd /usr/local/smokeping/htdocs htpasswd -c /usr/local/smokeping/htdocs/htpasswd admin #设置帐号为admin 密码在回车后提示输入 ###至此,smokeping安装已经所有完毕,剩下的是添加smokeping插件并设置其监控参数 #### 9、设置监控参数(直接在+ Test下添加须要监控的ip) + Test #一级标题 menu= Targets #parents = owner:/Test/James location:/ ++ china #二级标题 menu = china title = china +++ shanghaiyidong #三级标题 menu = shanghaiyidong_221.130.178.163 title = shanghaiyidong_221.130.178.163 alerts = someloss host = 221.130.178.163 添加完成后须要删除smokeping目录下data目录里的Test目录,而后重启smokeping