Ubuntu下nagios安装pnp4nagios插件-阿里云开发者社区

开发者社区> 开发与运维> 正文

Ubuntu下nagios安装pnp4nagios插件

简介:

Ubuntu下nagios安装pnp4nagios插件:


# apt-get install rrdtool

# apt-get install librrds-perl

# apt-get install php5 php5-gd

# tar zxvf  pnp4nagios-0.6.6.tar.gz
# cd pnp4nagios-0.6.6
# /configure --with-nagios-user=nagios --with-nagios-group=nagios
# make all
# make install
# make install-config
# make install-init

# mv sample-config/httpd.conf sample-config/nagiosweb.conf
# cp sample-config/nagiosweb.conf /etc/apache2/conf.d/
# vi /etc/apache2/conf.d/nagiosweb.conf

AuthType /usr/local/nagios/etc/htpasswd   (原为AuthType /usr/local/nagios/etc/htpasswd.users)

:wq

# service apache2 restart


# 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-sample web_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
# mv check_nwstat.cfg-sample  check_nwstat.cfg

启动npcd服务

# service npcd start


# vi /usr/local/nagios/etc/nagios.cfg  (把前面的注释符"#"去掉)

process_performance_data=1 (原为process_performance_data=0)
host_perfdata_command=process-host-perfdata
service_perfdata_command=process-service-perfdata

:wq

# vi /usr/local/nagios/etc/objects/commands.cfg

# '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
       }

:wq


注:要注释掉原有对process-service-perfdata和process-host-perfdata的定义

为主机添加小太阳图标

# vi /usr/local/nagios/etc/objects/yang.cfg


define host {
use       linux-server
host_name    yang
address      192.168.1.10
action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$
}

:wq

为单个服务添加小太阳图标

# vi /usr/local/nagios/etc/objects/yang.cfg

define service {
use        generic-service
host_name   yang
service_description      check_load
check_command       check_nrpe!check_load
normal_check_interval     2
action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=$SERVICEDESC$

}

:wq



重启 nagios 服务

# service nagios restart



# mv /usr/local/pnp4nagios/share/install.php  /usr/local/pnp4nagios/share/install2.php   (或者直接删除)

注:点击小太阳图标后会出现个测试页面,各项要求都PASS了,会提示你重命名或删除install.php文件,原因不详



# ls /usr/local/pnp4nagios/var/perfdata  (看下面有没有nagios中定义的主机名目录以及目录下面有没有对应服务的rrd文件和xml文件)

注:nagio图像(pnp4nagios)只能显示nagios插件中的服务,以脚本监控的服务不显示图像

本文转自linux博客51CTO博客,原文链接http://blog.51cto.com/yangzhiming/1380537如需转载请自行联系原作者


yangzhimingg

版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。

分享:
开发与运维
使用钉钉扫一扫加入圈子
+ 订阅

集结各类场景实战经验,助你开发运维畅行无忧

其他文章