ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Nagios pnp4nagios SUSE安装

Nagios pnp4nagios SUSE安装

原创 Linux操作系统 作者:tomshenhao 时间:2011-09-13 14:28:59 0 删除 编辑
 

至少需要SUSE Linux10.1 (因为之前版本没有php5和apache2-mod_php5)

安装前确保Nagios,check_mk均已安装,并可正常使用

1. 要求:Perl >= 5.x

检查 PERL:

# perl -v

This is perl, v5.8.8 built for i586-linux-thread-multi

Copyright 1987-2006, Larry Wall

2. 要求:RRDtool >= 1.x, better 1.2

检查rrdtool:

rrdtool -v
RRDtool 1.2.12  Copyright 1997-2005 by Tobias Oetiker

3. 要求:PHP >= 5.1 & mod_rewrite enable

修改配置文件:/etc/sysconfig/apache2

将"rewrite"加入"APACHE_MODULE="......."

测试:在文件夹/srv/www/htdocs创建文件1.php

文件内容:

用浏览器打开URL:http://localhost/1.php

正确结果:

a. 页面最上面显示的版本大于PHP5.1

b. 页面中查询到"mod_rewrite"

4. 安装 pnp4nagios-0.6.13.tar.gz

tar xvf pnp4nagios-0.6.13.tar.gz

./configure

make all

make install

make install-webconf

make install-config

make install-init

8. 改名文件:mv /usr/local/pnp4nagios/share/install.php /usr/local/pnp4nagios/share/install.php.bk

9. 打开NAGIOS.点击太阳图标,检查是否有绘图功能

10. 修改配置文件:

a. 创建配置文件

nagios $> cd /usr/local/pnp4nagios/etc
nagios $> mv misccommands.cfg-sample  misccommands.cfg
nagios $> mv nagios.cfg-sample  nagios.cfg
nagios $> mv npcd.cfg-sample npcd.cfg
nagios $> mv process_perfdata.cfg-sample  process_perfdata.cfg
nagios $> mv rra.cfg-sample rra.cfg
nagios $>  cd pages
nagios $> mv web_traffic.cfg-sample web_traffic.cfg
nagios $> cd ../check_commands
nagios $> mv check_all_local_disks.cfg-sample  check_all_local_disks.cfg
nagios $> mv check_nrpe.cfg-sample  check_nrpe.cfg
nagios $> mv check_nwstat.cfg-sample  check_nwstat.cfg

b. 重启服务

nagios $> /etc/init.d/npcd restart

c. 修改 nagios 的配置文件.打开performance_data

nagios $> cd /usr/local/nagios/etc
nagios $> vi nagios.cfg
去掉#:
process_performance_data=1
host_perfdata_command=process-host-perfdata
service_perfdata_command=process-service-perfdata

d. 修改 commands.cfg

nagios $> cd /usr/local/nagios/etc/objects
nagios $> vi commands.cfg

将原有的定义注释掉:

# 'process-host-perfdata' command definition
#define command{
#       command_name    process-host-perfdata
#       command_line    /usr/bin/printf "%b" "$LASTHOSTCHECK$\t$HOSTNAME$\t$HOSTSTATE$\t$HOSTATTEMPT$\t$HOSTSTATETYPE$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$\n" >> /usr/local/nagios/var/host-perfdata.out
#       }


# 'process-service-perfdata' command definition
#define command{
#       command_name    process-service-perfdata
#       command_line    /usr/bin/printf "%b" "$LASTSERVICECHECK$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICESTATE$\t$SERVICEATTEMPT$\t$SERVICESTATETYPE$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$\n" >> /usr/local/nagios/var/service-perfdata.out
#       }

添加新的内容:
# '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
        }

11. 重启check_mk服务

check_mk -II

check_mk -O

12. 重启nagios服务

service nagios restart

13. 重启httpd服务

service httpd restart

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/24751738/viewspace-707275/,如需转载,请注明出处,否则将追究法律责任。

上一篇: ORACLE order by
请登录后发表评论 登录
全部评论

注册时间:2011-07-14

  • 博文量
    260
  • 访问量
    393997