1.安装PNP
2.配置PNP
3.修改nagios配置文件
4.测试pnp功能
5.报错修改
Deprecated: Function eregi() is deprecated in /usr/local/nagios/share/pnp/include/function.inc.php on line 1541
Deprecated: Function eregi() is deprecated in /usr/local/nagios/share/pnp/include/function.inc.php on line 1541
Deprecated: Function eregi() is deprecated in /usr/local/nagios/share/pnp/include/function.inc.php on line 1541
终于搞定搞定,中间安装的时候还报了很多次错误,大部分都是你的包没有装完全,只要按照错误提示把相应的包安装好就OK了,先确认是否有以下rpm包:
-----------
1.检查模块是否存在:
[root@localhost pnp4nagios-0.6.16]# perl -MRRDs -le 'print q(ok!)'
Can't locate RRDs.pm in @INC (@INC contains: /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/5.8.8 .).
BEGIN failed--compilation aborted.
[root@localhost pnp4nagios-0.6.16]#ln -s /usr/local/rrdtool-1.4.7/lib/perl/5.8.8/x86_64-linux-thread-multi/RRDs.pm /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/
2.此检查模块是否存在:
[root@localhost pnp4nagios-0.6.16]# perl -MRRDs -le 'print q(ok!)'
Can't locate loadable object for module RRDs in @INC (@INC contains: /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/5.8.8 .) at -e line 0
Compilation failed in require.
BEGIN failed--compilation aborted.
[root@localhost pnp4nagios-0.6.16]# ln -s /usr/local/rrdtool-1.4.7/lib/perl/5.8.8/x86_64-linux-thread-multi/auto/RRDs/RRDs.so /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/
3.此次检查模块是否存在:
[root@localhost pnp4nagios-0.6.16]# perl -MRRDs -le 'print q(ok!)'
ok!
----
要实现Nagios数据的图像化需要使用第三方的软件,PNPNagios可以完成这个任务,PNPNagios的原名为php,下载地址为http://sourceforge.net/projects/pnp4nagios/,它利用RRDTool工具将Nagios的数据生成图形,以便更直观的查看,而且可以查看历史记录。
PNPNagios的安装与设置
如果解决了PNPNagios软件的依赖性,那么它还是比较好安装的,因此在具体的安装中,首先要根据下面提到的“软件依赖性”安装相关的软件或者模块,然后再安装PNPNagios软件。
软件依赖性
要安装使用pnp4nagios需要以下软件:
u Perl >= 5.x,不需要其它额外的模块;
u RRDtool >= 1.x,1.2版本更好,但是并不强制使用这个版本;
u PHP >=
u Nagios >= 2.x 或者是Icinga;
u Kohana需要启用“mod_rewrite”模块
注意:安装RRDtool没有安装包管理器可能会导致丢失dejavu字体,如果查看图像没有字体时,那么可能是由于这个问题引起的。
下载安装
首先来安装rrdtool,在这里比较简单的节选了部分安装过程:
[root@ff ~]# tar -zxvf rrdtool-
[root@ff ~]# cd rrdtool-
[root@ff rrdtool-
---------------------------------------------------------------- Config is DONE!
With MMAP IO: yes Perl Modules: perl_piped perl_shared Perl Binary: /usr/bin/perl Perl Version:
Perl Options: PREFIX=/usr/local/rrdtool-
Build Tcl Bindings: yes Build Python Bindings: yes Build rrdcgi: yes Build librrd MT: yes
Type 'make' to compile the software and use 'make install' to install everything to: /usr/local/rrdtool-
... that wishlist is NO JOKE. If you find RRDtool useful make me happy. Go to http://people.ee.ethz.ch/oetiker/wish and place an order.
-- Tobi Oetiker <tobi@oetiker.ch> ---------------------------------------------------------------- [root@ff rrdtool-
[root@ff rrdtool-
|
因为下面的安装中需要rrdtool的安装目录,因此在这里有必要提一下,下面来下载并安装PNP4Nagios。
点击上面的图标下载最新版本的安装包,下面是命令行的下载:
[root@s10 ~]# wget http://jaist.dl.sourceforge.net/project/pnp4nagios/PNP-0.6/pnp4nagios-
--16:03:19-- http://jaist.dl.sourceforge.net/project/pnp4nagios/PNP-0.6/pnp4nagios-
=> `pnp4nagios-
正在解析主机 jaist.dl.sourceforge.net... 150.65.7.130 正在连接 jaist.dl.sourceforge.net[150.65.7.130]:80... 已连接。 已发出 HTTP 请求,正在等待回应... 200 OK 长度:3,006,338 [application/x-gzip]
100%[===========================>] 3,006,338 709.85K/s ETA 00:00
16:03:25 (649.88 KB/s) - `pnp4nagios-
[root@s10 ~]# |
解压安装包:
[root@ff ~]# tar -zxvf pnp4nagios-
[root@ff ~]# cd pnp4nagios-
|
执行configure:
[root@ff pnp4nagios-
*** Configuration summary for pnp4nagios-0.6.17
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-
RRDs Perl Modules: *** NOT FOUND *** RRD Files stored in: /usr/local/pnp4nagios/var/perfdata process_perfdata.pl Logfile: /usr/local/pnp4nagios/var/perfdata.log Perfdata files (NPCD) stored in: /usr/local/pnp4nagios/var/spool
Web Interface Options: ------------------------- ------------------- HTML URL: http://localhost/pnp4nagios Apache Config File: /etc/httpd/conf.d/pnp4nagios.conf
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. |
注意提示,这个错误的原因是没有找到RRD perl模块,查看RRDTool的安装包,确实是在下面的路径中存在:
[root@ff ~]# ll /usr/local/rrdtool-
total 16 -r--r--r-- 1 root root 3850 Jul 14 2006 RRDs.pm drwxr-xr-x 4 root root 4096 Jun 8 16:34 auto -r--r--r-- 1 root root 1215 Jul 14 2006 ntmake.pl -rw-r--r-- 1 root root 456 Jun 8 16:34 perllocal.pod [root@ff ~]# |
解决方法使用--with-perl_lib_path选项:
[root@ff pnp4nagios-
> --with-rrdtool=/usr/local/rrdtool-
> --with-perl_lib_path=/usr/local/rrdtool-
>
*** Configuration summary for pnp4nagios-0.6.17
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-
RRDs Perl Modules: FOUND (Version 1.2015) RRDs Perl search path: /usr/local/rrdtool-
RRD Files stored in: /usr/local/pnp4nagios/var/perfdata process_perfdata.pl Logfile: /usr/local/pnp4nagios/var/perfdata.log Perfdata files (NPCD) stored in: /usr/local/pnp4nagios/var/spool
Web Interface Options: ------------------------- ------------------- HTML URL: http://localhost/pnp4nagios Apache Config File: /etc/httpd/conf.d/pnp4nagios.conf
Review the options above for accuracy. If they look okay, type 'make all' to compile. |
本文转自 pk2008 51CTO博客,原文链接:http://blog.51cto.com/837244/934852