码迷,mamicode.com
首页 > 其他好文 > 详细

一键安装smokeping脚本

时间:2015-03-20 22:17:16      阅读:213      评论:0      收藏:0      [点我收藏+]

标签:smokeping

#!/bin/bash
local_ip=`/sbin/ifconfig |grep ‘inet addr:‘|grep -Ev ‘127.0.0.1‘ | cut -d: -f2|awk ‘{print $1}‘|head -n 1`
#install epel repo
rpm -Uvh http://apt.sw.be/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
#install require software
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 wqy-zenhei-fonts
#install smokeping
wget http://oss.oetiker.ch/smokeping/pub/smokeping-2.6.8.tar.gz
tar zxvf smokeping-2.6.8.tar.gz
cd smokeping-2.6.8
./configure --prefix=/usr/local/smokeping
./setup/build-perl-modules.sh /usr/local/smokeping/thirdparty
./configure --prefix=/usr/local/smokeping
/usr/bin/gmake install
#modiy smokeping
cd /usr/local/smokeping
mkdir cache data var
touch /var/log/smokeping.log
chown apache:apache cache data var
chown apache:apache /var/log/smokeping.log
cd /usr/local/smokeping/htdocs/
mv smokeping.fcgi.dist smokeping.fcgi
cd /usr/local/smokeping/etc
wget -nc http://software-server.autoclouds.net/smokeping/config
sed -i ‘s@cgiurl   = *@cgiurl   = http://‘$local_ip‘/smokeping.cgi@‘ config
chmod 600 /usr/local/smokeping/etc/smokeping_secrets.dist
echo "admin:vD2G06D1xPoMQ">/usr/local/smokeping/htdocs/htpasswd
chmod 644 /usr/local/smokeping/htdocs/htpasswd
chown -R apache:apache /usr/local/smokeping
echo "/usr/local/smokeping/bin/smokeping --logfile=/var/log/smokeping.log 2>&1 &" >> /etc/rc.local
/usr/local/smokeping/bin/smokeping --logfile=/var/log/smokeping.log 2>&1 &
cat >>/etc/httpd/conf/httpd.conf<<EOF
ServerTokens Prod
ServerSignature Off

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
AllowOverride AuthConfig
Order allow,deny
Allow from all 
AuthName "Smokeping"
AuthType Basic
AuthUserFile /usr/local/smokeping/htdocs/htpasswd
Require valid-user
DirectoryIndex smokeping.fcgi
</Directory>
EOF
/etc/init.d/httpd start
#ntpdate
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
ntpdate us.pool.ntp.org

一键安装smokeping脚本

标签:smokeping

原文地址:http://pythonhome.blog.51cto.com/10015972/1622614

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!