首页 > 代码库 > smokeping安装与插件使用
smokeping安装与插件使用
一、以防止安装依赖出错,首先给系统安装第三方源:rpm -Uvh http://apt.sw.be/redhat/e16/en/X86_64/rpmforge/RPMS/rpmforge-release-0.5.3-1.e16.rf.x86_64.rpm
二、安装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
三、安装好环境后开始下载安装smokeping程序
Wget http://oss.oetiker.ch/smokeping/pub/smokeping-2.6.9.tar.gz
tar -zxvf smokeping-2.6.9.tar.gz #解压.tar.gz压缩包
cd smokeping-2.6.9 #进入解压包后的程序目录
./configure -prefix=/usr/local/smokeping #将smokeping程序安装在/usr/local/smokeping/ 路径下
#################如果是第一次安装smokeping程序,一般会出现报错,说没有perl模块支持,需要安装模块后在执行安装程序###############################
./setup/build-perl-modules.sh /usr/local/smokeping/thirdparty #根据报错提示安装perl模块
###如果安装perl模块时出现
则需要下载安装perl-devel 和perl-ExtUtils-Embed Centos 系统可直接yum install perl-devel perl-ExtUtils-Embed -y (总之,提示少什么插件你就安装什么插件)安装后再执行./setup/build-perl-modules.sh /usr/local/smokeping/thirdparty
./configure –prefix=/usr/local/smokeping #perl 模块加载完成后再次执行安装程序
###############此时,安装成功后,会提示编译,按照要求编译###############
/usr/local/gmake install
##############至此,程序已经初步安装完成###################
四、配置smokeping
4.1、创建cache var data 三个目录和smokeping.log日志文件
cd /usr/local/smokeping
mkdir cache data var
touch /var/log/smokeping.log
4.2、给刚刚创建的文件和目录授予apache权限
cd /usr/local/smokeping
chown -R apache:apache cache data var
chown -R apache:apache /var/log/smokeping.log
执行完后ls 查看一下结果是否正确:
4.3、修改配置文件和自动生成文件(目的就是文件位置和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次数)的值改成自己设定的#####都改为60就是60秒ping60次##
4.4、完成之后修改验证密码文件权限
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"
<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>
六、设置开机启动apache和smokeping进程 ,并关闭防火墙
echo "/usr/local/smokeping/bin/smokeping -logfile=/var/log/smokeping.log 2>&1 &" >>/etc/rc.local
chkconfig httpd on
chkconfig iptables off
七、启动httpd和smokeping
service httpd restart
/usr/local/smokeping/bin/smokeping --logfile=/var/log/smokeping.log
八、打开web界面测试
#######如果返回 “500”错误 说明selinux 选项没有关闭######
vim /etc/sysconfig/selinux
改成 Selinux=disable或者selinux=permissive
九、设置web用户名和密码
cd /usr/local/smokeping/htdocs
htpasswd -c /usr/local/smokeping/htdocs/htpasswd admin #设置账号为admin 密码在回车后提示输入
十、同步主机时间和配置config 参数
ntpdate 210.72.145.44 #也可以同步本地时间,依据检测点而定
vim /usr/local/smokeping/etc/config
*** Presentation ***
charset = utf-8 //识别中文
&&&&&&&&&&&&&&&&&&& 至此,smokeping安装已经全部完毕,剩下的是添加smokeping插件并设置其监控参数 &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&