扫二维码与项目经理沟通
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流
1.安装rrdool
成都创新互联是一家网站设计公司,集创意、互联网应用、软件技术为一体的创意网站建设服务商,主营产品:响应式网站开发、成都品牌网站建设、成都全网营销推广。我们专注企业品牌在网站中的整体树立,网络互动的体验,以及在手机等移动端的优质呈现。成都网站制作、网站建设、移动互联产品、网络运营、VI设计、云产品.运维为核心业务。为用户提供一站式解决方案,我们深知市场的竞争激烈,认真对待每位客户,为客户提供赏析悦目的作品,网站的价值服务。安装所需环境: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
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
另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流