您的位置:首页 > 移动开发 > IOS开发

nagios pnp插件安装以及配置

2014-08-15 17:12 405 查看

一、准备

安装包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-sample  misccommands.cfg
mv nagios.cfg-sample nagios.cfg
mv rra.cfg-sample rra.cfg
2)修改/etc/pages下的配置文件
cd /usr/local/pnpnagios/etc/pages/
mv web_traffic.cfg-sample web_traffic.cfg
3)修改/etc/check_commands下的配置文件
cd /usr/local/pnp4nagios/etc/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


然后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 "/usr/local/pnpnagios//share">
AllowOverride None
Order allow,deny
Allow from all
#
# Use the same value as defined in nagios.conf
#
AuthName "Nagios Access"
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 "^(?:application|modules|system)/" - [F]
# Allow any files or directories that exist to be displayed directly
RewriteCond "%{REQUEST_FILENAME}" !-f
RewriteCond "%{REQUEST_FILENAME}" !-d
# Rewrite all other URLs to index.php/URL
RewriteRule "^.*$" "index.php/$0" [PT]
</IfModule>
</Directory>
4.2 如果遇到下面的错误



这几个问题暂时还没干掉,前辈让我用centos 搭环境 。。。。。。。 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  nagios