星期四, 9月 08, 2011

crawlzilla with openSUSE 11.3 小記


今天將 da4  納入 nagios Server 的監控 ( da1 )

將做的事情紀錄一下
可以參考自己的文件 https://docs.google.com/document/d/1_g3NbOpyk13QQGAzczAA8EVWq47zjVRE6bXd6ZZeyuo/edit?hl=zh_TW

以利以後擴展 slave node

Client 部份

利用 zypper 安裝 nagios-nrpe 以及  nagios-plugins-nrpe
#zypper   install   nagios-nrpe   nagios-plugins-nrpe

設定允許 nagios 主機使用 nrpe 來監控
#vi /etc/nagios/nrpe.cfg

加入 監控主機IP 來允許監控
allowed_hosts=127.0.0.1,監控主機_IP


加入 針對 sda1 sda2 sda3 的 command 還有 check_ssh check_smtp

command[check_sda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/sda1
command[check_sda2]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/sda2
command[check_sda3]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/sda3
command[check_ssh]=/usr/lib/nagios/plugins/check_ssh 127.0.0.1
command[check_smtp]=/usr/lib/nagios/plugins/check_smtp 127.0.0.1


Server 部份
複製 其他主機的 cfg 給新主機用

#cp  /etc/nagios/objects/linux52.cfg   /etc/nagios/objects/linux53.cfg

#vi  /etc/nagios/objects/linux53.cfg
修改相關 IP 及主機名稱


將新主機納入監控範圍
#vi   /etc/nagios/nagios.cfg
cfg_file=/etc/nagios/objects/linux53.cfg


重新啟動  nagios
#rcnagios   restart


---------------------------  Crawlzilla with  openSUSE -------------------------

利用 script 安裝 Crawlzilla with openSUSE

prepare-opensuse-crawlzilla-master.sh 

內容為

#!/bin/bash
## ----------將 openSUSE 的套件庫更換到Taiwan 的下載中心 開始 ---------------------
echo "Print the rep  in use"
zypper  lr -u

#Define openSUSE Version
VERSION=`cat /etc/SuSE-release | grep VERSION | cut -d ' ' -f 3`
echo "This openSUSE version is $VERSION"

echo "Remove Ori Rep"
zypper rr 1
zypper rr 1
zypper rr 1
zypper rr 1
zypper rr 1
zypper rr 1

echo "Add Taiwan's rep "

## for OSS
zypper ar -f http://ftp.twaren.net/Linux/OpenSuSE/distribution/$VERSION/repo/oss/  Twaren-Oss
#zypper ar -f http://download.opensuse.org/distribution/$VERSION/repo/non-oss/ suse_non-oss
#zypper ar -f http://ftp.ncnu.edu.tw/Linux/opensuse/distribution/$VERSION/repo/non-oss/ ncnu_non-oss

## for Non-OSS
#zypper ar -f http://ftp.cse.yzu.edu.tw/pub/Linux/openSUSE/distribution/$VERSION/repo/non-oss/  cse_non-oss
zypper ar -f http://ftp.twaren.net/Linux/OpenSuSE/distribution/$VERSION/repo/non-oss/ Twaren-Non-oss

## for update
#zypper ar http://ftp.twaren.net/Linux/OpenSuSE/update/$VERSION/repodata/  twaren_update
zypper ar -f http://ftp.twaren.net/Linux/OpenSuSE/update/$VERSION/  Twaren-Update
#zypper ar -f http://download.opensuse.org/update/$VERSION/  suse_update

## for Pacman Rep
zypper ar -f http://ftp.nchc.org.tw/Linux/Packman/suse/$VERSION/ NCHC-Pacman
#zypper ar -f http://ftp.twaren.net/Linux/Packman/suse/$VERSION/ twaren_packman

# 匯入金鑰 and 更新快取
# refresh repo and import keys
zypper  --gpg-auto-import-keys refresh

## ----------將 openSUSE 的套件庫更換到Taiwan 的下載中心 結束---------------------

echo -e "\033[31m"
echo "*** Show sshd status ***"
rcsshd  status

echo -e "\033[0m"
echo ""
echo "*** Restart sshd and Make Default boot ***"
rcsshd  restart
chkconfig  sshd --list
chkconfig  sshd on
chkconfig  sshd --list

echo -e "\033[34m"
echo ""
echo "*** checking java package ***"
zypper search java-1

echo -e "\033[0m"
echo ""
echo "*** Remove java-*-openjdk and install java-*-sun"
zypper remove -y java-*-openjdk
zypper install -y --auto-agree-with-licenses java-*-sun-devel
echo -e "\033[33m"
echo ""
echo "*** checking java package ***"
zypper search java-*-sun

echo -e "\033[0m"
echo ""
echo "*** You should see java-*-sun already install ***"

echo -e "\033[32m"
echo ""
echo "*** Get expect package for crawlzilla !! ***"
zypper install -y expect

echo -e "\033[0m"
echo ""
#echo "*** Get Crawlzilla 0.3.0 Now!! ***"
#wget http://downloads.sourceforge.net/project/crawlzilla/stable/Crawlzilla-0.3/Crawlzilla-0.3.0.tar.gz

echo "*** Get Crawlzilla 1.1 Now!! ***"
#wget http://sourceforge.net/projects/crawlzilla/files/stable/Crawlzilla-1.0/Crawlzilla-1.0.0.tar.gz
#wget http://sourceforge.net/projects/crawlzilla/files/testing/Crawlzilla-1.0/Crawlzilla-1.0.110708.tar.gz
#wget http://sourceforge.net/projects/crawlzilla/files/testing/Crawlzilla-1.0/Crawlzilla-1.0.110725.tar.gz
wget http://sourceforge.net/projects/crawlzilla/files/testing/Crawlzilla-1.1/Crawlzilla-1.1.110906.tar.gz

echo -e "\033[31m"
echo ""
echo "*** Untar Crawlzilla to /opt ***"
tar  zxvf  Crawlzilla-*.tar.gz -C /opt


echo -e "\033[0m"
echo ""
echo "*** Install Crawlzilla  Now!! ***"
/opt/Crawlzilla_Install/install

#開啟 http://主機:8080
#要使用本機登入 8080 port 改密碼


啟動的時候發現 jps 沒有辦法使用
本來以為是沒有安裝
後來查了一下才知道是 路徑的問題

# ls  -l   /usr/bin/jps
lrwxrwxrwx 1 root root 29 2011-09-08 18:48 /usr/bin/jps -> /usr/java/jdk1.6.0_21/bin/jps

# echo $JAVA_HOME
/usr/lib/jvm/java

所以  jps 的所在位置是  /usr/lib/jvm/java/bin/jps

修正一下 先將錯誤的 jps 連結刪除

# rm   /usr/bin/jps

# ln   -s   /usr/lib/jvm/java/bin/jps  /usr/bin/jps


目前Hadoop 可以啟動, 但是 Tomcat 還沒有順利啟動
期待官方趕快修正
也謝謝 NCHC





沒有留言: