您好,登錄后才能下訂單哦!
1.安裝rrdool
安裝所需環境:yum install gcc libxml2-devel libpng-devel pkg-config glib pixman pango pango-devel freetype freetype-devel fontconfig cairo cairo-devel libart_lgpl libart_lgpl-devel libart_lgpl-devel
2.下載安裝包
wget http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.4.7.tar.gz
# tar zxvf rrdtool-1.4.5.tar.gz
# cd rrdtool-1.4.5
# ./configure --prefix=/usr/local/rrdtool
# make
# make install
在安裝過程中,出現
configure: error: Please fix the library issues listed above and try again錯誤
(1)安裝 cgilib-0.5.tar.gz
#wget http://download.chinaunix.net/down.php?id=2531&ResourceID=1333&site=1
#tar zxvf cgilib-0.5.tar.gz
#cd cgilib-0.5
#make
#cp libcgi.a /usr/local/lib
#cp cgi.h /usr/include
(2)安裝libart_lgpl-devel這個包
#yum –y install libart_lgpl-devel
(3)如果還報錯,把這兩個包裝上pango-devel cairo-devel
# yum –y install pango-devel* cairo-devel*
#cd cd rrdtool-X.X.X
#./configure --prefix=/usr/local/rrdtool
(4)如果還是不行的話,試試yum install libxml2-devel
重新make可以先make clean
3.如何驗證是否安裝成功
[root@localhost bin]# /usr/local/rrdtool/bin/rrdtool
RRDtool 1.4.7 Copyright 1997-2012 by Tobias Oetiker <tobi@oetiker.ch>
Compiled Apr 7 2013 11:29:20
Usage: rrdtool [options] command command_options
Valid commands: create, update, updatev, graph, graphv, dump, restore,
last, lastupdate, first, info, fetch, tune,
resize, xport, flushcached
RRDtool is distributed under the Terms of the GNU General
Public License Version 2. (www.gnu.org/copyleft/gpl.html)
顯示以上信息就是安裝成功了
pnp安裝
1.安裝pnp
wget http://nchc.dl.sourceforge.net/project/pnp4nagios/PNP/pnp-0.4.14/pnp-0.4.14.tar.gz
2.安裝pnp報錯
#./configure --with-nagios-user=nagios --with-nagios-group-nagios --with-rrdtool=/usr/local/rrdtool/bin/rrdtool --with-perfdata-dir=/usr/local/nagios/share/perfdata --with-perl_lib_path/usr/local/rrdtool/lib/perl/5.8.8/i386-linux-thread-multi/
configure: WARNING: Perl Module RRDs not available
*** Configuration summary for pnp4nagios-0.6.20 03-03-2013 ***
General Options:
------------------------- -------------------
Nagios user/group: nagios nagios
Install directory: /usr/local/pnp4nagios
HTML Dir: /usr/local/pnp4nagios/share
Config Dir: /usr/local/pnp4nagios/etc
Location of rrdtool binary: /usr/local/rrdtool/bin/rrdtool Version 1.4.5
RRDs Perl Modules: *** NOT FOUND ***
RRD Files stored in: /usr/local/nagios/share/perfdata
process_perfdata.pl Logfile: /usr/local/pnp4nagios/var/perfdata.log
Perfdata files (NPCD) stored in: /usr/local/pnp4nagios/var/spool
Review the options above for accuracy. If they look okay,
type 'make all' to compile.
WARNING: The RRDs Perl Modules are not found on your system
Using RRDs will speedup things in larger installations.
解決方法
#cd /usr/local/rrdtool/lib/perl/5.8.8/i386-linux-thread-multi
#cp RRDs.pm /usr/lib/perl5/5.8.8/i386-linux-thread-multi/
#cp /usr/local/rrdtool/lib/perl/5.8.8/i386-linux-thread-multi/auto/RRDs/RRDs.so /usr/lib/perl5/5.8.8/i386-linux-thread-multi/
重新./configure
[root@localhost pnp4nagios-0.6.20]#./configure --prefix=/usr/local/nagios --with-nagios-user=nagios --with-nagios-group-nagios --with-rrdtool=/usr/local/rrdtool/bin/rrdtool --with-perfdata-dir=/usr/local/nagios/share/perfdata --with-perl_lib_path=/usr/local/rrdtool/lib/perl/5.8.8/i386-linux-thread-multi/
3.安裝完成,PNP默認文件放置情況如下:
*** Configuration summary for pnp 0.4.14 05-02-2009 ***
General Options:
------------------------- -------------------
Nagios user/group: nagios nagios
Install directory: /usr/local/nagios
HTML Dir: /usr/local/nagios/share/pnp
Config Dir: /usr/local/nagios/etc/pnp
Location of rrdtool binary: /usr/local/rrdtool/bin/rrdtool Version 1.4.7
RRDs Perl Modules: FOUND (Version 1.4007)
RRDs Perl search path: /usr/local/rrdtool/lib/perl/5.8.8/i386-linux-thread-multi/
RRD Files stored in: /usr/local/nagios/share/perfdata
process_perfdata.pl Logfile: /usr/local/nagios/var/perfdata.log
Perfdata files (NPCD) stored in: /usr/local/nagios/var/spool/perfdata/
4.設置PNP
① 創建默認配置文件
cd /usr/local/nagios/etc/pnp
cp process_perfdata.cfg-sample process_perfdata.cfg 此文件無sample文件,將源文件備份即可
cp npcd.cfg-sample npcd.cfg
cp rra.cfg-sample rra.cfg
[root@localhost pnp]# chown -R nagios:nagios /usr/local/pnp4nagios/etc/
② 修改process_perfdata.cfg文件
vi /usr/local/nagios/etc/pnp/process_perfdata.cfg
LOG_FILE = /usr/local/nagios/var/perfdata.log
# Loglevel 0=silent 1=normal 2=debug
LOG_LEVEL = 2
這里將日志級別改為2,即為debug模式。
5.修改nagios配置文件
①增加小太陽標示
修改templates.cfg,增加一個定義PNP的hosts和services
define host {
name hosts-pnp
register 0
action_url /nagios/pnp/index.php?host=$HOSTNAME$
process_perf_data 1
}
define service {
name services-pnp
register 0
action_url /nagios/pnp/index.php?host=$HOSTNAME$&srv=$SERVICEDESC$
process_perf_data 1
}
②修改nagios.cfg
找到如下幾項,去掉注釋,修改后信息如下:
process_performance_data=1
host_perfdata_command=process-host-perfdata
service_perfdata_command=process-service-perfdata
③修改commands.cfg
# 'process-host-perfdata' command definition
define command{
command_name process-host-perfdata
command_line /usr/local/nagios/libexec/process_perfdata.pl
}
# 'process-service-perfdata' command definition
define command{
command_name process-service-perfdata
command_line /usr/local/nagios/libexec/process_perfdata.pl
}
④修改hosts.cfg文件和services.cfg文件
define host{
use linux-server,hosts-pnp
host_name web
alias ixdba-web
address 192.168.12.251
}
define host{
use linux-server,hosts-pnp
host_name mysql
alias ixdba-mysql
address 192.168.12.237
}
define service{
use local-service,services-pnp
host_name mysql
service_description SSH
check_command check_ssh
}
define service{
use local-service,services-pnp
host_name web
service_description http
check_command check_http
}
6.測試PNP功能
所有配置完成之后,重新檢查nagios配置文件是否正確,然后重啟nagios
/etc/init.d/nagios restart
如果配置正確,此時就會生成響應主機的pnp文件
[root@nagios web]# pwd
/usr/local/nagios/share/perfdata/web
[root@gaojf web]# ls
http.rrd http.xml PING.rrd PING.xml SSHD.rrd SSHD.xml
最后打開網頁:
打開網頁http://IP/nagios,選擇主機選項,然后點擊小太陽就可以看到圖表,或者訪問http://ip/nagios/pnp也可以直接訪問圖表信息。
##################################################################
進入監控界面,點擊監控主機的小太陽提示一下錯誤
PHP zlib Support not found.
PHP GD Support not found.
(1)由于編譯PHP時候未將zlib,gd編譯進PHP中,需要重新編譯PHP 添加參數--with-zlib,--with-gd
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-zlib --with-gd
(2)安裝完PHP提示
You may want to add: /usr/local/php/lib/php to your php.ini include_path
/root/rpm/php-5.3.23/build/shtool install -c ext/phar/phar.phar /usr/local/php/bin
ln -s -f /usr/local/php/bin/phar.phar /usr/local/php/bin/phar
Installing PDO headers: /usr/local/php/include/php/ext/pdo/
解決方法 :cp php.ini-production /usr/local/php/lib/php.ini
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。