快上网专注成都网站设计 成都网站制作 成都网站建设
成都网站建设公司服务热线:028-86922220

网站建设知识

十年网站开发经验 + 多家企业客户 + 靠谱的建站团队

量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决

nagios之pnp

1.安装rrdool

东川ssl适用于网站、小程序/APP、API接口等需要进行数据传输应用场景,ssl证书未来市场广阔!成为成都创新互联公司的ssl证书销售渠道,可以享受市场价格4-6折优惠!如果有意向欢迎电话联系或者加微信:028-86922220(备注:SSL证书合作)期待与您的合作!

安装所需环境: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

 

 


网站题目:nagios之pnp
文章网址:http://6mz.cn/article/jdepid.html

其他资讯