nagios+pnp4nagios監控

 

pnp4nagios php

1、安裝pnp4nagios ios

  預安裝:rrdtoolperl-Time* web

yum install rrdtool perl-Time* -y apache

  tar -axvf pnp4nagios-0.6.4.tar.gz –C /usr/local/src/ 瀏覽器

  cd /usr/local/src/ 性能

    ./configure --prefix=/usr/local/pnp4nagios \ ui

--with-nagios-user=nagios \ this

--with-nagios-group=nagios url

    make all spa

make install

make install-webconf

make install-config

make install-init

make fullinstall

2、PNP4Nagios Nagios 整合

   

   建立配置文件:

cd /usr/local/pnp4nagios/etc

mv   misccommands.cfg-sample  misccommands.cfg

mv   nagios.cfg-sample nagios.cfg

mv npcd.cfg-sample npcd.cfg

mv   process_perfdata.cfg-sample process_perfdata.cfg

mv rra.cfg-sample rra.cfg

cd pages

mv   web_traffic.cfg-sampleweb_traffic.cfg

cd ../check_commands

mv   check_all_local_disks.cfg-sample check_all_local_disks.cfg

mv check_nrpe.cfg-sample check_nrpe.cfg

②修改nagios 配置文件,vi /usr/local/nagios/etc/nagios.cfg,將相應配置修改成如下內容:

process_performance_data=1

host_perfdata_command=process-host-perfdata

service_perfdata_command=process-service-perfdata

修改nagios 配置文件commands.cfg 文件中的process-host-perfdata

process-service-perfdata

# 'process-host-perfdata' command definition
define command{
       command_name   process-host-perfdata
       command_line   /usr/local/pnp4nagios/libexec/process_perfdata.pl
       }

# 'process-service-perfdata' command definition
define command{
       command_name   process-service-perfdata
       command_line   /usr/local/pnp4nagios/libexec/process_perfdata.pl
       }

④將性能圖集成到nagiosweb頁面,即添加小太陽模版,鑲嵌在nagios頁面上。

vi /usr/local/nagios/etc/objects/templates.cfg

define host{

name   host-pnp

register   0

action_url    /pnp4nagios/index.php/graph?host=$HOSTNAME$

}

define service{

name   srv-pnp

register   0

action_url    /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=$SERVICEDESC$

}

⑤讓PNP4Nagios 顯示圖形在nagios 的主機中或服務中顯示,加入host-pnp

srv-pnp 配置實例(注:通常只需在主機的定義(hosts.cfg)的第一行中加入:

use host-pnp便可)

例:define host {
    
 use                            host-pnp
      host_name               nagios-server

      alias                        nagios-server

      address                   10.0.0.77

      contact_groups              sagroup

      check_command             check-host-alive

      max_check_attempts        5

      notification_interval     10

      notification_period       24x7

      notification_options      d,u,r

      }

PNP4Nagios Apache 整合:

apache的配置文件httpd.conf中加上下面這行:

include conf.d/pnp4nagios.conf

⑦全部者:

chown R nagios:nagios  /usr/local/nagios

chown R nagios:nagios  /usr/local/pnp4nagios

重啓服務:(便可)

         /etc/init.d/npcd   restart

       /etc/init.d/nagios       restart

常見問題:

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

Starting nagios:touch: cannot touch `/usr/local/nagios/var/nagios.log': Permission denied

 done.

解決辦法:權限問題,將/usr/local/nagios/var/nagios.log改成chown nagios:nagios問題解決。

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

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, root@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Apache/2.2.3 (CentOS) Server at 192.168.1.142 Port 80

解決辦法:

http配置錯誤,與之前的配置同名了,唉!

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

checking for SSL headers... configure: error: Cannot find ssl headers

解決辦法:yum install openssl-devel

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

經過Web訪問nagios出現You don't have permission to access /nagios/ on this server提示

安裝nagios後,經過web訪問nagios時,瀏覽器提示:You don't have permission to access /nagios/ on this server 

問題分析:提示顯示是沒有權限,首先檢測nagios配置文件,若是nagios配置文件都正確。那多是由於系統缺乏php包,我裝了兩次都是遇到沒有php包。

解決方法:使用yum命令直接安裝php包:#yum install php 

安裝好後,再重啓httpd命令:service httpd restart

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

描述:安裝好pnp4nagios後打開pnp4nagios要求你輸入用戶名密碼,始終輸入不正確。而後頁出現以下錯誤提示Authorization Required

This server could not verify that you are authorized to access the document requested. Either you supplied the wrong credentials (e.g., bad password), or your browser doesn't understand how to supply the credentials required.

解決辦法:是因爲在安裝pnp4nagios後在/etc/httpd/conf.d裏,已經生成pnp4nagios.conf配置文件,配置文件有 AuthUserFile /usr/local/nagios/etc/htpasswd.user參數,與密碼文件名一致,

致使,始終沒法正確輸入用戶密碼,修改相應的文件名就能夠了。唉糾結了半天才發現。

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

錯誤描述:登入pnp4nagios時開啓php.inimagic_quotes_gpc = On,而後出現錯誤提示: magic_quotes_gpc is deprecated

解決辦法:magic_quotes_gpc = Off

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

錯誤描述:service nagios restart

Running configuration check...done.

Stopping nagios: done.

Starting nagios:su: warning: cannot change directory to /dev/null: Not a directory

This account is currently not available.

緣由未知,反正能夠正常使用程序。

相關文章
相關標籤/搜索