-----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 |
-------Bulk Mode with NPCD and npcdmod------
修改nagios.cfg,配置内容如下
- event_broker_options=-1 # minimum 4+8=12
- process_performance_data=1
- broker_module=/usr/local/pnp4nagios/lib/npcdmod.o config_file=/usr/local/pnp4nagios/etc/npcd.cfg
-------Nagios web frontend-----------
1.修改templates.cfg,增加如下行
- #pnp4nagios
- define host {
- name host-pnp
- action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=_HOST_' class='tips' rel='/pnp4nagios/popup?host=$HOSTNAME$&srv=_HOST_
- register 0
- }
- define service {
- name srv-pnp
- action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=$SERVICEDESC$' class='tips' rel='/pnp4nagios/popup?host=$HOSTNAME$&srv=$SERVICEDESC$
- 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
- define host{
- use linux-server,host-pnp ; Name of host template to use
- ; This host definition will inherit all variables that are defined
- ; in (or inherited by) the linux-server host template definition.
- host_name localhost
- alias localhost
- address 127.0.0.1
- }
- define service{
- use local-service,srv-pnp ; Name of service template to use
- host_name localhost
- service_description PING
- check_command check_ping!100.0,20%!500.0,60%
- }
5.
/usr/local/pnp4nagios/bin/npcd -d -f /usr/local/pnp4nagios/etc/npcd.cfg |
附,nginx相关配置
在安装包pnp4nagios-0.6.10/sample-config/下有一个nginx.pnp4nagios.conf,可参考此处配置nginx.conf
我的nginx.conf配置参考
- server {
- listen 80;
- root /var/www/html/;
- if (-d $request_filename) {rewrite ^/(.*)([^/])$ http://$host/$1$2/ permanent;}
- location = / {
- root /var/www/html/;
- index index.html index.htm index.php;
- }
- error_page 500 502 503 504 /50x.html;
- location = /50x.html {
- root html;
- }
- location /cacti {
- alias /var/www/html/cacti/;
- index index.html index.htm index.php;
- }
- location ~ ^/cacti/.+\.php$ {
- root /var/www/html/cacti/;
- rewrite /cacti/(.*\.php?) /$1 break;
- fastcgi_pass 127.0.0.1:9000;
- fastcgi_index index.php;
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
- include fastcgi_params;
- }
- location /nagios {
- alias /usr/local/nagios/share/;
- index index.html index.htm index.php;
- ssi on;
- }
- location ~ ^/nagios/.+\.php$ {
- root /usr/local/nagios/share/;
- rewrite /nagios/(.*\.php?) /$1 break;
- fastcgi_pass 127.0.0.1:9000;
- fastcgi_index index.php;
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
- include fastcgi_params;
- }
- location /pnp4nagios {
- alias /usr/local/pnp4nagios/share;
- index index.php;
- try_files $uri $uri/ @pnp4nagios;
- }
- location @pnp4nagios {
- fastcgi_pass 127.0.0.1:9000;
- fastcgi_index index.pnp;
- fastcgi_split_path_info ^(.+\.php)(.*)$;
- fastcgi_param PATH_INFO $fastcgi_path_info;
- include fastcgi_params;
- fastcgi_param SCRIPT_FILENAME /usr/local/pnp4nagios/share/index.php;
- }
- location ~ ^/nagios/.*\.(cgi|pl)?$ {
- root /usr/local/nagios/sbin/;
- rewrite ^/nagios/cgi-bin/(.*)\.cgi /$1.cgi break;
- fastcgi_pass unix:/usr/local/nginx/logs/perl-fcgi.sock;
- fastcgi_index index.cgi;
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
- include fastcgi_params;
- }
- location /nginx_status {
- stub_status on;
- access_log off;
- }
- }
转载于:https://blog.51cto.com/dadaru/469127