使用PNPNagios圖形化Nagios資料 1

nginx_web發表於2012-06-11

     要實現Nagios資料的影像化需要使用第三方的軟體,PNPNagios可以完成這個任務,PNPNagios的原名為php,下載地址為http://sourceforge.net/projects/pnp4nagios/,它利用RRDTool工具將Nagios的資料生成圖形,以便更直觀的檢視,而且可以檢視歷史記錄。

 

PNPNagios的安裝與設定

 

如果解決了PNPNagios軟體的依賴性,那麼它還是比較好安裝的,因此在具體的安裝中,首先要根據下面提到的“軟體依賴性”安裝相關的軟體或者模組,然後再安裝PNPNagios軟體。

軟體依賴性

 

    要安裝使用pnp4nagios需要以下軟體:

 

u       Perl >= 5.x,不需要其它額外的模組;

u       RRDtool >= 1.x1.2版本更好,但是並不強制使用這個版本;

u       PHP >= 5.1.6 基於Kohanaweb前端的需要;

u       Nagios >= 2.x 或者是Icinga

u       Kohana需要啟用“mod_rewrite”模組

 

    注意:安裝RRDtool沒有安裝包管理器可能會導致丟失dejavu字型,如果檢視影像沒有字型時,那麼可能是由於這個問題引起的。

 

下載安裝

 

首先來安裝rrdtool,在這裡比較簡單的節選了部分安裝過程:

 

 

[root@ff ~]# tar -zxvf rrdtool-1.2.15.tar.gz

[root@ff ~]# cd rrdtool-1.2.15

[root@ff rrdtool-1.2.15]# ./configure

 

 

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

Config is DONE!

 

          With MMAP IO: yes

          Perl Modules: perl_piped perl_shared

           Perl Binary: /usr/bin/perl

          Perl Version: 5.8.5

          Perl Options: PREFIX=/usr/local/rrdtool-1.2.15 LIB=/usr/local/rrdtool-1.2.15/lib/perl/5.8.5

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

 

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

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

[root@ff rrdtool-1.2.15]# make

[root@ff rrdtool-1.2.15]# make install

 

因為下面的安裝中需要rrdtool的安裝目錄,因此在這裡有必要提一下,下面來下載並安裝PNP4Nagios

 

 

點選上面的圖示下載最新版本的安裝包,下面是命令列的下載:

 

[root@s10 ~]# wget http://jaist.dl.sourceforge.net/project/pnp4nagios/PNP-0.6/pnp4nagios-0.6.17.tar.gz

--16:03:19--  http://jaist.dl.sourceforge.net/project/pnp4nagios/PNP-0.6/pnp4nagios-0.6.17.tar.gz

           => `pnp4nagios-0.6.17.tar.gz'

正在解析主機 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-0.6.17.tar.gz' saved [3,006,338/3,006,338]

 

[root@s10 ~]#

 

解壓安裝包:

 

[root@ff ~]# tar -zxvf pnp4nagios-0.6.17.tar.gz

[root@ff ~]# cd pnp4nagios-0.6.17

 

    執行configure

 

[root@ff pnp4nagios-0.6.17]#  ./configure --prefix=/usr/local/pnp4nagios --with-rrdtool=/usr/local/rrdtool-1.2.15/bin/rrdtool

 

*** Configuration summary for pnp4nagios-0.6.17 03-25-2012 ***

 

  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-1.2.15/bin/rrdtool Version 1.2.15

  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-1.2.15/lib/perl/5.8.5/i386-linux-thread-multi/

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-0.6.17]#  ./configure --prefix=/usr/local/pnp4nagios  \

> --with-rrdtool=/usr/local/rrdtool-1.2.15/bin/rrdtool  \

> --with-perl_lib_path=/usr/local/rrdtool-1.2.15/lib/perl/   \

> 5.8.5/i386-linux-thread-multi/

 

*** Configuration summary for pnp4nagios-0.6.17 03-25-2012 ***

 

  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-1.2.15/bin/rrdtool Version 1.2.15

  RRDs Perl Modules:              FOUND (Version 1.2015)

  RRDs Perl search path:

                /usr/local/rrdtool-1.2.15/lib/perl/5.8.5/i386-linux-thread-multi/

  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.

 

   

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/27043155/viewspace-732480/,如需轉載,請註明出處,否則將追究法律責任。

相關文章