1.nagios安装请参见如下url。百度文库可以下载。
nagios完整配置文档(第一版)
2.pnp4nagios绘图
(1)下载php4naigos
(3) 编译安装 PNP4Nagios:
tar zxf pnp4nagios-0.6.2.tar.gz
cd pnp4nagios-0.6.2
./configure
make all && make install && make install-init && make install-config &&
make fullinstall
(4) 在 Nagios 配置文件 nagios.cfg 中修改以下配置:
process_performance_data=1
host_perfdata_command=process-host-perfdata
service_perfdata_command=process-service-perfdata
(5)修改 commands.cfg 中 process-host-perfdata 和 process-service-perfdata 命令的定义:
define command {
command_name process-host-perfdata
command_line /usr/bin/perl /usr/local/pnp4nagios/libexec/process_perfdata.pl -d HOSTPERFDATA
}
define command {
command_name process-service-perfdata
command_line /usr/bin/perl /usr/local/pnp4nagios/libexec/process_perfdata.pl
}
(6)在/usr/local/nagios/etc/objects/templates.cfg 尾部添加:
define host {
name host-pnp
action_url _
# action_url _
# action_url _
# action_url
register 0
process_perf_data 1
}
define service {
name srv-pnp
action_url
# action_url
# action_url
# action_url
register 0
process_perf_data 1
}
(7)apache中添加虚拟目录
Alias /pnp/ "/usr/local/pnp4nagios/share/"
Options MultiViews
AllowOverride None
Order allow,deny
Allow from all
AuthName "Nagios Access"
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd
Require valid-user
备注:也可以用rewrite
(8)在要使用 PNP4Nagios 显示图表的主机或服务中链接模板,hosts.cfg和services.cfg都需要修改如:
define host{
use linux-server, host-pnp
host_name localhost
alias localhost
address 127.0.0.1
}
define service{
use local-service,srv-pnp
host_name localhost
service_description PING
check_command check_ping!100.0,20%!500.0,60%
}
(9)修改 /usr/local/pnp4nagios/etc/config.php:
$conf['nagios_base'] =
修改 /usr/local/pnp4nagios/share/application/config/config.php:
$config['site_domain'] = '/';
(10)问题:如出现一下提示
PHP magic_quotes_gpc |
PHP is deprecated |
请将magic_quotes_gpc置为Off
(11)重启nagios和httpd,测试。
阅读(1176) | 评论(0) | 转发(0) |