2015年7月30日

CentOS 6.6安裝Smokeping流程


0.      關閉SELiunx
vi /etc/selinux/config
SELINUX=enforcing 改成disabled
(Setenforce 0 暫時關閉SELiunx)

開啟iptables port 80
system-config-firewall-tui

1.      安裝相關套件

2.      安裝rrdtool
yum -y install libart_lgpl-devel zlib-devel libpng-devel freetype-devel  cairo-devel libxml2-devel pango-devel dejavu-lgc-fonts* pango* freetype* rrdtool-perl

cd /opt

cd rrdtool-1.5.3

./configure -prefix=/usr/local/

make
make install

whereis rrdtool
rrdtool: /usr/local/bin/rrdtool

3.      安裝fping
cd /opt
tar –zxvpf fping-3.10.tar.gz
cd fping-3.10

./configure
make
make install

whereis fping
fping: /usr/local/sbin/fping

4.      安裝smokeping
cd /opt
tar –zxvpf smokeping-2.6.11.tar.gz


./configure –prefix=/usr/local/smokeping

gmake install

whereis smokeping
smokeping: /usr/local/smokeping /opt/smokeping-2.6.11/bin/smokeping


建立smokeping存放資料目錄
mkdir -p /usr/local/smokeping/cache
mkdir -p /usr/local/smokeping/data
mkdir -p /usr/local/smokeping/var

修改資料目錄權限
chmod –R apache.apache /usr/local/smokeping/cache
chmod –R apache.apache /usr/local/smokeping/data
chmod –R apache.apache /usr/local/smokeping/var

vi /usr/local/smokeping/bin/smokeping
找到use lib qw(/usr/pack/rrdtool-1.0.33-to/lib/perl);
將路徑改為use lib qw(/usr/local/rrdtool/lib/perl/5.10.1);




建立修改smokeping設定檔
cd /usr/local/smokeping/etc
cp config.dist config
vi config

檢查修改config檔內容為以下路徑
cgiu imgcache = /usr/local/smokeping/cache
imgurl = cache
datadir = /usr/local/smokeping/data
piddir = /usr/local/smokeping/var
cgiurl = http://some.url/smokeping.cgi
tmail = /usr/local/smokeping/etc/tmail.dist

檢查修改FPing路徑
+ FPing
binary = /usr/sbin/fping
修改為 /usr/local/sbin/fping

修改httpd.conf設定
vi /etc/httpd/conf/httpd.conf
找到下行新增ExecCGI
Options Indexes FollowSymLinks ExecCGI
AddHandler cgi-script .cgi

httpd.conf加入以下內容
ScriptAlias /smokeping/ "/usr/local/smokeping/htdocs/”

Directory "/usr/local/smokeping/htdocs/">
    AllowOverride None
    Options Indexes FollowSymLinks ExecCGI
    Order allow,deny
    Allow from all


設定httpd document root連結
cd /var/www/html/
ln -s /usr/local/smokeping/htdocs/ smokeping
cd /usr/local/smokeping/htdocs/
cp /usr/local/smokeping/htdocs/smokeping.fcgi smokeping.cgi
ln -s /usr/local/smokeping/cache cache


修改smokeping_secrets.dist 權限為600
chmod 600 /usr/local/smokeping/etc/smokeping_secrets.dist

設定smokeping開機啟動:
vi /etc/init.d/smokeping
將以下連結內容copy至新建檔案etc/init.d/smokepinghttps://oss.oetiker.ch/smokeping/pub/contrib/smokeping-start-script-rh72
5.      修改etc/init.d/smokeping內容的路徑
SMOKEPING=/usr/local/smokeping/bin/smokeping
CONFIG=/usr/local/smokeping/etc/config

修改smokeping 啟動權限
chmod 755 /etc/init.d/smokeping

設定開機自動啟動
chkconfig --add smokeping
chkconfig smokeping on

追蹤者