Smokeping安裝

系統centos6.X

1、配置固定IP地址

2、關閉iptables

3、關閉selinux

4、安裝其他yum源

rpm -Uvh http://ftp.pbone.net/mirror/apt.sw.be/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm

5、安裝依賴包

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 httpd


注:perl-CGI-SpeedyCGI,perl-CGI-SpeedCGI這兩個包在安裝過程中會提示找不到,但沒關係

注:用yum安裝大量的依賴包還是很方便的,而百度上有些關於安裝smokeping的文檔要求使用wget下載後再用make,make install方式安裝,雖然make方式不復雜,但通過make編譯再安裝幾十個包就顯得有點繁鎖了。


6、下載安裝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

出現問題是因爲需要安裝perl的模塊,所以運行下面內容即可

./setup/build-perl-modules.sh /usr/local/smokeping/thirdparty

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

/usr/bin/gmake install


7、配置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

mv config.dist config

vim config

cgiurl   = http://some.url/smokeping.cgi

主要是修改這行,把some.url修改爲你的ip或者域名

*** Database ***

step  = 300

pings  = 60

然後修改step,從300改爲60,這是檢測的時間, pings 從20 改爲60, 即60秒ping 60次


8、修改密碼權限

chmod 600 /usr/local/smokeping/etc/smokeping_secrets.dist


9、安裝網站服務

yum -y install httpd*

已經做過了·······



10、修改網站服務配置文件


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

DirectoryIndex smokeping.fcgi

</Directory>


11、設置開啓啓動httpd、smokeping、關閉iptables

echo "/usr/local/smokeping/bin/smokeping --logfile=/var/log/smokeping.log 2>&1 &" >> /etc/rc.local

chkconfig httpd on      #開機啓動httpd進程

chkconfig iptables off  #開機不啓動iptables服務


12、啓動服務


/etc/init.d/httpd start

/usr/local/smokeping/bin/smokeping --logfile=/var/log/smokeping.log 2>&1 &


13、打開web驗證

在Web瀏覽器裏輸入 http://您的監控主機IP/smokeping



注:

如果遇到500錯誤:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, root@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

--------------------------------------------------------------------------------

Apache/2.2.15 (CentOS) Server at 192.168.2.101 Port 80


說明沒有關閉SElinux 選項,關閉就正常了

vi /etc/sysconfig/selinux

SELINUX=permissive


臨時關閉selinux

setenforce 0

[root@localhost ~]# getenforce     #查看SElinux 的命令

Permissive                      #返回的結果是Permissive, 表示已經關閉SElinux了




特別注意如果web界面出現軟件錯誤那麼需要執行一條命令即可

mv /usr/local/smokeping/thirdparty/lib/perl5/Carp/Heavy.pm /usr/local/smokeping/thirdparty/lib/perl5/Carp/Heavy.pm.bak



13、添加密碼驗證



修改httpd.conf裏的內容


<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>


進入cd /usr/local/smokeping/htdocs目錄, 執行命令:htpasswd -c /usr/local/smokeping/htdocs/htpasswd admin

這個是設置登錄賬戶爲admin,密碼在後面輸入,然後重啓httpd就可以實現密碼驗證登錄


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章