PHP布Icinga-php4

有关Icinga-php4的文档信息与下载地址,可参看:http://icinga-cn.sourceforge.net/

我这里用的是icinga-pnp4-cn-1.12.2.tar.xz。

以账号限制的由来,在此间连无新建icinga用户,后续icinga的使用者是monitor用户。后续预编译的当儿需要点名。

一样、按照依赖包

# yum install httpd gcc glibc glibc-common gd gd-devel rrdtool php
php-gd

# yum install libjpeg libjpeg-devel libpng libpng-devel

# yum install net-snmp net-snmp-devel net-snmp-utils

次、解压安装包

# tar xvf icinga-pnp4-cn-1.12.2.tar.xz 

三、预编译

# cd icinga-pnp4-cn-1.12.2

# ./configure –prefix=/home/monitor/icinga  –with-icinga-user=monitor
-with-icinga-group=monitor –with-command-user=monitor
–with-command-group=monitor  –enable-idoutils=no

注意:如果没带指定后面的–enable-idoutils=no,编译过程遭到会报configure:
error: ERROR – We really need a libdbi to link against。

预编译就后,会输出以下信息

*** Configuration summary for pnp4icinga-0.6.25 03-01-2015 ***

  General Options:
  -------------------------         -------------------
  Icingapnp4 user/group:                monitor monitor
  Install directory:                /home/monitor/icinga
  HTML Dir:                         /home/monitor/icinga/share
  Config Dir:                       /home/monitor/icinga/etc
  Location of rrdtool binary:       /usr/bin/rrdtool Version 1.3.8
  RRDs Perl Modules:                *** NOT FOUND ***
  RRD Files stored in:              /home/monitor/icinga/var/perfdata
  process_perfdata.pl Logfile:      /home/monitor/icinga/var/log/perfdata.log
  Perfdata files (NPCD) stored in:  /home/monitor/icinga/var/spool/perfdata

  Web Interface Options:
  -------------------------         -------------------
  HTML URL:                         http://localhost/icinga
  Apache Config File:               /etc/httpd/conf.d/icinga.conf


  Review the options above for accuracy.  If they look okay,
  type 'make all' to compile.

挺显眼,RRDs Perl
Modules没有安装,如果没安装的话,会造成pnp出来的多寡是乱码。

# yum install rrdtool-perl

四、编译

# make all

出口信息如下:

*** Compile finished ***

If the main program and CGIs compiled without any errors, you
can continue with installing Icinga as follows (type 'make'
without any arguments for a list of all possible options):

  make install
     - This installs the main program (Icinga Core), CGIs
       (Classical Web), and HTML files

  make install-init
     - This installs the init script in /etc/rc.d/init.d

  make install-commandmode
     - This installs and configures permissions on the
       directory for holding the external command file

  make install-idoutils
     - This installs the database addon IDOUtils into the
       destination directory

  make install-config
     - This installs *SAMPLE* config files in /home/monitor/icinga/etc
       You'll have to modify these sample files before you can
       use Icinga.  Read the HTML documentation for more info
       on doing this.  Pay particular attention to the docs on
       object configuration files, as they determine what/how
       things get monitored!

  make install-webconf
     - This installs the Apache config file and http auth file for
       the Icinga Classic UI


  make install-webconf-auth
     - This installs the Apache http auth file for the Classic UI


 make install-processperfdata
     - pnp4icinga processperfdata in /home/monitor/icinga/libexec
 make install-plugins
     - pnp4icinga plugins in /home/monitor/icinga/libexec

除了make install-idoutils,依次执行上述命令

# make install

# make install-init

# make install-commandmode

# make install-eventhandlers

# make install-config

# make install-webconf

# make install-webconf-auth

# make install-processperfdata

# make install-plugins

五、配置经典WEB页面

# make cgis

# make install-cgis

# make install-html

安能访问WEB页面的用户和密码,在此处,用户名是icingaadmin,密码是icinga

# htpasswd -c /home/monitor/icinga/etc/htpasswd.users icingaadmin

六、编译和设置Icinga插件

# tar xvf nagios-cn-plugins-2.0.3.tar.xz 

# cd nagios-cn-plugins-2.0.3

#./configure –prefix=/home/monitor/icinga  –with-nagios-user=monitor
–with-nagios-group=monitor  

# make

# make install

七、编译和安NRPE插件

# tar xvf icinga-nrpe-2.14.tar.gz 

# cd icinga-nrpe-2.14

# ./configure –prefix=/home/monitor/icinga  –with-nrpe-user=monitor
–with-nrpe-group=monitor  –with-icinga-user=monitor
–with-icinga-group=monitor –enable-command-args 

# make all

输出如下,按自己之求来。

*** Compile finished ***

  make install
     - This installs files in /home/monitor/icinga

  make install-plugin
     - This installs init-script files in /home/monitor/icinga/libexec

  make install-init
     - This installs init-script files in /etc/init.d

  make install-xinetd
     - This installs sample-config/nrpe.xinetd in /etc/xinit.d

  make install-init-freebsd
     - This installs init-script.freebsd files in /etc/init.d

  make install-init-debian
     - This installs init-script.debian files in /etc/init.d

  make install-init-suse
     - This installs init-script.suse files in /etc/init.d

  make install-daemon-config
     - This installs the Nrpe config file in /home/monitor/icinga/etc

# make install

# make install-plugin

# make install-init

# make install-daemon-config

八、调整SELinux策略

临时关闭:# setenforce 0

永恒关闭:

# vim /etc/sysconfig/selinux 

SELINUX=disabled

九、启动HTTP,Icinga并补充加开机自启动

# /etc/init.d/httpd start

# /etc/init.d/icinga start

# chkconfig httpd on

# chkconfig icinga on

测试WEB页面能否健康打开

PHP 1

回报以上错误。

通过查看Apache日志,报错信息如下:

# tailf /var/log/httpd/error_log

[Thu Apr 28 17:00:33.682635 2016] [core:error] [pid 1538] (13)Permission denied: [client 192.168.244.1:49666] AH00035: access to /icinga/ denied (filesystem path '/home/monitor/icinga') because search permissions are missing on a component of the path

当网上查看了许多术,包括PHP没安装,SELinux没停歇啊。

最后才意识,是/home/monitor目录的特性在问题。默认是700底。

# ll -d /home/monitor/
drwx------ 3 monitor monitor 72 Apr 28 00:25 /home/monitor/

釜底抽薪智:

拿其目录属性设置为755

# chmod -R 755 /home/monitor/

再也登录Icinga WEB界面,OK

PHP 2

 

开辟页面后,没察觉图像啊,现在同步一步来

点击“服务详情”,出来以下画面

 

PHP 3

里面,蓝色框框的一部分就是是图像。

点击,出来以下提示信息,会来得“PNP4Icinga 环境测试”和“Kohana
环境测试”的结果。

个中,最后一实行是提示信息“您的条件经过了拥有要求. 现在可以去除或重命名
/usr/local/icinga/share/install.php 文件.”

PHP 4

 

依据提示,将拖欠文件改名 mv install.php install.php.bak

更点击图像,显示如下:

PHP 5

 

图像完美展现,注意,只可点击状态是“正常”和“警报”的,如果点击“严重”和“未知”,会报如下错误:

PHP 6

相关文章