php4nagios install 笔记

-----down---------
wget https://sourceforge.net/projects/pnp4nagios/files/latest

-----doc-----------
http://docs.pnp4nagios.org/pnp-0.6/install

------install----------------

  ./configure  --with-rrdtoll=/usr/local/rrdtool/bin/rrdtool
  make all
  make install
  make fullinstall

-------Bulk Mode with NPCD and npcdmod------

修改nagios.cfg,配置内容如下

  
  
  
  
  1. event_broker_options=-1 # minimum 4+8=12
  2. process_performance_data=1  
  3. broker_module=/usr/local/pnp4nagios/lib/npcdmod.o config_file=/usr/local/pnp4nagios/etc/npcd.cfg

-------Nagios web frontend-----------

1.修改templates.cfg,增加如下行

  
  
  
  
  1. #pnp4nagios  
  2. define host {  
  3.    name       host-pnp  
  4.    action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=_HOST_' class='tips' rel='/pnp4nagios/popup?host=$HOSTNAME$&srv=_HOST_  
  5.    register   0  
  6. }  
  7.  
  8. define service {  
  9.    name       srv-pnp  
  10.    action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=$SERVICEDESC$' class='tips' rel='/pnp4nagios/popup?host=$HOSTNAME$&srv=$SERVICEDESC$  
  11.    register   0  

2.

 cp /root/pnp4nagios-0.6.10/contrib/ssi/status-header.ssi /usr/local/nagios/share/ssi/

3.http://<server name>/pnp4nagios/,安装检查

4.修改localhost.cfg,简单配置看效果example

  
  
  
  
  1. define host{  
  2.         use                     linux-server,host-pnp   Name of host template to use  
  3.                                                         ; This host definition will inherit all variables that are defined  
  4.                                                         ; in (or inherited by) the linux-server host template definition.  
  5.         host_name               localhost  
  6.         alias                   localhost  
  7.         address                 127.0.0.1  
  8.         }  
  9. define service{  
  10.         use                             local-service,srv-pnp         Name of service template to use  
  11.         host_name                       localhost  
  12.         service_description             PING  
  13.         check_command                   check_ping!100.0,20%!500.0,60%  
  14.         } 

5.

 /usr/local/pnp4nagios/bin/npcd -d -f /usr/local/pnp4nagios/etc/npcd.cfg
 service nagios reload

 

 
 

附,nginx相关配置
在安装包pnp4nagios-0.6.10/sample-config/下有一个nginx.pnp4nagios.conf,可参考此处配置nginx.conf

我的nginx.conf配置参考
 

  
  
  
  
  1. server {  
  2.         listen       80;  
  3.         root /var/www/html/;  
  4.  
  5.         if (-d $request_filename) {rewrite ^/(.*)([^/])$ http://$host/$1$2/ permanent;}  
  6.  
  7.         location = / {  
  8.         root /var/www/html/;  
  9.         index index.html index.htm index.php;  
  10.         }  
  11.         error_page   500 502 503 504  /50x.html;  
  12.         location = /50x.html {  
  13.         root   html;  
  14.         }  
  15.  
  16.         location /cacti {  
  17.         alias /var/www/html/cacti/;  
  18.         index index.html index.htm index.php;  
  19.         }  
  20.         location ~ ^/cacti/.+\.php$ {  
  21.         root /var/www/html/cacti/;  
  22.         rewrite /cacti/(.*\.php?) /$1 break;  
  23.         fastcgi_pass   127.0.0.1:9000;  
  24.         fastcgi_index  index.php;  
  25.         fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;  
  26.         include        fastcgi_params;  
  27.         }  
  28.         location /nagios {  
  29.         alias /usr/local/nagios/share/;  
  30.         index index.html index.htm index.php;  
  31.         ssi on;  
  32.         }  
  33.  
  34.         location ~ ^/nagios/.+\.php$ {  
  35.         root /usr/local/nagios/share/;  
  36.         rewrite /nagios/(.*\.php?) /$1 break;  
  37.         fastcgi_pass   127.0.0.1:9000;  
  38.         fastcgi_index  index.php;  
  39.         fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;  
  40.         include        fastcgi_params;  
  41.         }  
  42. location /pnp4nagios {  
  43. alias /usr/local/pnp4nagios/share;  
  44. index index.php;  
  45. try_files $uri $uri/ @pnp4nagios;  
  46.         }  
  47. location @pnp4nagios {  
  48.         fastcgi_pass   127.0.0.1:9000;  
  49.         fastcgi_index       index.pnp;  
  50.         fastcgi_split_path_info ^(.+\.php)(.*)$;  
  51.         fastcgi_param PATH_INFO $fastcgi_path_info;  
  52.         include        fastcgi_params;  
  53.         fastcgi_param SCRIPT_FILENAME /usr/local/pnp4nagios/share/index.php;  
  54.         }  
  55.         location ~ ^/nagios/.*\.(cgi|pl)?$ {  
  56.         root                /usr/local/nagios/sbin/;  
  57.         rewrite             ^/nagios/cgi-bin/(.*)\.cgi /$1.cgi break;  
  58.         fastcgi_pass        unix:/usr/local/nginx/logs/perl-fcgi.sock;  
  59.         fastcgi_index       index.cgi;  
  60.         fastcgi_param       SCRIPT_FILENAME $document_root$fastcgi_script_name;  
  61.         include        fastcgi_params;  
  62.         }  
  63. location /nginx_status {  
  64.                 stub_status on;  
  65.                 access_log off;  
  66.                 }  
  67.        } 

 

你可能感兴趣的:(职场,nagios,休闲,pnp4nagios)