#!/bin/bash
local_ip= '/sbin/ifconfig |grep ' inet addr: ' |grep-ev ' 127.0.0.1 ' | Cut-d:-f2|awk ' {print $} ' |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-dev El 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 ' [email protected] = * @cgiurl =/http ' $local _ip '/[email protected] ' 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
Install smokeping script with one click