08678 发表于 2015-11-23 08:01:48

nagios pnp插件安装以及配置

一、准备

安装包pnp4nagios-0.6.24.tar.gz。

已经上传至我的共享文档中,需要的伙伴可以下载。


二、安装

tar zxvf pnp4nagios-0.6.24.tar.gz
./configure --prefix=/usr/local/pnpnagios
make all
make install
make install-webconf
make install-config
make install-init
三、配置

3.1 pnp配置
1)修改/usr/local/pnpnagios/etc下的配置文件
cd   /usr/local/pnpnagios/etc
mv misccommands.cfg-samplemisccommands.cfg
mv nagios.cfg-sample nagios.cfg
mv rra.cfg-sample rra.cfg2)修改/etc/pages下的配置文件
cd /usr/local/pnpnagios/etc/pages/
mv web_traffic.cfg-sample web_traffic.cfg3)修改/etc/check_commands下的配置文件
cd /usr/local/pnp4nagios/etc/check_commands
.mv check_all_local_disks.cfg-samplecheck_all_local_disks.cfg
mv check_nrpe.cfg-samplecheck_nrpe.cfg
mv check_nwstat.cfg-samplecheck_nwstat.cfg

然后service npcd start如果正确启动说明安装成功


3.2Nagios配置


修改etc目录下的command.cfg配置文件,修改如下命令
define command {
command_name    process-service-perfdata
command_line    /usr/bin/perl /usr/local/nagios/pnp4nagios/libexec/process_perfdata.pl
}
define command {
command_name    process-host-perfdata
command_line    /usr/bin/perl /usr/local/nagios/pnp4nagios/libexec/process_perfdata.pl -d HOSTPERFDATA
}

注:上面的配置不能直接复制到文件中,需要将原来的命令定义注释掉


修改/etc下的templates.cfg配置文件,修改如下
define host{
name                            generic-host   
process_perf_data               1         ; Process performance data
action_url /pnpnagios/index.php/graph?host=$HOSTNAME$&srv=_HOST_
}
define service{
name                            generic-service   ; The 'na
process_perf_data               1         ; Process performance data
action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=$SERVICEDESC$
}

其实就是在每一个地难以上加入action_url配置选项


重启Nagios服务,应该可以看到在两个主机旁边的那个折线的小图表






四、遇到的问题

4.1 如果点击第三步的折线小图标出现找不到URL的错误,那pnp自己产生的一个用于apache2配置的文件(/etc/httpd/conf.d/pnp4nagios.conf)内容复制到你的主apache2配置文件,我的在/usr/local/apache/conf/httpd/conf
Alias /pnpnagios "/usr/local/pnpnagios//share"
<Directory &quot;/usr/local/pnpnagios//share&quot;>
AllowOverride None
Order allow,deny
Allow from all
#
# Use the same value as defined in nagios.conf
#
AuthName &quot;Nagios Access&quot;
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd
Require valid-user
<IfModule mod_rewrite.c>
# Turn on URL rewriting
RewriteEngine On
Options symLinksIfOwnerMatch
# Installation directory
RewriteBase /pnp4nagios/
# Protect application and system files from being viewed
RewriteRule &quot;^(?:application|modules|system)/&quot; -
# Allow any files or directories that exist to be displayed directly
RewriteCond &quot;%{REQUEST_FILENAME}&quot; !-f
RewriteCond &quot;%{REQUEST_FILENAME}&quot; !-d
# Rewrite all other URLs to index.php/URL
RewriteRule &quot;^.*$&quot; &quot;index.php/$0&quot;
</IfModule>
</Directory>
4.2 如果遇到下面的错误

这几个问题暂时还没干掉,前辈让我用centos 搭环境 。。。。。。。
页: [1]
查看完整版本: nagios pnp插件安装以及配置